diff options
36 files changed, 193 insertions, 107 deletions
diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c index f75fc55b..a6ca1a46 100644 --- a/bgpd/bgp_clist.c +++ b/bgpd/bgp_clist.c @@ -836,6 +836,7 @@ community_list_init (void) return ch; } +#if 0 /* Terminate community-list. */ static void community_list_terminate (struct community_list_handler *ch) @@ -857,3 +858,4 @@ community_list_terminate (struct community_list_handler *ch) XFREE (MTYPE_COMMUNITY_LIST_HANDLER, ch); } +#endif diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index 5a7c9aaa..a0a8557d 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -520,8 +520,6 @@ bgp_damp_disable (struct bgp *bgp, afi_t afi, safi_t safi) int bgp_config_write_damp (struct vty *vty) { - if (&bgp_damp_cfg) - { if (bgp_damp_cfg.half_life == DEFAULT_HALF_LIFE*60 && bgp_damp_cfg.reuse_limit == DEFAULT_REUSE && bgp_damp_cfg.suppress_value == DEFAULT_SUPPRESS @@ -542,8 +540,6 @@ bgp_config_write_damp (struct vty *vty) bgp_damp_cfg.max_suppress_time/60, VTY_NEWLINE); return 1; - } - return 0; } #define BGP_UPTIME_LEN 25 diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index e8f77f10..f92a88ad 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -923,6 +923,7 @@ bgp_notify_send (struct peer *peer, u_char code, u_char sub_code) bgp_notify_send_with_data (peer, code, sub_code, NULL, 0); } +#if 0 static const char * afi2str (afi_t afi) { @@ -946,6 +947,7 @@ safi2str (safi_t safi) else return "Unknown SAFI"; } +#endif /* Send route refresh message to the peer. */ void @@ -1235,7 +1237,7 @@ bgp_open_receive (struct peer *peer, bgp_size_t size) zlog_debug ("%s [AS4] OPEN remote_as is AS_TRANS, but no AS4." " Odd, but proceeding.", peer->host); else if (as4 < BGP_AS_MAX && BGP_DEBUG (as4, AS4)) - zlog_debug ("%s [AS4] OPEN remote_as is AS_TRANS, but AS4 fits " + zlog_debug ("%s [AS4] OPEN remote_as is AS_TRANS, but AS4 %u fits " "in 2-bytes, very odd peer.", peer->host, as4); if (as4) remote_as = as4; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4fbc4bab..f8eb7f7f 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -10959,6 +10959,7 @@ bgp_distance_unset (struct vty *vty, const char *distance_str, return CMD_SUCCESS; } +#if 0 static void bgp_distance_reset () { @@ -10975,6 +10976,7 @@ bgp_distance_reset () bgp_unlock_node (rn); } } +#endif /* Apply BGP information to distance method. */ u_char diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c index 3d26890e..a81f9b52 100644 --- a/bgpd/bgp_snmp.c +++ b/bgpd/bgp_snmp.c @@ -381,7 +381,7 @@ write_bgpPeerTable (int action, u_char *var_val, struct in_addr addr; struct peer *peer; long intval; - int bigsize = SNMP_MAX_LEN; + size_t bigsize = SNMP_MAX_LEN; if (var_val_type != ASN_INTEGER) { diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 0b6ab45a..ec1143af 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -639,6 +639,7 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote, return ret; } +#if 0 #ifdef HAVE_IPV6 static unsigned int bgp_ifindex_by_nexthop (struct in6_addr *addr) @@ -671,6 +672,7 @@ bgp_ifindex_by_nexthop (struct in6_addr *addr) return 0; } #endif /* HAVE_IPV6 */ +#endif void bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp) diff --git a/configure.ac b/configure.ac index e679632f..1d2b2a3a 100755 --- a/configure.ac +++ b/configure.ac @@ -208,6 +208,8 @@ AC_ARG_ENABLE(bgp-announce, [ --disable-bgp-announce, turn off BGP route announcement]) AC_ARG_ENABLE(netlink, [ --enable-netlink force to use Linux netlink interface]) +AC_ARG_ENABLE(linkdetect, +[ --enable-linkdetect use Linux link-detect configuration]) AC_ARG_ENABLE(broken-aliases, [ --enable-broken-aliases enable aliases as distinct interfaces for Linux 2.2.X]) AC_ARG_ENABLE(snmp, @@ -917,6 +919,16 @@ AC_CHECK_HEADER([net/if.h], QUAGGA_INCLUDES)], [], QUAGGA_INCLUDES ) + +dnl --------------------------------------------------------------- +dnl kernel link-detect enable via /proc/sys/net/ipv4/conf/ethX/link_detect +dnl --------------------------------------------------------------- +if test "${enable_linkdetect}" = "yes"; then + AC_DEFINE(HAVE_LINKDETECT,1,Enable Linux kernel linkdetect) + LINK_DETECT=if_linkdetect.o +fi +AC_SUBST(LINK_DETECT) + dnl ----------------------- dnl check proc file system. dnl ----------------------- @@ -931,12 +943,6 @@ if test -r /proc/net/if_inet6; then fi AC_SUBST(IF_PROC) -if test -r /proc/sys/net/ipv4/conf; then - AC_DEFINE(HAVE_PROC_NET_IPV4_CONF,,/proc/sys/net/ipv4/conf) - LINK_DETECT=if_linkdetect.o -fi -AC_SUBST(LINK_DETECT) - dnl ----------------------------- dnl check ipforward detect method dnl ----------------------------- diff --git a/debian/rules b/debian/rules index e89dc246..f5f7e932 100755 --- a/debian/rules +++ b/debian/rules @@ -61,6 +61,7 @@ configure += --enable-logfile-mask=0640 configure += --enable-rtadv configure += --enable-tcp-md5 configure += --enable-gcc-rdynamic +configure += --enable-linkdetect configure += $(xable_snmp) configure += --with-libpam configure += CFLAGS="$(CFLAGS)" @@ -324,13 +324,13 @@ smux_getresp_send (oid objid[], size_t objid_len, long reqid, long errstat, asn_build_sequence(h1,&length,(u_char)SMUX_GETRSP,ptr-h1e); if (debug_smux) - zlog_debug ("SMUX getresp send: %ld", (ptr - buf)); + zlog_debug ("SMUX getresp send: %td", (ptr - buf)); ret = send (smux_sock, buf, (ptr - buf), 0); } -char * -smux_var (char *ptr, size_t len, oid objid[], size_t *objid_len, +static u_char * +smux_var (u_char *ptr, size_t len, oid objid[], size_t *objid_len, size_t *var_val_len, u_char *var_val_type, void **var_value) @@ -341,14 +341,14 @@ smux_var (char *ptr, size_t len, oid objid[], size_t *objid_len, u_char *val; if (debug_smux) - zlog_debug ("SMUX var parse: len %ld", len); + zlog_debug ("SMUX var parse: len %zd", len); /* Parse header. */ ptr = asn_parse_header (ptr, &len, &type); if (debug_smux) { - zlog_debug ("SMUX var parse: type %d len %ld", type, len); + zlog_debug ("SMUX var parse: type %u len %zd", type, len); zlog_debug ("SMUX var parse: type must be %d", (ASN_SEQUENCE | ASN_CONSTRUCTOR)); } @@ -650,8 +650,8 @@ smux_getnext (oid *reqid, size_t *reqid_len, int exact, } /* GET message header. */ -char * -smux_parse_get_header (char *ptr, size_t *len, long *reqid) +static u_char * +smux_parse_get_header (u_char *ptr, size_t *len, long *reqid) { u_char type; long errstat; @@ -667,19 +667,19 @@ smux_parse_get_header (char *ptr, size_t *len, long *reqid) ptr = asn_parse_int (ptr, len, &type, &errstat, sizeof (errstat)); if (debug_smux) - zlog_debug ("SMUX GET errstat %ld len: %ld", errstat, *len); + zlog_debug ("SMUX GET errstat %ld len: %zd", errstat, *len); /* Error index. */ ptr = asn_parse_int (ptr, len, &type, &errindex, sizeof (errindex)); if (debug_smux) - zlog_debug ("SMUX GET errindex %ld len: %ld", errindex, *len); + zlog_debug ("SMUX GET errindex %ld len: %zd", errindex, *len); return ptr; } -void -smux_parse_set (char *ptr, size_t len, int action) +static void +smux_parse_set (u_char *ptr, size_t len, int action) { long reqid; oid oid[MAX_OID_LEN]; @@ -690,7 +690,7 @@ smux_parse_set (char *ptr, size_t len, int action) int ret; if (debug_smux) - zlog_debug ("SMUX SET(%s) message parse: len %ld", + zlog_debug ("SMUX SET(%s) message parse: len %zd", (RESERVE1 == action) ? "RESERVE1" : ((FREE == action) ? "FREE" : "COMMIT"), len); @@ -709,8 +709,8 @@ smux_parse_set (char *ptr, size_t len, int action) smux_getresp_send (oid, oid_len, reqid, ret, 3, ASN_NULL, NULL, 0); } -void -smux_parse_get (char *ptr, size_t len, int exact) +static void +smux_parse_get (u_char *ptr, size_t len, int exact) { long reqid; oid oid[MAX_OID_LEN]; @@ -721,7 +721,7 @@ smux_parse_get (char *ptr, size_t len, int exact) int ret; if (debug_smux) - zlog_debug ("SMUX GET message parse: len %ld", len); + zlog_debug ("SMUX GET message parse: len %zd", len); /* Parse GET message header. */ ptr = smux_parse_get_header (ptr, &len, &reqid); @@ -743,8 +743,8 @@ smux_parse_get (char *ptr, size_t len, int exact) } /* Parse SMUX_CLOSE message. */ -void -smux_parse_close (char *ptr, int len) +static void +smux_parse_close (u_char *ptr, int len) { long reason = 0; @@ -757,10 +757,10 @@ smux_parse_close (char *ptr, int len) } /* SMUX_RRSP message. */ -void -smux_parse_rrsp (char *ptr, size_t len) +static void +smux_parse_rrsp (u_char *ptr, size_t len) { - char val; + u_char val; long errstat; ptr = asn_parse_int (ptr, &len, &val, &errstat, sizeof (errstat)); @@ -770,8 +770,8 @@ smux_parse_rrsp (char *ptr, size_t len) } /* Parse SMUX message. */ -int -smux_parse (char *ptr, size_t len) +static int +smux_parse (u_char *ptr, size_t len) { /* This buffer we'll use for SOUT message. We could allocate it with malloc and save only static pointer/lenght, but IMHO static @@ -791,7 +791,7 @@ process_rest: /* see note below: YYY */ ptr = asn_parse_header (ptr, &len, &type); if (debug_smux) - zlog_debug ("SMUX message received type: %d rest len: %ld", type, len); + zlog_debug ("SMUX message received type: %d rest len: %zd", type, len); switch (type) { @@ -946,7 +946,7 @@ smux_open (int sock) u_char *ptr; size_t len; u_long version; - u_char progname[] = QUAGGA_PROGNAME "-" QUAGGA_VERSION; + char progname[] = QUAGGA_PROGNAME "-" QUAGGA_VERSION; if (debug_smux) { @@ -965,7 +965,7 @@ smux_open (int sock) version = 0; ptr = asn_build_int (ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), - &version, sizeof (version)); + (long *)&version, sizeof (version)); /* SMUX connection oid. */ ptr = asn_build_objid (ptr, &len, @@ -977,13 +977,13 @@ smux_open (int sock) ptr = asn_build_string (ptr, &len, (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR), - progname, strlen (progname)); + (u_char *) progname, strlen (progname)); /* SMUX connection password. */ ptr = asn_build_string (ptr, &len, (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR), - smux_passwd, strlen (smux_passwd)); + (u_char *) smux_passwd, strlen (smux_passwd)); /* Fill in real SMUX header. We exclude ASN header size (2). */ len = BUFSIZ; @@ -1034,13 +1034,13 @@ smux_trap (oid *name, size_t namelen, val = SNMP_TRAP_ENTERPRISESPECIFIC; ptr = asn_build_int (ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), - &val, sizeof (val)); + (long *)&val, sizeof (val)); /* Specific trap integer. */ val = sptrap; ptr = asn_build_int (ptr, &len, (u_char)(ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER), - &val, sizeof (val)); + (long *)&val, sizeof (val)); /* Timeticks timestamp. */ val = 0; @@ -1827,6 +1827,7 @@ vty_serv_sock_addrinfo (const char *hostname, unsigned short port) } #endif /* HAVE_IPV6 && ! NRL */ +#if 0 /* Make vty server socket. */ static void vty_serv_sock_family (const char* addr, unsigned short port, int family) @@ -1891,6 +1892,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_zebra.c b/ospf6d/ospf6_zebra.c index c974005f..4440a67f 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -134,8 +134,9 @@ ospf6_zebra_if_state_update (int command, struct zclient *zclient, ifp = zebra_interface_state_read (zclient->ibuf); if (IS_OSPF6_DEBUG_ZEBRA (RECV)) zlog_debug ("Zebra Interface state change: " - "%s index %d flags %ld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6); + "%s index %d flags %#llx metric %d mtu %d", + ifp->name, ifp->ifindex, (unsigned long long)ifp->flags, + ifp->metric, ifp->mtu6); ospf6_interface_state_update (ifp); return 0; diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index 88636f1a..d60ad120 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -614,6 +614,7 @@ set_metric (struct ospf_lsa *lsa, u_int32_t metric) memcpy(header->metric, mp, 3); } +#if 0 static int ospf_abr_check_nssa_range (struct prefix_ipv4 *p, u_int32_t cost, struct ospf_area *area) @@ -622,6 +623,7 @@ ospf_abr_check_nssa_range (struct prefix_ipv4 *p, u_int32_t cost, for lsa installation and flooding */ return 0; } +#endif /* ospf_abr_translate_nssa */ static int @@ -1580,6 +1582,7 @@ ospf_abr_send_nssa_aggregates (struct ospf *ospf) /* temporarily turned off */ zlog_debug ("ospf_abr_send_nssa_aggregates(): Stop"); } +#if 0 static void ospf_abr_announce_nssa_defaults (struct ospf *ospf) /* By ABR-Translator */ { @@ -1615,6 +1618,7 @@ ospf_abr_announce_nssa_defaults (struct ospf *ospf) /* By ABR-Translator */ } } } +#endif static void ospf_abr_announce_stub_defaults (struct ospf *ospf) diff --git a/ospfd/ospf_api.c b/ospfd/ospf_api.c index 9c9997ba..179c97a7 100644 --- a/ospfd/ospf_api.c +++ b/ospfd/ospf_api.c @@ -220,7 +220,7 @@ msg_print (struct msg *msg) #else /* ORIGINAL_CODING */ /* API message common header part. */ zlog_debug - ("API-msg [%s]: type(%d),len(%d),seq(%lu),data(%p),size(%lu)", + ("API-msg [%s]: type(%d),len(%d),seq(%lu),data(%p),size(%z)", ospf_api_typename (msg->hdr.msgtype), msg->hdr.msgtype, ntohs (msg->hdr.msglen), (unsigned long) ntohl (msg->hdr.msgseq), STREAM_DATA (msg->s), STREAM_SIZE (msg->s)); diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c index a4812345..47f8851f 100644 --- a/ospfd/ospf_ase.c +++ b/ospfd/ospf_ase.c @@ -156,6 +156,7 @@ ospf_ase_forward_address_check (struct ospf *ospf, struct in_addr fwd_addr) return 1; } +#if 0 /* Calculate ASBR route. */ static struct ospf_route * ospf_ase_calculate_asbr_route (struct ospf *ospf, @@ -236,6 +237,7 @@ ospf_ase_calculate_asbr_route (struct ospf *ospf, return asbr_route; } +#endif static struct ospf_route * ospf_ase_calculate_new_route (struct ospf_lsa *lsa, diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 243928f4..0d205ee3 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -526,7 +526,7 @@ link_info_set (struct stream *s, struct in_addr id, if (ret == OSPF_MAX_LSA_SIZE) { - zlog_warn ("%s: Out of space in LSA stream, left %ld, size %ld", + zlog_warn ("%s: Out of space in LSA stream, left %ld, size %z", __func__, STREAM_REMAIN (s), STREAM_SIZE (s)); return 0; } @@ -1895,6 +1895,7 @@ ospf_lsa_translated_nssa_new (struct ospf *ospf, return new; } +#if 0 /* compare type-5 to type-7 * -1: err, 0: same, 1: different */ @@ -1931,6 +1932,7 @@ ospf_lsa_translated_nssa_compare (struct ospf_lsa *t7, struct ospf_lsa *t5) return LSA_REFRESH_IF_CHANGED; } +#endif /* Originate Translated Type-5 for supplied Type-7 NSSA LSA */ struct ospf_lsa * diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index d5bf7493..1a91001f 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -165,11 +165,7 @@ int ospf_sock_init (void) { int ospf_sock; - /* - * XXX warning: unused variable `tos' - * tos should be ifdefed similarly to usage - */ - int ret, tos, hincl = 1; + int ret, hincl = 1; if ( ospfd_privs.change (ZPRIVS_RAISE) ) zlog_err ("ospf_sock_init: could not raise privs, %s", @@ -201,8 +197,9 @@ ospf_sock_init (void) #elif defined (IPTOS_PREC_INTERNETCONTROL) #warning "IP_HDRINCL not available on this system" #warning "using IPTOS_PREC_INTERNETCONTROL" + { /* Set precedence field. */ - tos = IPTOS_PREC_INTERNETCONTROL; + int tos = IPTOS_PREC_INTERNETCONTROL; ret = setsockopt (ospf_sock, IPPROTO_IP, IP_TOS, (char *) &tos, sizeof (int)); if (ret < 0) @@ -216,6 +213,7 @@ ospf_sock_init (void) close (ospf_sock); /* Prevent sd leak. */ return ret; } + } #else /* !IPTOS_PREC_INTERNETCONTROL */ #warning "IP_HDRINCL not available, nor is IPTOS_PREC_INTERNETCONTROL" zlog_warn ("IP_HDRINCL option not available"); diff --git a/ospfd/ospf_route.c b/ospfd/ospf_route.c index 3a1fa999..fc372329 100644 --- a/ospfd/ospf_route.c +++ b/ospfd/ospf_route.c @@ -270,6 +270,7 @@ ospf_route_install (struct ospf *ospf, struct route_table *rt) } } +#if 0 static void ospf_intra_route_add (struct route_table *rt, struct vertex *v, struct ospf_area *area) @@ -324,6 +325,7 @@ ospf_intra_route_add (struct route_table *rt, struct vertex *v, rn->info = or; } +#endif /* RFC2328 16.1. (4). For "router". */ void diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c index 6e972605..e76b39b0 100644 --- a/ospfd/ospf_snmp.c +++ b/ospfd/ospf_snmp.c @@ -1561,6 +1561,7 @@ ospf_snmp_if_lookup_next (struct in_addr *ifaddr, unsigned int *ifindex, { /* Usual interface */ if (ifaddr->s_addr) + { /* The interface must have valid AF_INET connected address */ /* it must have lager IPv4 address value than the lookup entry */ if ((ospf_snmp_is_if_have_addr(osif->ifp)) && @@ -1574,6 +1575,7 @@ ospf_snmp_if_lookup_next (struct in_addr *ifaddr, unsigned int *ifindex, if (oi) return oi; } + } /* Unnumbered interface */ else /* The interface must NOT have valid AF_INET connected address */ diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index 23d45dd6..34d25ed5 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -1024,6 +1024,7 @@ ospf_rtrs_free (struct route_table *rtrs) route_table_finish (rtrs); } +#if 0 static void ospf_rtrs_print (struct route_table *rtrs) { @@ -1082,6 +1083,7 @@ ospf_rtrs_print (struct route_table *rtrs) zlog_debug ("ospf_rtrs_print() end"); } +#endif /* Calculating the shortest-path tree for an area. */ static void diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 5f9fa2cb..c96b88ab 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -3766,6 +3766,7 @@ show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) return 0; } +#if 0 /* N.B. This function currently seems to be unused. */ static int show_as_external_lsa_stdvty (struct ospf_lsa *lsa) @@ -3790,6 +3791,7 @@ show_as_external_lsa_stdvty (struct ospf_lsa *lsa) return 0; } +#endif /* Show AS-NSSA-LSA detail information. */ static int diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index f302d28d..5405a782 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -92,8 +92,9 @@ ospf_interface_add (int command, struct zclient *zclient, zebra_size_t length) ifp = zebra_interface_add_read (zclient->ibuf); if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE)) - zlog_debug ("Zebra: interface add %s index %d flags %ld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); + zlog_debug ("Zebra: interface add %s index %d flags %#llx metric %d mtu %d", + ifp->name, ifp->ifindex, (unsigned long long)ifp->flags, + ifp->metric, ifp->mtu); assert (ifp->info); @@ -136,7 +137,8 @@ ospf_interface_delete (int command, struct zclient *zclient, if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE)) zlog_debug ("Zebra: interface delete %s index %d flags %ld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); + ifp->name, ifp->ifindex, (unsigned long long)ifp->flags, + ifp->metric, ifp->mtu); #ifdef HAVE_SNMP ospf_snmp_if_delete (ifp); diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index a4c4fac3..448f218e 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -1246,6 +1246,7 @@ ospf_area_nssa_translator_role_set (struct ospf *ospf, struct in_addr area_id, return 1; } +#if 0 /* XXX: unused? Leave for symmetry? */ static int ospf_area_nssa_translator_role_unset (struct ospf *ospf, @@ -1263,6 +1264,7 @@ ospf_area_nssa_translator_role_unset (struct ospf *ospf, return 1; } +#endif int ospf_area_export_list_set (struct ospf *ospf, diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index b6d9240f..915cd911 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -253,6 +253,7 @@ rip_request_neighbor (struct in_addr addr) rip_request_send (&to, NULL, rip->version_send, NULL); } +#if 0 /* Request routes at all interfaces. */ static void rip_request_neighbor_all (void) @@ -270,6 +271,7 @@ rip_request_neighbor_all (void) if (rp->info) rip_request_neighbor (rp->p.u.prefix4); } +#endif /* Multicast packet receive socket. */ static int @@ -403,8 +405,9 @@ rip_interface_down (int command, struct zclient *zclient, zebra_size_t length) rip_if_down(ifp); if (IS_RIP_DEBUG_ZEBRA) - zlog_debug ("interface %s index %d flags %ld metric %d mtu %d is down", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu); + zlog_debug ("interface %s index %d flags %#llx metric %d mtu %d is down", + ifp->name, ifp->ifindex, (unsigned long long) ifp->flags, + ifp->metric, ifp->mtu); return 0; } @@ -423,8 +426,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 %ld 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 +451,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 %ld 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 +491,9 @@ rip_interface_delete (int command, struct zclient *zclient, rip_if_down(ifp); } - zlog_info("interface delete %s index %d flags %ld 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); */ diff --git a/ripd/ripd.c b/ripd/ripd.c index c5e42705..af2e5d0e 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -926,7 +926,7 @@ rip_auth_md5 (struct rip_packet *packet, struct sockaddr_in *from, else if (ri->auth_str) strncpy (auth_str, ri->auth_str, RIP_AUTH_MD5_SIZE); - if (! auth_str) + if (auth_str[0] == 0) return 0; /* MD5 digest authentication. */ @@ -2977,6 +2977,7 @@ DEFUN (no_rip_route, return CMD_SUCCESS; } +#if 0 static void rip_update_default_metric (void) { @@ -2988,6 +2989,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/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index 140e3bef..c25677e7 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -243,8 +243,9 @@ ripng_interface_up (int command, struct zclient *zclient, zebra_size_t length) return 0; if (IS_RIPNG_DEBUG_ZEBRA) - zlog_debug ("interface up %s index %d flags %ld metric %d mtu %d", - ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6); + zlog_debug ("interface up %s index %d flags %#llx metric %d mtu %d", + ifp->name, ifp->ifindex, (unsigned long long) ifp->flags, + ifp->metric, ifp->mtu6); /* Check if this interface is RIPng enabled or not. */ ripng_enable_apply (ifp); @@ -276,8 +277,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 %ld 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; } @@ -291,7 +293,7 @@ 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 %ld metric %d mtu %d", + zlog_debug ("RIPng interface add %s index %d flags %#llx metric %d mtu %d", ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6); /* Check is this interface is RIP enabled or not.*/ @@ -324,7 +326,7 @@ ripng_interface_delete (int command, struct zclient *zclient, ripng_if_down(ifp); } - zlog_info("interface delete %s index %d flags %ld metric %d mtu %d", + zlog_info("interface delete %s index %d flags %#llx metric %d mtu %d", ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6); /* To support pseudo interface do not free interface structure. */ diff --git a/vtysh/Makefile.am b/vtysh/Makefile.am index dbd1d3d2..a4be3413 100644 --- a/vtysh/Makefile.am +++ b/vtysh/Makefile.am @@ -18,7 +18,9 @@ dist_examples_DATA = vtysh.conf.sample EXTRA_DIST = extract.pl -vtysh_cmd_FILES = $(top_srcdir)/bgpd/*.c $(top_srcdir)/isisd/*.c \ +vtysh_cmd_FILES = $(top_srcdir)/bgpd/*.c \ + $(top_srcdir)/isisd/isisd.c $(top_srcdir)/isisd/isis_spf.c \ + $(top_srcdir)/isisd/isis_circuit.c \ $(top_srcdir)/ospfd/*.c $(top_srcdir)/ospf6d/*.c \ $(top_srcdir)/ripd/*.c $(top_srcdir)/ripngd/*.c \ $(top_srcdir)/lib/keychain.c $(top_srcdir)/lib/routemap.c \ diff --git a/zebra/if_linkdetect.c b/zebra/if_linkdetect.c index 9ae7c6a6..4f95c16e 100644 --- a/zebra/if_linkdetect.c +++ b/zebra/if_linkdetect.c @@ -22,9 +22,6 @@ #include <zebra.h> #include "log.h" #include "privs.h" - -#include "log.h" -#include "privs.h" #include "prefix.h" #include "zebra/interface.h" @@ -32,14 +29,14 @@ extern struct zebra_privs_t zserv_privs; static int -linkdetect (const char *name, int onoff) +linkdetect (const char *name, const char *ver, int onoff) { FILE *fp; int save_errno; char proc_name[128]; snprintf(proc_name, sizeof(proc_name)-1, - "/proc/sys/net/ipv4/conf/%s/link_detect", name); + "/proc/sys/net/%s/conf/%s/link_detect", ver, name); if ( zserv_privs.change(ZPRIVS_RAISE) ) zlog_err ("Can't raise privileges, %s", safe_strerror (errno) ); @@ -71,11 +68,25 @@ linkdetect (const char *name, int onoff) int if_linkdetect_on (const char *name) { - return linkdetect (name, 1); + return linkdetect (name, "ipv4", 1); } int if_linkdetect_off (const char *name) { - return linkdetect (name, 1); + return linkdetect (name, "ipv4", 0); +} + +#ifdef HAVE_IPV6 +int +if_linkdetect_ipv6_on (const char *name) +{ + return linkdetect (name, "ipv6", 1); +} + +int +if_linkdetect_ipv6_off (const char *name) +{ + return linkdetect (name, "ipv6", 0); } +#endif diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index c9c14760..701c81b6 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -22,12 +22,11 @@ #include <zebra.h> -/* Extern from rt_netlink.c */ -void interface_lookup_netlink (); +extern int interface_lookup_netlink (void); /* Interface information read by netlink. */ void -interface_list () +interface_list (void) { interface_lookup_netlink (); } diff --git a/zebra/interface.c b/zebra/interface.c index f6d2ff9b..916c58a6 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -833,6 +833,7 @@ if_dump_vty (struct vty *vty, struct interface *ifp) #endif /* HAVE_NET_RT_IFLIST */ } +#if 0 /* Check supported address family. */ static int if_supported_family (int family) @@ -845,6 +846,7 @@ if_supported_family (int family) #endif /* HAVE_IPV6 */ return 0; } +#endif /* Wrapper hook point for zebra daemon so that ifindex can be set * DEFUN macro not used as extract.pl HAS to ignore this @@ -1032,6 +1034,9 @@ DEFUN (linkdetect, /* Enable FIB to remove kernel routes as well */ if_linkdetect_on(ifp->name); +#ifdef HAVE_IPV6 + if_linkdetect_ipv6_on(ifp->name); +#endif /* When linkdetection is enabled, if might come down */ if (!if_is_operative(ifp) && if_was_operative) if_down(ifp); @@ -1058,6 +1063,9 @@ DEFUN (no_linkdetect, /* Disable FIB update on link-detect */ if_linkdetect_off(ifp->name); +#ifdef HAVE_IPV6 + if_linkdetect_ipv6_off(ifp->name); +#endif /* Interface may come up after disabling link detection */ if (if_is_operative(ifp) && !if_was_operative) if_up(ifp); diff --git a/zebra/interface.h b/zebra/interface.h index 6f356686..114270e7 100644 --- a/zebra/interface.h +++ b/zebra/interface.h @@ -234,13 +234,20 @@ extern int interface_list_proc (void); extern int ifaddr_proc_ipv6 (void); #endif /* HAVE_PROC_NET_IF_INET6 */ -#ifdef HAVE_PROC_NET_IPV4_CONF +#ifdef HAVE_LINKDETECT extern int if_linkdetect_on (const char *); extern int if_linkdetect_off (const char *); +# ifdef HAVE_IPV6 +extern int if_linkdetect_ipv6_on (const char *); +extern int if_linkdetect_ipv6_off (const char *); +# endif #else -#error config #define if_linkdetect_on(name) #define if_linkdetect_off(name) +# ifdef HAVE_IPV6 +#define if_linkdetect_ipv6_on(name) +#define if_linkdetect_ipv6_off(name) +# endif #endif diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index 3c5f1559..ae121ea1 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -231,7 +231,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); diff --git a/zebra/linkdetect_null.c b/zebra/linkdetect_null.c index c33363e1..1f160c8e 100644 --- a/zebra/linkdetect_null.c +++ b/zebra/linkdetect_null.c @@ -14,3 +14,15 @@ if_linkdetect_off (const char *name) { return 0; } + +int +if_linkdetect_ipv6_on (const char *name) +{ + return 0; +} + +int +if_linkdetect_ipv6_off (const char *name) +{ + return 0; +} diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 71d26a76..c6ec08c6 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -53,7 +53,7 @@ struct nlsock } netlink = { -1, 0, {0}, "netlink-listen"}, /* kernel messages */ netlink_cmd = { -1, 0, {0}, "netlink-cmd"}; /* command channel */ -struct message nlmsg_str[] = { +static struct message nlmsg_str[] = { {RTM_NEWROUTE, "RTM_NEWROUTE"}, {RTM_DELROUTE, "RTM_DELROUTE"}, {RTM_GETROUTE, "RTM_GETROUTE"}, @@ -66,7 +66,7 @@ struct message nlmsg_str[] = { {0, NULL} }; -const char *nexthop_types_desc[] = +static const char *nexthop_types_desc[] = { "none", "Directly connected", @@ -440,7 +440,7 @@ netlink_parse_rtattr (struct rtattr **tb, int max, struct rtattr *rta, /* Called from interface_lookup_netlink(). This function is only used during bootstrap. */ -int +static int netlink_interface (struct sockaddr_nl *snl, struct nlmsghdr *h) { int len; @@ -517,7 +517,7 @@ netlink_interface (struct sockaddr_nl *snl, struct nlmsghdr *h) } /* Lookup interface IPv4/IPv6 address. */ -int +static int netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h) { int len; @@ -652,7 +652,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h) } /* Looking up routing table by netlink interface. */ -int +static int netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h) { int len; @@ -769,7 +769,7 @@ struct message rtproto_str[] = { }; /* Routing information change from the kernel. */ -int +static int netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h) { int len; @@ -910,7 +910,7 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h) return 0; } -int +static int netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h) { int len; @@ -1023,7 +1023,7 @@ netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h) return 0; } -int +static int netlink_information_fetch (struct sockaddr_nl *snl, struct nlmsghdr *h) { /* JF: Ignore messages that aren't from the kernel */ @@ -1125,7 +1125,7 @@ netlink_route_read (void) /* Utility function comes from iproute2. Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> */ -int +static int addattr_l (struct nlmsghdr *n, int maxlen, int type, void *data, int alen) { int len; @@ -1145,7 +1145,7 @@ addattr_l (struct nlmsghdr *n, int maxlen, int type, void *data, int alen) return 0; } -int +static int rta_addattr_l (struct rtattr *rta, int maxlen, int type, void *data, int alen) { int len; @@ -1167,7 +1167,7 @@ rta_addattr_l (struct rtattr *rta, int maxlen, int type, void *data, int alen) /* Utility function comes from iproute2. Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> */ -int +static int addattr32 (struct nlmsghdr *n, int maxlen, int type, int data) { int len; @@ -1195,7 +1195,7 @@ netlink_talk_filter (struct sockaddr_nl *snl, struct nlmsghdr *h) } /* sendmsg() to netlink socket then recvmsg(). */ -int +static int netlink_talk (struct nlmsghdr *n, struct nlsock *nl) { int status; @@ -1241,7 +1241,7 @@ netlink_talk (struct nlmsghdr *n, struct nlsock *nl) } /* Routing table change via netlink interface. */ -int +static int netlink_route (int cmd, int family, void *dest, int length, void *gate, int index, int zebra_flags, int table) { @@ -1316,7 +1316,7 @@ netlink_route (int cmd, int family, void *dest, int length, void *gate, } /* Routing table change via netlink interface. */ -int +static int netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib, int family) { @@ -1779,7 +1779,7 @@ kernel_delete_ipv6_old (struct prefix_ipv6 *dest, struct in6_addr *gate, #endif /* HAVE_IPV6 */ /* Interface address modification. */ -int +static int netlink_address (int cmd, int family, struct interface *ifp, struct connected *ifc) { @@ -1844,7 +1844,7 @@ kernel_address_delete_ipv4 (struct interface *ifp, struct connected *ifc) extern struct thread_master *master; /* Kernel route reflection. */ -int +static int kernel_read (struct thread *thread) { int ret; diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 4bdb83d5..0097e28f 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -90,11 +90,13 @@ rtadv_new (void) return new; } +#if 0 static void rtadv_free (struct rtadv *rtadv) { XFREE (MTYPE_TMP, rtadv); } +#endif static int rtadv_recv_packet (int sock, u_char *buf, int buflen, @@ -451,7 +453,7 @@ rtadv_read (struct thread *thread) int len; u_char buf[RTADV_MSG_SIZE]; struct sockaddr_in6 from; - unsigned int ifindex; + unsigned int ifindex = 0; int hoplimit = -1; sock = THREAD_FD (thread); diff --git a/zebra/rtread_netlink.c b/zebra/rtread_netlink.c index 0b255a53..44715d94 100644 --- a/zebra/rtread_netlink.c +++ b/zebra/rtread_netlink.c @@ -21,11 +21,9 @@ */ #include <zebra.h> +extern void netlink_route_read (void); -/* Extern from rt_netlink.c */ -void netlink_route_read (); - -void route_read () +void route_read (void) { netlink_route_read (); } diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 5ae556bf..59b53fa1 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -93,6 +93,7 @@ vrf_alloc (const char *name) return vrf; } +#if 0 /* Free VRF. */ static void vrf_free (struct vrf *vrf) @@ -101,6 +102,7 @@ vrf_free (struct vrf *vrf) XFREE (MTYPE_VRF_NAME, vrf->name); XFREE (MTYPE_VRF, vrf); } +#endif /* Lookup VRF by identifier. */ struct vrf * @@ -109,6 +111,7 @@ vrf_lookup (u_int32_t id) return vector_lookup (vrf_vector, id); } +#if 0 /* Lookup VRF by name. */ static struct vrf * vrf_lookup_by_name (char *name) @@ -122,6 +125,7 @@ vrf_lookup_by_name (char *name) return vrf; return NULL; } +#endif /* Initialize VRF. */ static void @@ -911,8 +915,7 @@ nexthop_active_check (struct route_node *rn, struct rib *rib, return CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE); rmap = 0; - if (rib->type >= 0 && rib->type < ZEBRA_ROUTE_MAX && - proto_rm[family][rib->type]) + if (rib->type < ZEBRA_ROUTE_MAX && proto_rm[family][rib->type]) rmap = route_map_lookup_by_name (proto_rm[family][rib->type]); if (!rmap && proto_rm[family][ZEBRA_ROUTE_MAX]) rmap = route_map_lookup_by_name (proto_rm[family][ZEBRA_ROUTE_MAX]); @@ -1567,7 +1570,7 @@ void rib_dump (const char * func, const struct prefix_ipv4 * p, const struct rib zlog_debug ("%s: dumping RIB entry %p for %s/%d", func, rib, straddr1, p->prefixlen); zlog_debug ( - "%s: refcnt == %lu, uptime == %u, type == %u, table == %d", + "%s: refcnt == %lu, uptime == %lu, type == %u, table == %d", func, rib->refcnt, rib->uptime, @@ -2780,6 +2783,7 @@ rib_update (void) rib_queue_add (&zebrad, rn); } +#if 0 /* Interface goes up. */ static void rib_if_up (struct interface *ifp) @@ -2793,6 +2797,7 @@ rib_if_down (struct interface *ifp) { rib_update (); } +#endif /* Remove all routes which comes from non main table. */ static void |