diff options
-rw-r--r-- | bgpd/bgp_fsm.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_packet.c | 24 | ||||
-rw-r--r-- | bgpd/bgp_route.c | 17 | ||||
-rw-r--r-- | bgpd/bgp_zebra.c | 33 | ||||
-rw-r--r-- | lib/prefix.h | 6 | ||||
-rw-r--r-- | ospf6d/ospf6_interface.c | 17 | ||||
-rw-r--r-- | ospf6d/ospf6_lsdb.c | 4 | ||||
-rw-r--r-- | ospf6d/ospf6_top.c | 2 | ||||
-rw-r--r-- | ripd/rip_interface.c | 19 | ||||
-rw-r--r-- | ripd/rip_zebra.c | 2 | ||||
-rw-r--r-- | ripd/ripd.c | 2 | ||||
-rw-r--r-- | ripd/ripd.h | 2 | ||||
-rw-r--r-- | ripngd/ripng_interface.c | 31 | ||||
-rw-r--r-- | ripngd/ripngd.c | 5 | ||||
-rw-r--r-- | zebra/irdp.h | 7 | ||||
-rw-r--r-- | zebra/irdp_interface.c | 25 | ||||
-rw-r--r-- | zebra/irdp_main.c | 20 | ||||
-rw-r--r-- | zebra/irdp_packet.c | 6 |
18 files changed, 68 insertions, 156 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 6121e74a..c815f9a1 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -427,7 +427,7 @@ bgp_fsm_change_status (struct peer *peer, int status) } /* Flush the event queue and ensure the peer is shut down */ -int +static int bgp_clearing_completed (struct peer *peer) { int rc = bgp_stop(peer); diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index e57112f2..cbf58e56 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -920,30 +920,6 @@ bgp_notify_send (struct peer *peer, u_char code, u_char sub_code) bgp_notify_send_with_data (peer, code, sub_code, NULL, 0); } -static const char * -afi2str (afi_t afi) -{ - if (afi == AFI_IP) - return "AFI_IP"; - else if (afi == AFI_IP6) - return "AFI_IP6"; - else - return "Unknown AFI"; -} - -static const char * -safi2str (safi_t safi) -{ - if (safi == SAFI_UNICAST) - return "SAFI_UNICAST"; - else if (safi == SAFI_MULTICAST) - return "SAFI_MULTICAST"; - else if (safi == SAFI_MPLS_VPN || safi == BGP_SAFI_VPNV4) - return "SAFI_MPLS_VPN"; - else - return "Unknown SAFI"; -} - /* Send route refresh message to the peer. */ void bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi, diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 3488452a..206cf702 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -11032,23 +11032,6 @@ bgp_distance_unset (struct vty *vty, const char *distance_str, return CMD_SUCCESS; } -static void -bgp_distance_reset (void) -{ - struct bgp_node *rn; - struct bgp_distance *bdistance; - - for (rn = bgp_table_top (bgp_distance_table); rn; rn = bgp_route_next (rn)) - if ((bdistance = rn->info) != NULL) - { - if (bdistance->access_list) - free (bdistance->access_list); - bgp_distance_free (bdistance); - rn->info = NULL; - bgp_unlock_node (rn); - } -} - /* Apply BGP information to distance method. */ u_char bgp_distance_apply (struct prefix *p, struct bgp_info *rinfo, struct bgp *bgp) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 49380cc3..f3baeee0 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -639,39 +639,6 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote, return ret; } -#ifdef HAVE_IPV6 -static unsigned int -bgp_ifindex_by_nexthop (struct in6_addr *addr) -{ - struct listnode *ifnode; - struct listnode *cnode; - struct interface *ifp; - struct connected *connected; - struct prefix_ipv6 p; - - p.family = AF_INET6; - p.prefix = *addr; - p.prefixlen = IPV6_MAX_BITLEN; - - for (ALL_LIST_ELEMENTS_RO (iflist, ifnode, ifp)) - { - for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, connected)) - { - struct prefix *cp; - - cp = connected->address; - - if (cp->family == AF_INET6) - { - if (prefix_match (cp, (struct prefix *)&p)) - return ifp->ifindex; - } - } - } - return 0; -} -#endif /* HAVE_IPV6 */ - void bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp) { diff --git a/lib/prefix.h b/lib/prefix.h index d3707209..a7598b7e 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -137,6 +137,12 @@ prefix_bit (const u_char *prefix, const u_char prefixlen) return (prefix[offset] >> shift) & 1; } +static inline unsigned int +prefix6_bit (const struct in6_addr *prefix, const u_char prefixlen) +{ + return prefix_bit((const u_char *) &prefix->s6_addr, prefixlen); +} + /* Prototypes. */ extern int afi2family (int); extern int family2afi (int); diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 2cd5303f..777bc7c9 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -690,23 +690,6 @@ neighbor_change (struct thread *thread) return 0; } -static int -loopind (struct thread *thread) -{ - struct ospf6_interface *oi; - - oi = (struct ospf6_interface *) THREAD_ARG (thread); - assert (oi && oi->interface); - - if (IS_OSPF6_DEBUG_INTERFACE) - zlog_debug ("Interface Event %s: [LoopInd]", - oi->interface->name); - - /* XXX not yet */ - - return 0; -} - int interface_down (struct thread *thread) { diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c index d2e3e04c..280bdf95 100644 --- a/ospf6d/ospf6_lsdb.c +++ b/ospf6d/ospf6_lsdb.c @@ -381,7 +381,7 @@ ospf6_lsdb_type_router_head (u_int16_t type, u_int32_t adv_router, /* Walk down tree. */ while (node && node->p.prefixlen <= key.prefixlen && prefix_match (&node->p, (struct prefix *) &key)) - node = node->link[prefix_bit(&key.prefix, node->p.prefixlen)]; + node = node->link[prefix6_bit(&key.prefix, node->p.prefixlen)]; if (node) route_lock_node (node); @@ -435,7 +435,7 @@ ospf6_lsdb_type_head (u_int16_t type, struct ospf6_lsdb *lsdb) node = lsdb->table->top; while (node && node->p.prefixlen <= key.prefixlen && prefix_match (&node->p, (struct prefix *) &key)) - node = node->link[prefix_bit(&key.prefix, node->p.prefixlen)]; + node = node->link[prefix6_bit(&key.prefix, node->p.prefixlen)]; if (node) route_lock_node (node); diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index c4cc9fac..82370268 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -143,6 +143,7 @@ ospf6_create (void) return o; } +#if 0 static void ospf6_delete (struct ospf6 *o) { @@ -163,6 +164,7 @@ ospf6_delete (struct ospf6 *o) XFREE (MTYPE_OSPF6_TOP, o); } +#endif static void ospf6_enable (struct ospf6 *o) diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 4f80bf42..d3b55fc0 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -239,6 +239,7 @@ rip_request_interface (struct interface *ifp) } } +#if 0 /* Send RIP request to the neighbor. */ static void rip_request_neighbor (struct in_addr addr) @@ -269,6 +270,7 @@ rip_request_neighbor_all (void) if (rp->info) rip_request_neighbor (rp->p.u.prefix4); } +#endif /* Multicast packet receive socket. */ static int @@ -423,8 +425,9 @@ rip_interface_up (int command, struct zclient *zclient, zebra_size_t length) return 0; if (IS_RIP_DEBUG_ZEBRA) - zlog_debug ("interface %s index %d flags %lld metric %d mtu %d is up", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); + zlog_debug ("interface %s index %d flags %#llx metric %d mtu %d is up", + ifp->name, ifp->ifindex, (unsigned long long) ifp->flags, + ifp->metric, ifp->mtu); /* Check if this interface is RIP enabled or not.*/ rip_enable_apply (ifp); @@ -447,8 +450,9 @@ rip_interface_add (int command, struct zclient *zclient, zebra_size_t length) ifp = zebra_interface_add_read (zclient->ibuf); if (IS_RIP_DEBUG_ZEBRA) - zlog_debug ("interface add %s index %d flags %lld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); + zlog_debug ("interface add %s index %d flags %#llx metric %d mtu %d", + ifp->name, ifp->ifindex, (unsigned long long) ifp->flags, + ifp->metric, ifp->mtu); /* Check if this interface is RIP enabled or not.*/ rip_enable_apply (ifp); @@ -486,8 +490,9 @@ rip_interface_delete (int command, struct zclient *zclient, rip_if_down(ifp); } - zlog_info("interface delete %s index %d flags %lld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); + zlog_info("interface delete %s index %d flags %#llx metric %d mtu %d", + ifp->name, ifp->ifindex, (unsigned long long) ifp->flags, + ifp->metric, ifp->mtu); /* To support pseudo interface do not free interface structure. */ /* if_delete(ifp); */ @@ -947,8 +952,6 @@ rip_interface_wakeup (struct thread *t) return 0; } -int rip_redistribute_check (int); - static void rip_connect_set (struct interface *ifp, int set) { diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index 7729d9b4..c476d8f4 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -233,6 +233,7 @@ DEFUN (no_router_zebra, return CMD_SUCCESS; } +#if 0 static int rip_redistribute_set (int type) { @@ -246,6 +247,7 @@ rip_redistribute_set (int type) return CMD_SUCCESS; } +#endif static int rip_redistribute_unset (int type) diff --git a/ripd/ripd.c b/ripd/ripd.c index 2d5a8560..5a6dbc8c 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -2976,6 +2976,7 @@ DEFUN (no_rip_route, return CMD_SUCCESS; } +#if 0 static void rip_update_default_metric (void) { @@ -2987,6 +2988,7 @@ rip_update_default_metric (void) if (rinfo->type != ZEBRA_ROUTE_RIP && rinfo->type != ZEBRA_ROUTE_CONNECT) rinfo->metric = rip->default_metric; } +#endif DEFUN (rip_default_metric, rip_default_metric_cmd, diff --git a/ripd/ripd.h b/ripd/ripd.h index 4d0c04e2..45b07b9c 100644 --- a/ripd/ripd.h +++ b/ripd/ripd.h @@ -395,6 +395,8 @@ extern int if_check_address (struct in_addr addr); extern int rip_request_send (struct sockaddr_in *, struct interface *, u_char, struct connected *); extern int rip_neighbor_lookup (struct sockaddr_in *); + +extern int rip_redistribute_check (int); extern void rip_redistribute_add (int, int, struct prefix_ipv4 *, unsigned int, struct in_addr *, unsigned int, unsigned char); extern void rip_redistribute_delete (int, int, struct prefix_ipv4 *, unsigned int); diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index c23d32a2..6718fff2 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -157,22 +157,6 @@ ripng_if_ipv6_lladdress_check (struct interface *ifp) return count; } -/* Check max mtu size. */ -static unsigned int -ripng_check_max_mtu (void) -{ - struct listnode *node; - struct interface *ifp; - unsigned int mtu; - - mtu = 0; - for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) - if (mtu < ifp->mtu6) - mtu = ifp->mtu6; - - return mtu; -} - static int ripng_if_down (struct interface *ifp) { @@ -277,8 +261,9 @@ ripng_interface_down (int command, struct zclient *zclient, ripng_if_down (ifp); if (IS_RIPNG_DEBUG_ZEBRA) - zlog_debug ("interface down %s index %d flags %lld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6); + zlog_debug ("interface down %s index %d flags %#llx metric %d mtu %d", + ifp->name, ifp->ifindex, + (unsigned long long) ifp->flags, ifp->metric, ifp->mtu6); return 0; } @@ -292,8 +277,9 @@ ripng_interface_add (int command, struct zclient *zclient, zebra_size_t length) ifp = zebra_interface_add_read (zclient->ibuf); if (IS_RIPNG_DEBUG_ZEBRA) - zlog_debug ("RIPng interface add %s index %d flags %lld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6); + zlog_debug ("RIPng interface add %s index %d flags %#llx metric %d mtu %d", + ifp->name, ifp->ifindex, (unsigned long long) ifp->flags, + ifp->metric, ifp->mtu6); /* Check is this interface is RIP enabled or not.*/ ripng_enable_apply (ifp); @@ -325,8 +311,9 @@ ripng_interface_delete (int command, struct zclient *zclient, ripng_if_down(ifp); } - zlog_info("interface delete %s index %d flags %lld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6); + zlog_info("interface delete %s index %d flags %#llx metric %d mtu %d", + ifp->name, ifp->ifindex, (unsigned long long) ifp->flags, + ifp->metric, ifp->mtu6); /* To support pseudo interface do not free interface structure. */ /* if_delete(ifp); */ diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 9deac032..6e32d83c 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -272,7 +272,10 @@ ripng_recv_packet (int sock, u_char *buf, int bufsize, /* Incoming packet's multicast hop limit. */ if (cmsgptr->cmsg_level == IPPROTO_IPV6 && cmsgptr->cmsg_type == IPV6_HOPLIMIT) - *hoplimit = *((int *) CMSG_DATA (cmsgptr)); + { + int *phoplimit = (int *) CMSG_DATA (cmsgptr); + *hoplimit = *phoplimit; + } } /* Hoplimit check shold be done when destination address is diff --git a/zebra/irdp.h b/zebra/irdp.h index 1f0c1ecd..9ce55e58 100644 --- a/zebra/irdp.h +++ b/zebra/irdp.h @@ -146,5 +146,12 @@ extern void irdp_init(void); extern int irdp_sock_init(void); extern void irdp_finish(void); extern void irdp_config_write (struct vty *, struct interface *); +extern int irdp_send_thread(struct thread *t_advert); +extern void irdp_advert_off(struct interface *ifp); +extern void process_solicit (struct interface *ifp); +extern int irdp_read_raw(struct thread *r); +extern void send_packet(struct interface *ifp, struct stream *s, + u_int32_t dst, struct prefix *p, u_int32_t ttl); + #endif /* _IRDP_H */ diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index d982c23c..8742b62b 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -65,14 +65,19 @@ /* Master of threads. */ extern struct zebra_t zebrad; -int in_cksum (void *ptr, int nbytes); extern int irdp_sock; -int irdp_send_thread(struct thread *t_advert); -char *inet_2a(u_int32_t a, char *b); -void irdp_advert_off(struct interface *ifp); +static const char * +inet_2a(u_int32_t a, char *b) +{ + sprintf(b, "%u.%u.%u.%u", + (a ) & 0xFF, + (a>> 8) & 0xFF, + (a>>16) & 0xFF, + (a>>24) & 0xFF); + return b; +} -char b1[16], b2[16], b3[16], b4[16]; /* For inet_2a */ static struct prefix * irdp_get_prefix(struct interface *ifp) @@ -98,6 +103,7 @@ if_group (struct interface *ifp, struct ip_mreq m; struct prefix *p; int ret; + char b1[INET_ADDRSTRLEN]; zi = ifp->info; @@ -117,8 +123,8 @@ if_group (struct interface *ifp, if (ret < 0) zlog_warn ("IRDP: %s can't setsockopt %s: %s", add_leave == IP_ADD_MEMBERSHIP? "join group":"leave group", - inet_2a(group, b1), - safe_strerror (errno)); + inet_2a(group, b1), + safe_strerror (errno)); return ret; } @@ -129,6 +135,7 @@ if_add_group (struct interface *ifp) struct zebra_if *zi= ifp->info; struct irdp_interface *irdp = &zi->irdp; int ret; + char b1[INET_ADDRSTRLEN]; ret = if_group (ifp, irdp_sock, INADDR_ALLRTRS_GROUP, IP_ADD_MEMBERSHIP); if (ret < 0) { @@ -148,6 +155,7 @@ if_drop_group (struct interface *ifp) struct zebra_if *zi= ifp->info; struct irdp_interface *irdp = &zi->irdp; int ret; + char b1[INET_ADDRSTRLEN]; ret = if_group (ifp, irdp_sock, INADDR_ALLRTRS_GROUP, IP_DROP_MEMBERSHIP); if (ret < 0) @@ -173,7 +181,7 @@ if_set_defaults(struct interface *ifp) } -struct Adv *Adv_new (void) +static struct Adv *Adv_new (void) { return XCALLOC (MTYPE_TMP, sizeof (struct Adv)); } @@ -338,6 +346,7 @@ void irdp_config_write (struct vty *vty, struct interface *ifp) struct irdp_interface *irdp=&zi->irdp; struct Adv *adv; struct listnode *node; + char b1[INET_ADDRSTRLEN]; if(irdp->flags & IF_ACTIVE || irdp->flags & IF_SHUTDOWN) { diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 55106699..c297979c 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -60,6 +60,7 @@ #include "zebra/irdp.h" #include <netinet/ip_icmp.h> +#include "checksum.h" #include "if.h" #include "sockunion.h" #include "log.h" @@ -75,25 +76,6 @@ struct thread *t_irdp_raw; /* Timer interval of irdp. */ int irdp_timer_interval = IRDP_DEFAULT_INTERVAL; -int irdp_read_raw(struct thread *r); -int in_cksum (void *ptr, int nbytes); -void send_packet(struct interface *ifp, - struct stream *s, - u_int32_t dst, - struct prefix *p, - u_int32_t ttl); - -char * -inet_2a(u_int32_t a, char *b) -{ - sprintf(b, "%u.%u.%u.%u", - (a ) & 0xFF, - (a>> 8) & 0xFF, - (a>>16) & 0xFF, - (a>>24) & 0xFF); - return b; -} - int irdp_sock_init (void) { diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index 60038372..28dc171e 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -59,6 +59,7 @@ #include "zebra/irdp.h" #include <netinet/ip_icmp.h> #include "if.h" +#include "checksum.h" #include "sockunion.h" #include "log.h" #include "sockopt.h" @@ -67,12 +68,9 @@ /* GLOBAL VARS */ int irdp_sock = -1; -char b1[16], b2[16], b3[16], b4[16]; /* For inet_2a */ extern struct zebra_t zebrad; extern struct thread *t_irdp_raw; -int in_cksum (void *ptr, int nbytes); -void process_solicit (struct interface *ifp); static void parse_irdp_packet(char *p, @@ -231,7 +229,7 @@ int irdp_read_raw(struct thread *r) struct zebra_if *zi; struct irdp_interface *irdp; char buf[IRDP_RX_BUF]; - int ret, ifindex; + int ret, ifindex = 0; int irdp_sock = THREAD_FD (r); t_irdp_raw = thread_add_read (zebrad.master, irdp_read_raw, NULL, irdp_sock); |