
shemminger at vyatta
Apr 6, 2011, 10:01 AM
Post #1 of 11
(1000 views)
Permalink
|
The following changes since commit 74bd8495d0fc3c24e5fba09164093bd6d997771e: Merge remote-tracking branch 'remotes/quagga/master' (2011-03-29 14:25:56 +0100) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/quagga.git for-paul Stephen Hemminger (8): smux: oid optimization ospfd: set multicast sockopt when socket is created bgpd: fix warning about missing prototype for nonblocking ospf6d: fix warnings from missing prototypes bgpd: make flag manipulation inline bgpd: inline lock/unlock bgpd: eliminate strict aliasing warnings vty: remove unused vty_serv_socket_family bgpd/bgp_advertise.h | 15 +++--------- bgpd/bgp_network.c | 1 + bgpd/bgp_packet.c | 18 ++++++++++----- bgpd/bgpd.c | 56 ------------------------------------------------- bgpd/bgpd.h | 57 +++++++++++++++++++++++++++++++++++++++++++++---- lib/smux.c | 12 +++++----- lib/smux.h | 7 ++--- lib/vty.c | 2 + ospf6d/ospf6_main.c | 8 +++++++ ospfd/ospf_network.c | 34 ++++++++++++++--------------- 10 files changed, 104 insertions(+), 106 deletions(-) diff --git a/bgpd/bgp_advertise.h b/bgpd/bgp_advertise.h index 4ebde90..9e20c22 100644 --- a/bgpd/bgp_advertise.h +++ b/bgpd/bgp_advertise.h @@ -21,13 +21,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #ifndef _QUAGGA_BGP_ADVERTISE_H #define _QUAGGA_BGP_ADVERTISE_H -/* BGP advertise FIFO. */ -struct bgp_advertise_fifo -{ - struct bgp_advertise *next; - struct bgp_advertise *prev; -}; - /* BGP advertise attribute. */ struct bgp_advertise_attr { @@ -44,7 +37,7 @@ struct bgp_advertise_attr struct bgp_advertise { /* FIFO for advertisement. */ - struct bgp_advertise_fifo fifo; + struct fifo fifo; /* Link list for same attribute advertise. */ struct bgp_advertise *next; @@ -97,9 +90,9 @@ struct bgp_adj_in /* BGP advertisement list. */ struct bgp_synchronize { - struct bgp_advertise_fifo update; - struct bgp_advertise_fifo withdraw; - struct bgp_advertise_fifo withdraw_low; + struct fifo update; + struct fifo withdraw; + struct fifo withdraw_low; }; /* BGP adjacency linked list. */ diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 502f567..570cc3b 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -30,6 +30,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "command.h" #include "privs.h" #include "linklist.h" +#include "network.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_fsm.h" diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 1d6b9ee..f159198 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -137,6 +137,12 @@ bgp_connect_check (struct peer *peer) } } +static inline struct bgp_advertise * +bgp_advertise_head (struct fifo *fifo) +{ + return (struct bgp_advertise *) FIFO_HEAD(fifo); +} + /* Make BGP update packet. */ static struct stream * bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi) @@ -154,7 +160,7 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi) s = peer->work; stream_reset (s); - adv = FIFO_HEAD (&peer->sync[afi][safi]->update); + adv = bgp_advertise_head (&peer->sync[afi][safi]->update); while (adv) { @@ -290,7 +296,7 @@ bgp_withdraw_packet (struct peer *peer, afi_t afi, safi_t safi) s = peer->work; stream_reset (s); - while ((adv = FIFO_HEAD (&peer->sync[afi][safi]->withdraw)) != NULL) + while ((adv = bgp_advertise_head (&peer->sync[afi][safi]->withdraw)) != NULL) { assert (adv->rn); adj = adv->adj; @@ -514,7 +520,7 @@ bgp_write_packet (struct peer *peer) for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - adv = FIFO_HEAD (&peer->sync[afi][safi]->withdraw); + adv = bgp_advertise_head (&peer->sync[afi][safi]->withdraw); if (adv) { s = bgp_withdraw_packet (peer, afi, safi); @@ -526,7 +532,7 @@ bgp_write_packet (struct peer *peer) for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - adv = FIFO_HEAD (&peer->sync[afi][safi]->update); + adv = bgp_advertise_head (&peer->sync[afi][safi]->update); if (adv) { if (adv->binfo && adv->binfo->uptime < peer->synctime) @@ -577,12 +583,12 @@ bgp_write_proceed (struct peer *peer) for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) - if (FIFO_HEAD (&peer->sync[afi][safi]->withdraw)) + if (bgp_advertise_head (&peer->sync[afi][safi]->withdraw)) return 1; for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) - if ((adv = FIFO_HEAD (&peer->sync[afi][safi]->update)) != NULL) + if ((adv = bgp_advertise_head (&peer->sync[afi][safi]->update)) != NULL) if (adv->binfo->uptime < peer->synctime) return 1; diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index ee0cc5d..cb43af1 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -114,46 +114,6 @@ bgp_option_check (int flag) return CHECK_FLAG (bm->options, flag); } -/* BGP flag manipulation. */ -int -bgp_flag_set (struct bgp *bgp, int flag) -{ - SET_FLAG (bgp->flags, flag); - return 0; -} - -int -bgp_flag_unset (struct bgp *bgp, int flag) -{ - UNSET_FLAG (bgp->flags, flag); - return 0; -} - -int -bgp_flag_check (struct bgp *bgp, int flag) -{ - return CHECK_FLAG (bgp->flags, flag); -} - -/* Internal function to set BGP structure configureation flag. */ -static void -bgp_config_set (struct bgp *bgp, int config) -{ - SET_FLAG (bgp->config, config); -} - -static void -bgp_config_unset (struct bgp *bgp, int config) -{ - UNSET_FLAG (bgp->config, config); -} - -static int -bgp_config_check (struct bgp *bgp, int config) -{ - return CHECK_FLAG (bgp->config, config); -} - /* Set BGP router identifier. */ int bgp_router_id_set (struct bgp *bgp, struct in_addr *id) @@ -2108,23 +2068,7 @@ bgp_delete (struct bgp *bgp) return 0; } -static void bgp_free (struct bgp *); - void -bgp_lock (struct bgp *bgp) -{ - ++bgp->lock; -} - -void -bgp_unlock(struct bgp *bgp) -{ - assert(bgp->lock > 0); - if (--bgp->lock == 0) - bgp_free (bgp); -} - -static void bgp_free (struct bgp *bgp) { afi_t afi; diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 4da19e7..8c817c0 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -845,13 +845,60 @@ extern int bgp_option_check (int); extern int bgp_get (struct bgp **, as_t *, const char *); extern int bgp_delete (struct bgp *); +extern void bgp_free (struct bgp *); -extern int bgp_flag_set (struct bgp *, int); -extern int bgp_flag_unset (struct bgp *, int); -extern int bgp_flag_check (struct bgp *, int); +/* BGP flag manipulation. */ +static inline void +bgp_flag_set (struct bgp *bgp, int flag) +{ + SET_FLAG (bgp->flags, flag); +} + +static inline void +bgp_flag_unset (struct bgp *bgp, int flag) +{ + UNSET_FLAG (bgp->flags, flag); +} + +static inline int +bgp_flag_check (const struct bgp *bgp, int flag) +{ + return CHECK_FLAG (bgp->flags, flag); +} + +/* Internal function to set BGP structure configureation flag. */ +static inline void +bgp_config_set (struct bgp *bgp, int config) +{ + SET_FLAG (bgp->config, config); +} -extern void bgp_lock (struct bgp *); -extern void bgp_unlock (struct bgp *); +static inline void +bgp_config_unset (struct bgp *bgp, int config) +{ + UNSET_FLAG (bgp->config, config); +} + +static inline int +bgp_config_check (const struct bgp *bgp, int config) +{ + return CHECK_FLAG (bgp->config, config); +} + + +static inline void +bgp_lock (struct bgp *bgp) +{ + ++bgp->lock; +} + +static inline void +bgp_unlock (struct bgp *bgp) +{ + assert(bgp->lock > 0); + if (--bgp->lock == 0) + bgp_free (bgp); +} extern int bgp_router_id_set (struct bgp *, struct in_addr *); diff --git a/lib/smux.c b/lib/smux.c index 1941cf8..1adcf31 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -82,14 +82,14 @@ static struct cmd_node smux_node = /* thread master */ static struct thread_master *master; -void * +static void * oid_copy (void *dest, const void *src, size_t size) { return memcpy (dest, src, size * sizeof (oid)); } void -oid2in_addr (oid oid[], int len, struct in_addr *addr) +oid2in_addr (const oid oid[], int len, struct in_addr *addr) { int i; u_char *pnt; @@ -104,10 +104,10 @@ oid2in_addr (oid oid[], int len, struct in_addr *addr) } void -oid_copy_addr (oid oid[], struct in_addr *addr, int len) +oid_copy_addr (oid oid[], const struct in_addr *addr, int len) { int i; - u_char *pnt; + const u_char *pnt; if (len == 0) return; @@ -118,8 +118,8 @@ oid_copy_addr (oid oid[], struct in_addr *addr, int len) oid[i] = *pnt++; } -int -oid_compare (oid *o1, int o1_len, oid *o2, int o2_len) +static int +oid_compare (const oid *o1, int o1_len, const oid *o2, int o2_len) { int i; diff --git a/lib/smux.h b/lib/smux.h index f5754ed..cbfedd8 100644 --- a/lib/smux.h +++ b/lib/smux.h @@ -153,9 +153,8 @@ extern int smux_header_generic (struct variable *, oid [], size_t *, extern int smux_trap (const oid *, size_t, const oid *, size_t, const struct trap_object *, size_t, unsigned int, u_char); -extern int oid_compare (oid *, int, oid *, int); -extern void oid2in_addr (oid [], int, struct in_addr *); -extern void *oid_copy (void *, const void *, size_t); -extern void oid_copy_addr (oid [], struct in_addr *, int); + +extern void oid2in_addr (const oid [], int, struct in_addr *); +extern void oid_copy_addr (oid [], const struct in_addr *, int); #endif /* _ZEBRA_SNMP_H */ diff --git a/lib/vty.c b/lib/vty.c index bd1dbac..f7e3741 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -1841,6 +1841,7 @@ vty_serv_sock_addrinfo (const char *hostname, unsigned short port) } #endif /* HAVE_IPV6 && ! NRL */ +#if defined(NRL) || !defined(HAVE_IPV6) /* Make vty server socket. */ static void vty_serv_sock_family (const char* addr, unsigned short port, int family) @@ -1905,6 +1906,7 @@ vty_serv_sock_family (const char* addr, unsigned short port, int family) /* Add vty server event. */ vty_event (VTY_SERV, accept_sock, NULL); } +#endif #ifdef VTYSH /* For sockaddr_un. */ diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index 800fae4..69738d4 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -34,8 +34,16 @@ #include "plist.h" #include "privs.h" #include "sigevent.h" +#include "zclient.h" #include "ospf6d.h" +#include "ospf6_proto.h" +#include "ospf6_lsa.h" +#include "ospf6_route.h" +#include "ospf6_message.h" +#include "ospf6_top.h" +#include "ospf6_area.h" +#include "ospf6_asbr.h" /* Default configuration file name for ospf6d. */ #define OSPF6_DEFAULT_CONFIG "ospf6d.conf" diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index 1e2d44e..7e107e1 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -132,25 +132,8 @@ ospf_if_drop_alldrouters (struct ospf *top, struct prefix *p, unsigned int int ospf_if_ipmulticast (struct ospf *top, struct prefix *p, unsigned int ifindex) { - u_char val; - int ret, len; - - val = 0; - len = sizeof (val); - - /* Prevent receiving self-origined multicast packets. */ - ret = setsockopt (top->fd, IPPROTO_IP, IP_MULTICAST_LOOP, (void *)&val, len); - if (ret < 0) - zlog_warn ("can't setsockopt IP_MULTICAST_LOOP(0) for fd %d: %s", - top->fd, safe_strerror(errno)); + int ret; - /* Explicitly set multicast ttl to 1 -- endo. */ - val = 1; - ret = setsockopt (top->fd, IPPROTO_IP, IP_MULTICAST_TTL, (void *)&val, len); - if (ret < 0) - zlog_warn ("can't setsockopt IP_MULTICAST_TTL(1) for fd %d: %s", - top->fd, safe_strerror (errno)); - ret = setsockopt_multicast_ipv4 (top->fd, IP_MULTICAST_IF, p->u.prefix4, 0, ifindex); if (ret < 0) @@ -166,6 +149,7 @@ ospf_sock_init (void) { int ospf_sock; int ret, hincl = 1; + int val; if ( ospfd_privs.change (ZPRIVS_RAISE) ) zlog_err ("ospf_sock_init: could not raise privs, %s", @@ -225,6 +209,20 @@ ospf_sock_init (void) safe_strerror (errno) ); } + /* Prevent receiving self-origined multicast packets. */ + val = 0; + ret = setsockopt (ospf_sock, IPPROTO_IP, IP_MULTICAST_LOOP, (void *)&val, sizeof(val)); + if (ret < 0) + zlog_warn ("can't setsockopt IP_MULTICAST_LOOP(0) for fd %d: %s", + ospf_sock, safe_strerror(errno)); + + /* Explicitly set multicast ttl to 1 -- endo. */ + val = 1; + ret = setsockopt (ospf_sock, IPPROTO_IP, IP_MULTICAST_TTL, (void *)&val, sizeof(val)); + if (ret < 0) + zlog_warn ("can't setsockopt IP_MULTICAST_TTL(1) for fd %d: %s", + ospf_sock, safe_strerror (errno)); + return ospf_sock; } _______________________________________________ Quagga-dev mailing list Quagga-dev [at] lists http://lists.quagga.net/mailman/listinfo/quagga-dev
|