diff options
-rw-r--r-- | bgpd/bgp_mplsvpn.c | 9 | ||||
-rw-r--r-- | bgpd/bgp_packet.c | 6 | ||||
-rw-r--r-- | bgpd/bgp_route.c | 8 | ||||
-rw-r--r-- | bgpd/bgp_routemap.c | 3 | ||||
-rw-r--r-- | bgpd/bgp_vty.c | 12 | ||||
-rw-r--r-- | bgpd/bgpd.c | 11 | ||||
-rw-r--r-- | bgpd/bgpd.h | 4 | ||||
-rw-r--r-- | lib/if.c | 14 | ||||
-rw-r--r-- | lib/jhash.c | 2 | ||||
-rw-r--r-- | lib/vty.c | 2 | ||||
-rw-r--r-- | lib/workqueue.c | 2 | ||||
-rw-r--r-- | ospf6d/ospf6_abr.h | 2 | ||||
-rw-r--r-- | ospf6d/ospf6_network.c | 16 | ||||
-rw-r--r-- | ospf6d/ospf6_network.h | 6 | ||||
-rw-r--r-- | ospf6d/ospf6_route.h | 5 | ||||
-rw-r--r-- | ospf6d/ospf6_spf.c | 1 | ||||
-rw-r--r-- | zebra/router-id.c | 3 |
17 files changed, 59 insertions, 47 deletions
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 31ec6947a..2510e2e04 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -130,6 +130,15 @@ bgp_nlri_parse_vpnv4 (struct peer *peer, struct attr *attr, pnt += BGP_ADDPATH_ID_LEN; } + if (prefixlen < 88) + { + zlog_err ("prefix length is less than 88: %d", prefixlen); + return -1; + } + + /* XXX: Not doing anything with the label */ + decode_label (pnt); + /* Fetch prefix length. */ prefixlen = *pnt++; p.family = afi2family (packet->afi); diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 08082161f..025cfbaee 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -1862,8 +1862,8 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size) if (orf_type == ORF_TYPE_PREFIX || orf_type == ORF_TYPE_PREFIX_OLD) { - u_char *p_pnt = stream_pnt (s); - u_char *p_end = stream_pnt (s) + orf_len; + uint8_t *p_pnt = stream_pnt (s); + uint8_t *p_end = stream_pnt (s) + orf_len; struct orf_prefix orfp; u_char common = 0; u_int32_t seq; @@ -1956,7 +1956,7 @@ bgp_route_refresh_receive (struct peer *peer, bgp_size_t size) (common & ORF_COMMON_PART_DENY ? 0 : 1 ), (common & ORF_COMMON_PART_REMOVE ? 0 : 1)); - if (!ok || (ret != CMD_SUCCESS)) + if (!ok || (ok && ret != CMD_SUCCESS)) { zlog_info ("%s Received misformatted prefixlist ORF." " Remove All pfxlist", peer->host); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 581d9db89..74969e0ec 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -13399,6 +13399,7 @@ bgp_distance_unset (struct vty *vty, const char *distance_str, const char *ip_str, const char *access_list_str) { int ret; + int distance; struct prefix_ipv4 p; struct bgp_node *rn; struct bgp_distance *bdistance; @@ -13418,6 +13419,13 @@ bgp_distance_unset (struct vty *vty, const char *distance_str, } bdistance = rn->info; + distance = atoi(distance_str); + + if (bdistance->distance != distance) + { + vty_out (vty, "Distance does not match configured%s", VTY_NEWLINE); + return CMD_WARNING; + } if (bdistance->access_list) XFREE(MTYPE_AS_LIST, bdistance->access_list); diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index ad154389e..ab22a455d 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -2100,6 +2100,7 @@ static route_map_result_t route_match_ipv6_next_hop (void *rule, struct prefix *prefix, route_map_object_t type, void *object) { + struct in6_addr *addr = rule; struct bgp_info *bgp_info; if (type == RMAP_BGP) @@ -2109,7 +2110,7 @@ route_match_ipv6_next_hop (void *rule, struct prefix *prefix, if (!bgp_info->attr->extra) return RMAP_NOMATCH; - if (IPV6_ADDR_SAME (&bgp_info->attr->extra->mp_nexthop_global, rule)) + if (IPV6_ADDR_SAME (&bgp_info->attr->extra->mp_nexthop_global, addr)) return RMAP_MATCH; if (bgp_info->attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL && diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index ad04308f0..825f5954c 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -4662,6 +4662,7 @@ static int peer_weight_set_vty (struct vty *vty, const char *ip_str, const char *weight_str) { + int ret; struct peer *peer; unsigned long weight; @@ -4671,23 +4672,22 @@ peer_weight_set_vty (struct vty *vty, const char *ip_str, VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); - peer_weight_set (peer, weight); - - return CMD_SUCCESS; + ret = peer_weight_set (peer, weight); + return bgp_vty_return (vty, ret); } static int peer_weight_unset_vty (struct vty *vty, const char *ip_str) { + int ret; struct peer *peer; peer = peer_and_group_lookup_vty (vty, ip_str); if (! peer) return CMD_WARNING; - peer_weight_unset (peer); - - return CMD_SUCCESS; + ret = peer_weight_unset (peer); + return bgp_vty_return (vty, ret); } DEFUN (neighbor_weight, diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 61bed4fc5..36ab3e5fa 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -4421,7 +4421,7 @@ peer_port_unset (struct peer *peer) } /* neighbor weight. */ -void +int peer_weight_set (struct peer *peer, u_int16_t weight) { struct peer_group *group; @@ -4431,7 +4431,7 @@ peer_weight_set (struct peer *peer, u_int16_t weight) peer->weight = weight; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) - return; + return 0; /* peer-group member updates. */ group = peer->group; @@ -4439,9 +4439,10 @@ peer_weight_set (struct peer *peer, u_int16_t weight) { peer->weight = group->conf->weight; } + return 1; } -void +int peer_weight_unset (struct peer *peer) { struct peer_group *group; @@ -4456,7 +4457,7 @@ peer_weight_unset (struct peer *peer) UNSET_FLAG (peer->config, PEER_CONFIG_WEIGHT); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) - return; + return 0; /* peer-group member updates. */ group = peer->group; @@ -4464,7 +4465,7 @@ peer_weight_unset (struct peer *peer) { peer->weight = 0; } - return; + return 1; } int diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 20f23e73c..1e7a00628 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -1268,8 +1268,8 @@ extern int peer_default_originate_unset (struct peer *, afi_t, safi_t); extern int peer_port_set (struct peer *, u_int16_t); extern int peer_port_unset (struct peer *); -extern void peer_weight_set (struct peer *, u_int16_t); -extern void peer_weight_unset (struct peer *); +extern int peer_weight_set (struct peer *, u_int16_t); +extern int peer_weight_unset (struct peer *); extern int peer_timers_set (struct peer *, u_int32_t, u_int32_t); extern int peer_timers_unset (struct peer *); @@ -638,16 +638,14 @@ if_flag_dump (unsigned long flag) static void if_dump (const struct interface *ifp) { + struct listnode *node; + struct connected *c __attribute__((unused)); + + for (ALL_LIST_ELEMENTS_RO (ifp->connected, node, c)) zlog_info ("Interface %s vrf %u index %d metric %d mtu %d " -#ifdef HAVE_IPV6 - "mtu6 %d " -#endif /* HAVE_IPV6 */ - "%s", + "mtu6 %d %s", ifp->name, ifp->vrf_id, ifp->ifindex, ifp->metric, ifp->mtu, -#ifdef HAVE_IPV6 - ifp->mtu6, -#endif /* HAVE_IPV6 */ - if_flag_dump (ifp->flags)); + ifp->mtu6, if_flag_dump (ifp->flags)); } /* Interface printing for all interface. */ diff --git a/lib/jhash.c b/lib/jhash.c index decd066cd..6154c3463 100644 --- a/lib/jhash.c +++ b/lib/jhash.c @@ -105,7 +105,7 @@ jhash (const void *key, u_int32_t length, u_int32_t initval) * The length parameter here is the number of u_int32_ts in the key. */ u_int32_t -jhash2 (const u_int32_t * k, u_int32_t length, u_int32_t initval) +jhash2 (const u_int32_t *k, u_int32_t length, u_int32_t initval) { u_int32_t a, b, c, len; @@ -2486,7 +2486,7 @@ vty_log_fixed (char *buf, size_t len) if (!vtyvec) return; - iov[0].iov_base = (void *)buf; + iov[0].iov_base = buf; iov[0].iov_len = len; iov[1].iov_base = crlf; iov[1].iov_len = 2; diff --git a/lib/workqueue.c b/lib/workqueue.c index 6fad237e1..a45a6fc09 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -31,7 +31,7 @@ /* master list of work_queues */ static struct list _work_queues; -/* pointer primarly to avid an otherwise harmless warning on +/* pointer primarily to avoid an otherwise harmless warning on * ALL_LIST_ELEMENTS_RO */ static struct list *work_queues = &_work_queues; diff --git a/ospf6d/ospf6_abr.h b/ospf6d/ospf6_abr.h index bfd609c25..5bc2469e1 100644 --- a/ospf6d/ospf6_abr.h +++ b/ospf6d/ospf6_abr.h @@ -24,6 +24,8 @@ /* for struct ospf6_route */ #include "ospf6_route.h" +/* for struct ospf6_prefix */ +#include "ospf6_proto.h" /* Debug option */ extern unsigned char conf_debug_ospf6_abr; diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 0d53d3ee7..7b1cf9193 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -37,18 +37,8 @@ int ospf6_sock; struct in6_addr allspfrouters6; struct in6_addr alldrouters6; -/* setsockopt ReUseAddr to on */ -void -ospf6_set_reuseaddr (void) -{ - u_int on = 0; - if (setsockopt (ospf6_sock, SOL_SOCKET, SO_REUSEADDR, &on, - sizeof (u_int)) < 0) - zlog_warn ("Network: set SO_REUSEADDR failed: %s", safe_strerror (errno)); -} - /* setsockopt MulticastLoop to off */ -void +static void ospf6_reset_mcastloop (void) { u_int off = 0; @@ -58,7 +48,7 @@ ospf6_reset_mcastloop (void) safe_strerror (errno)); } -void +static void ospf6_set_pktinfo (void) { setsockopt_ipv6_pktinfo (ospf6_sock, 1); @@ -72,7 +62,7 @@ ospf6_set_transport_class (void) #endif } -void +static void ospf6_set_checksum (void) { int offset = 12; diff --git a/ospf6d/ospf6_network.h b/ospf6d/ospf6_network.h index 7208845d2..2aeafe504 100644 --- a/ospf6d/ospf6_network.h +++ b/ospf6d/ospf6_network.h @@ -28,12 +28,6 @@ extern int ospf6_sock; extern struct in6_addr allspfrouters6; extern struct in6_addr alldrouters6; -/* Function Prototypes */ -extern void ospf6_set_reuseaddr (void); -extern void ospf6_reset_mcastloop (void); -extern void ospf6_set_pktinfo (void); -extern void ospf6_set_checksum (void); - extern int ospf6_serv_sock (void); extern int ospf6_sso (u_int ifindex, struct in6_addr *group, int option); diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index e5bfc5ed0..b3be66c28 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -130,6 +130,10 @@ struct ospf6_route /* Destination Type */ u_char type; + /* XXX: It would likely be better to use separate struct in_addr's + * for the advertising router-ID and prefix IDs, instead of stuffing them + * into one. See also XXX below. + */ /* Destination ID */ struct prefix prefix; @@ -247,6 +251,7 @@ extern const char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX]; #define ospf6_route_is_best(r) (CHECK_FLAG ((r)->flag, OSPF6_ROUTE_BEST)) +/* XXX: This gives GCC heartburn aboutbreaking aliasing rules. */ #define ospf6_linkstate_prefix_adv_router(x) \ ((x)->u.prefix4.s_addr) #define ospf6_linkstate_prefix_id(x) \ diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 52b60f1e6..fda3bb5fb 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -42,6 +42,7 @@ #include "ospf6_intra.h" #include "ospf6_interface.h" #include "ospf6d.h" +#include "ospf6_abr.h" unsigned char conf_debug_ospf6_spf = 0; diff --git a/zebra/router-id.c b/zebra/router-id.c index a1d7cb9da..58c1c031c 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -43,6 +43,9 @@ #include "zebra/router-id.h" #include "zebra/redistribute.h" +/* master zebra server structure */ +extern struct zebra_t zebrad; + static struct connected * router_id_find_node (struct list *l, struct connected *ifc) { |