diff options
73 files changed, 34 insertions, 800 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 534a0323c..0e03392fa 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -682,11 +682,9 @@ attrhash_key_make (void *p) if (extra->vnc_subtlvs) MIX(encap_hash_key_make (extra->vnc_subtlvs)); #endif -#ifdef HAVE_IPV6 MIX(extra->mp_nexthop_len); key = jhash(extra->mp_nexthop_global.s6_addr, IPV6_MAX_BYTELEN, key); key = jhash(extra->mp_nexthop_local.s6_addr, IPV6_MAX_BYTELEN, key); -#endif /* HAVE_IPV6 */ } return key; @@ -715,11 +713,9 @@ attrhash_cmp (const void *p1, const void *p2) && ae1->aggregator_addr.s_addr == ae2->aggregator_addr.s_addr && ae1->weight == ae2->weight && ae1->tag == ae2->tag -#ifdef HAVE_IPV6 && ae1->mp_nexthop_len == ae2->mp_nexthop_len && IPV6_ADDR_SAME (&ae1->mp_nexthop_global, &ae2->mp_nexthop_global) && IPV6_ADDR_SAME (&ae1->mp_nexthop_local, &ae2->mp_nexthop_local) -#endif /* HAVE_IPV6 */ && IPV4_ADDR_SAME (&ae1->mp_nexthop_global_in, &ae2->mp_nexthop_global_in) && ae1->ecommunity == ae2->ecommunity && ae1->cluster == ae2->cluster @@ -935,9 +931,7 @@ bgp_attr_default_set (struct attr *attr, u_char origin) attr->extra->weight = BGP_ATTR_DEFAULT_WEIGHT; attr->extra->tag = 0; attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP); -#ifdef HAVE_IPV6 attr->extra->mp_nexthop_len = IPV6_MAX_BYTELEN; -#endif return attr; } @@ -998,9 +992,7 @@ bgp_attr_aggregate_intern (struct bgp *bgp, u_char origin, } attre.weight = BGP_ATTR_DEFAULT_WEIGHT; -#ifdef HAVE_IPV6 attre.mp_nexthop_len = IPV6_MAX_BYTELEN; -#endif if (! as_set || atomic_aggregate) attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE); attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR); @@ -1909,7 +1901,6 @@ bgp_mp_reach_parse (struct bgp_attr_parser_args *args, stream_getl (s); /* RD low */ stream_get (&attre->mp_nexthop_global_in, s, IPV4_MAX_BYTELEN); break; -#ifdef HAVE_IPV6 case BGP_ATTR_NHLEN_IPV6_GLOBAL: case BGP_ATTR_NHLEN_VPNV6_GLOBAL: if (attre->mp_nexthop_len == BGP_ATTR_NHLEN_VPNV6_GLOBAL) @@ -1949,7 +1940,6 @@ bgp_mp_reach_parse (struct bgp_attr_parser_args *args, attre->mp_nexthop_len = IPV6_MAX_BYTELEN; } break; -#endif /* HAVE_IPV6 */ default: zlog_info ("%s: (%s) Wrong multiprotocol next hop length: %d", __func__, peer->host, attre->mp_nexthop_len); @@ -2671,7 +2661,6 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi, break; } break; -#ifdef HAVE_IPV6 case AFI_IP6: switch (safi) { @@ -2718,7 +2707,6 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi, break; } break; -#endif /*HAVE_IPV6*/ default: break; } @@ -3361,11 +3349,7 @@ bgp_dump_routes_attr (struct stream *s, struct attr *attr, /* Nexthop attribute. */ /* If it's an IPv6 prefix, don't dump the IPv4 nexthop to save space */ - if(prefix != NULL -#ifdef HAVE_IPV6 - && prefix->family != AF_INET6 -#endif /* HAVE_IPV6 */ - ) + if(prefix != NULL && prefix->family != AF_INET6) { stream_putc (s, BGP_ATTR_FLAG_TRANS); stream_putc (s, BGP_ATTR_NEXT_HOP); @@ -3428,7 +3412,6 @@ bgp_dump_routes_attr (struct stream *s, struct attr *attr, stream_put (s, attr->community->val, attr->community->size * 4); } -#ifdef HAVE_IPV6 /* Add a MP_NLRI attribute to dump the IPv6 next hop */ if (prefix != NULL && prefix->family == AF_INET6 && attr->extra && (attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL || @@ -3461,7 +3444,6 @@ bgp_dump_routes_attr (struct stream *s, struct attr *attr, /* Set MP attribute length. */ stream_putc_at (s, sizep, (stream_get_endp (s) - sizep) - 1); } -#endif /* HAVE_IPV6 */ /* Return total size of attribute. */ len = stream_get_endp (s) - cp - 2; diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index f2393dedd..7892005f0 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -339,7 +339,6 @@ bgp_bfd_dest_update (int command, struct zclient *zclient, if (dp.u.prefix4.s_addr != peer->su.sin.sin_addr.s_addr) continue; } -#ifdef HAVE_IPV6 else if ((dp.family == AF_INET6) && (peer->su.sa.sa_family == AF_INET6)) { @@ -347,7 +346,6 @@ bgp_bfd_dest_update (int command, struct zclient *zclient, sizeof (struct in6_addr))) continue; } -#endif else continue; @@ -366,7 +364,6 @@ bgp_bfd_dest_update (int command, struct zclient *zclient, if (sp.u.prefix4.s_addr != peer->su_local->sin.sin_addr.s_addr) continue; } -#ifdef HAVE_IPV6 else if ((sp.family == AF_INET6) && (peer->su_local->sa.sa_family == AF_INET6)) { @@ -374,7 +371,6 @@ bgp_bfd_dest_update (int command, struct zclient *zclient, sizeof (struct in6_addr))) continue; } -#endif else continue; diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index de175de5a..ab0587821 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -392,7 +392,6 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size) snprintf (buf + strlen (buf), size - strlen (buf), ", origin %s", bgp_origin_str[attr->origin]); -#ifdef HAVE_IPV6 if (attr->extra) { char addrbuf[BUFSIZ]; @@ -409,7 +408,6 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size) inet_ntop (AF_INET6, &attr->extra->mp_nexthop_local, addrbuf, BUFSIZ)); } -#endif /* HAVE_IPV6 */ if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF))) snprintf (buf + strlen (buf), size - strlen (buf), ", localpref %u", diff --git a/bgpd/bgp_encap.c b/bgpd/bgp_encap.c index 37e916638..75a348e3f 100644 --- a/bgpd/bgp_encap.c +++ b/bgpd/bgp_encap.c @@ -484,7 +484,7 @@ DEFUN (show_bgp_ipv4_encap, { return bgp_show_encap (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 0); } -#ifdef HAVE_IPV6 + DEFUN (show_bgp_ipv6_encap, show_bgp_ipv6_encap_cmd, "show [ip] bgp ipv6 encap", @@ -496,7 +496,6 @@ DEFUN (show_bgp_ipv6_encap, { return bgp_show_encap (vty, AFI_IP6, NULL, bgp_show_type_normal, NULL, 0); } -#endif DEFUN (show_bgp_ipv4_encap_rd, show_bgp_ipv4_encap_rd_cmd, @@ -521,7 +520,7 @@ DEFUN (show_bgp_ipv4_encap_rd, } return bgp_show_encap (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 0); } -#ifdef HAVE_IPV6 + DEFUN (show_bgp_ipv6_encap_rd, show_bgp_ipv6_encap_rd_cmd, "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn", @@ -546,7 +545,6 @@ DEFUN (show_bgp_ipv6_encap_rd, } return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 0); } -#endif DEFUN (show_bgp_ipv4_encap_tags, show_bgp_ipv4_encap_tags_cmd, @@ -560,7 +558,7 @@ DEFUN (show_bgp_ipv4_encap_tags, { return bgp_show_encap (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 1); } -#ifdef HAVE_IPV6 + DEFUN (show_bgp_ipv6_encap_tags, show_bgp_ipv6_encap_tags_cmd, "show [ip] bgp ipv6 encap tags", @@ -573,7 +571,6 @@ DEFUN (show_bgp_ipv6_encap_tags, { return bgp_show_encap (vty, AFI_IP6, NULL, bgp_show_type_normal, NULL, 1); } -#endif DEFUN (show_bgp_ipv4_encap_rd_tags, show_bgp_ipv4_encap_rd_tags_cmd, @@ -599,7 +596,7 @@ DEFUN (show_bgp_ipv4_encap_rd_tags, } return bgp_show_encap (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 1); } -#ifdef HAVE_IPV6 + DEFUN (show_bgp_ipv6_encap_rd_tags, show_bgp_ipv6_encap_rd_tags_cmd, "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn tags", @@ -624,7 +621,6 @@ DEFUN (show_bgp_ipv6_encap_rd_tags, } return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 1); } -#endif DEFUN (show_bgp_ipv4_encap_neighbor_routes, show_bgp_ipv4_encap_neighbor_routes_cmd, @@ -657,7 +653,7 @@ DEFUN (show_bgp_ipv4_encap_neighbor_routes, return bgp_show_encap (vty, AFI_IP, NULL, bgp_show_type_neighbor, &su, 0); } -#ifdef HAVE_IPV6 + DEFUN (show_bgp_ipv6_encap_neighbor_routes, show_bgp_ipv6_encap_neighbor_routes_cmd, "show [ip] bgp ipv6 encap neighbors A.B.C.D routes", @@ -689,7 +685,6 @@ DEFUN (show_bgp_ipv6_encap_neighbor_routes, return bgp_show_encap (vty, AFI_IP6, NULL, bgp_show_type_neighbor, &su, 0); } -#endif DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes, show_bgp_ipv4_encap_rd_neighbor_routes_cmd, @@ -735,7 +730,7 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_routes, return bgp_show_encap (vty, AFI_IP, &prd, bgp_show_type_neighbor, &su, 0); } -#ifdef HAVE_IPV6 + DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes, show_bgp_ipv6_encap_rd_neighbor_routes_cmd, "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> routes", @@ -780,7 +775,6 @@ DEFUN (show_bgp_ipv6_encap_rd_neighbor_routes, return bgp_show_encap (vty, AFI_IP6, &prd, bgp_show_type_neighbor, &su, 0); } -#endif DEFUN (show_bgp_ipv4_encap_neighbor_advertised_routes, show_bgp_ipv4_encap_neighbor_advertised_routes_cmd, @@ -814,7 +808,7 @@ DEFUN (show_bgp_ipv4_encap_neighbor_advertised_routes, return show_adj_route_encap (vty, peer, NULL); } -#ifdef HAVE_IPV6 + DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes, show_bgp_ipv6_encap_neighbor_advertised_routes_cmd, "show [ip] bgp ipv6 encap neighbors A.B.C.D advertised-routes", @@ -847,7 +841,6 @@ DEFUN (show_bgp_ipv6_encap_neighbor_advertised_routes, return show_adj_route_encap (vty, peer, NULL); } -#endif DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd, @@ -893,7 +886,7 @@ DEFUN (show_bgp_ipv4_encap_rd_neighbor_advertised_routes, return show_adj_route_encap (vty, peer, &prd); } -#ifdef HAVE_IPV6 + DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes, show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd, "show [ip] bgp ipv6 encap rd ASN:nn_or_IP-address:nn neighbors <A.B.C.D|X:X::X:X> advertised-routes", @@ -938,7 +931,6 @@ DEFUN (show_bgp_ipv6_encap_rd_neighbor_advertised_routes, return show_adj_route_encap (vty, peer, &prd); } -#endif void bgp_encap_init (void) @@ -955,7 +947,6 @@ bgp_encap_init (void) install_element (VIEW_NODE, &show_bgp_ipv4_encap_neighbor_advertised_routes_cmd); install_element (VIEW_NODE, &show_bgp_ipv4_encap_rd_neighbor_advertised_routes_cmd); -#ifdef HAVE_IPV6 install_element (VIEW_NODE, &show_bgp_ipv6_encap_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_encap_tags_cmd); @@ -964,5 +955,4 @@ bgp_encap_init (void) install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_neighbor_routes_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_encap_neighbor_advertised_routes_cmd); install_element (VIEW_NODE, &show_bgp_ipv6_encap_rd_neighbor_advertised_routes_cmd); -#endif } diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index c9af8419f..208f676f1 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -125,7 +125,6 @@ bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2) compare = IPV4_ADDR_CMP (&ae1->mp_nexthop_global_in, &ae2->mp_nexthop_global_in); break; -#ifdef HAVE_IPV6 case BGP_ATTR_NHLEN_IPV6_GLOBAL: compare = IPV6_ADDR_CMP (&ae1->mp_nexthop_global, &ae2->mp_nexthop_global); @@ -137,11 +136,9 @@ bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2) compare = IPV6_ADDR_CMP (&ae1->mp_nexthop_local, &ae2->mp_nexthop_local); break; -#endif /* HAVE_IPV6 */ } } -#ifdef HAVE_IPV6 /* This can happen if one IPv6 peer sends you global and link-local * nexthops but another IPv6 peer only sends you global */ @@ -158,7 +155,6 @@ bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp_info *bi2) compare = 1; } } -#endif /* HAVE_IPV6 */ } return compare; @@ -755,10 +751,8 @@ bgp_info_mpath_aggregate_update (struct bgp_info *new_best, /* Zap multipath attr nexthop so we set nexthop to self */ attr.nexthop.s_addr = 0; -#ifdef HAVE_IPV6 if (attr.extra) memset (&attr.extra->mp_nexthop_global, 0, sizeof (struct in6_addr)); -#endif /* HAVE_IPV6 */ /* TODO: should we set ATOMIC_AGGREGATE and AGGREGATOR? */ } diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 9a49051a9..1358ebc5e 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -598,10 +598,8 @@ bgp_connect (struct peer *peer) zlog_err ("%s: could not raise privs", __func__); if (sockunion_family (&peer->su) == AF_INET) setsockopt_ipv4_tos (peer->fd, IPTOS_PREC_INTERNETCONTROL); -# ifdef HAVE_IPV6 else if (sockunion_family (&peer->su) == AF_INET6) setsockopt_ipv6_tclass (peer->fd, IPTOS_PREC_INTERNETCONTROL); -# endif if (bgpd_privs.change (ZPRIVS_LOWER)) zlog_err ("%s: could not lower privs", __func__); #endif @@ -618,10 +616,8 @@ bgp_connect (struct peer *peer) return connect_error; } -#ifdef HAVE_IPV6 if (peer->conf_if || peer->ifname) ifindex = ifname2ifindex (peer->conf_if ? peer->conf_if : peer->ifname); -#endif /* HAVE_IPV6 */ if (bgp_debug_neighbor_events(peer)) zlog_debug ("%s [Event] Connect start to %s fd %d", @@ -681,10 +677,8 @@ bgp_listener (int sock, struct sockaddr *sa, socklen_t salen) #ifdef IPTOS_PREC_INTERNETCONTROL if (sa->sa_family == AF_INET) setsockopt_ipv4_tos (sock, IPTOS_PREC_INTERNETCONTROL); -# ifdef HAVE_IPV6 else if (sa->sa_family == AF_INET6) setsockopt_ipv6_tclass (sock, IPTOS_PREC_INTERNETCONTROL); -# endif #endif sockopt_v6only (sa->sa_family, sock); @@ -717,7 +711,6 @@ bgp_listener (int sock, struct sockaddr *sa, socklen_t salen) } /* IPv6 supported version of BGP server socket setup. */ -#ifdef HAVE_IPV6 int bgp_socket (unsigned short port, const char *address) { @@ -774,50 +767,6 @@ bgp_socket (unsigned short port, const char *address) return 0; } -#else -/* Traditional IPv4 only version. */ -int -bgp_socket (unsigned short port, const char *address) -{ - int sock; - int socklen; - struct sockaddr_in sin; - int ret; - - sock = socket (AF_INET, SOCK_STREAM, 0); - if (sock < 0) - { - zlog_err ("socket: %s", safe_strerror (errno)); - return sock; - } - - /* if we intend to implement ttl-security, this socket needs ttl=255 */ - sockopt_ttl (AF_INET, sock, MAXTTL); - - memset (&sin, 0, sizeof (struct sockaddr_in)); - sin.sin_family = AF_INET; - sin.sin_port = htons (port); - socklen = sizeof (struct sockaddr_in); - - if (address && ((ret = inet_aton(address, &sin.sin_addr)) < 1)) - { - zlog_err("bgp_socket: could not parse ip address %s: %s", - address, safe_strerror (errno)); - return ret; - } -#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN - sin.sin_len = socklen; -#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ - - ret = bgp_listener (sock, (struct sockaddr *) &sin, socklen); - if (ret < 0) - { - close (sock); - return ret; - } - return sock; -} -#endif /* HAVE_IPV6 */ void bgp_close (void) diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 2cbcc37d6..0a9747b52 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -243,7 +243,6 @@ bgp_connected_add (struct bgp *bgp, struct connected *ifc) } } } -#ifdef HAVE_IPV6 else if (addr->family == AF_INET6) { apply_mask_ipv6 ((struct prefix_ipv6 *) &p); @@ -267,7 +266,6 @@ bgp_connected_add (struct bgp *bgp, struct connected *ifc) rn->info = bc; } } -#endif /* HAVE_IPV6 */ } void @@ -304,7 +302,6 @@ bgp_connected_delete (struct bgp *bgp, struct connected *ifc) bgp_unlock_node (rn); bgp_unlock_node (rn); } -#ifdef HAVE_IPV6 else if (addr->family == AF_INET6) { apply_mask_ipv6 ((struct prefix_ipv6 *) &p); @@ -329,7 +326,6 @@ bgp_connected_delete (struct bgp *bgp, struct connected *ifc) bgp_unlock_node (rn); bgp_unlock_node (rn); } -#endif /* HAVE_IPV6 */ } int diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 1ca048367..057e2ace7 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -509,7 +509,6 @@ make_prefix (int afi, struct bgp_info *ri, struct prefix *p) p->prefixlen = IPV4_MAX_BITLEN; } break; -#ifdef HAVE_IPV6 case AFI_IP6: /* We don't register link local NH */ if (ri->attr->extra->mp_nexthop_len != BGP_ATTR_NHLEN_IPV6_GLOBAL @@ -529,7 +528,6 @@ make_prefix (int afi, struct bgp_info *ri, struct prefix *p) p->prefixlen = IPV6_MAX_BITLEN; } break; -#endif default: if (BGP_DEBUG(nht, NHT)) { @@ -582,11 +580,9 @@ sendmsg_zebra_rnh (struct bgp_nexthop_cache *bnc, int command) case AF_INET: stream_put_in_addr (s, &p->u.prefix4); break; -#ifdef HAVE_IPV6 case AF_INET6: stream_put(s, &(p->u.prefix6), 16); break; -#endif default: break; } diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 6d8f721bf..09d5a8498 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1172,10 +1172,8 @@ subgroup_announce_reset_nhop (u_char family, struct attr *attr) { if (family == AF_INET) attr->nexthop.s_addr = 0; -#ifdef HAVE_IPV6 if (family == AF_INET6) memset (&attr->extra->mp_nexthop_global, 0, IPV6_MAX_BYTELEN); -#endif } int @@ -1266,10 +1264,8 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp, { if (p->family == AF_INET && p->u.prefix4.s_addr == INADDR_ANY) return 0; -#ifdef HAVE_IPV6 else if (p->family == AF_INET6 && p->prefixlen == 0) return 0; -#endif /* HAVE_IPV6 */ } /* Transparency check. */ @@ -1432,7 +1428,6 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp, if (reflect) SET_FLAG(attr->rmap_change_flags, BATTR_REFLECTED); -#ifdef HAVE_IPV6 #define NEXTHOP_IS_V6 (\ (safi != SAFI_ENCAP && \ (p->family == AF_INET6 || peer_cap_enhe(peer))) || \ @@ -1463,7 +1458,6 @@ subgroup_announce_check (struct bgp_info *ri, struct update_subgroup *subgrp, PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED))) memset (&attr->extra->mp_nexthop_local, 0, IPV6_MAX_BYTELEN); } -#endif /* HAVE_IPV6 */ bgp_peer_remove_private_as(bgp, afi, safi, peer, attr); bgp_peer_as_override(bgp, afi, safi, peer, attr); @@ -2317,14 +2311,12 @@ bgp_update_martian_nexthop (struct bgp *bgp, afi_t afi, safi_t safi, struct attr IPV4_CLASS_DE (ntohl (attre->mp_nexthop_global_in.s_addr))); break; -#ifdef HAVE_IPV6 case BGP_ATTR_NHLEN_IPV6_GLOBAL: case BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL: ret = (IN6_IS_ADDR_UNSPECIFIED(&attre->mp_nexthop_global) || IN6_IS_ADDR_LOOPBACK(&attre->mp_nexthop_global) || IN6_IS_ADDR_MULTICAST(&attre->mp_nexthop_global)); break; -#endif /* HAVE_IPV6 */ default: ret = 1; @@ -3523,7 +3515,6 @@ bgp_nlri_parse_ip (struct peer *peer, struct attr *attr, } } -#ifdef HAVE_IPV6 /* Check address. */ if (afi == AFI_IP6 && safi == SAFI_UNICAST) { @@ -3546,7 +3537,6 @@ bgp_nlri_parse_ip (struct peer *peer, struct attr *attr, continue; } } -#endif /* HAVE_IPV6 */ /* Normal process. */ if (attr) @@ -4029,14 +4019,12 @@ bgp_static_set (struct vty *vty, const char *ip_str, vty_out (vty, "%% Malformed prefix%s", VTY_NEWLINE); return CMD_WARNING; } -#ifdef HAVE_IPV6 if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&p.u.prefix6)) { vty_out (vty, "%% Malformed prefix (link-local address)%s", VTY_NEWLINE); return CMD_WARNING; } -#endif /* HAVE_IPV6 */ apply_mask (&p); @@ -4118,14 +4106,12 @@ bgp_static_unset (struct vty *vty, const char *ip_str, vty_out (vty, "%% Malformed prefix%s", VTY_NEWLINE); return CMD_WARNING; } -#ifdef HAVE_IPV6 if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&p.u.prefix6)) { vty_out (vty, "%% Malformed prefix (link-local address)%s", VTY_NEWLINE); return CMD_WARNING; } -#endif /* HAVE_IPV6 */ apply_mask (&p); @@ -5551,14 +5537,12 @@ bgp_redistribute_add (struct bgp *bgp, struct prefix *p, const struct in_addr *n attr.nexthop = *nexthop; attr.nh_ifindex = ifindex; -#ifdef HAVE_IPV6 if (nexthop6) { struct attr_extra *extra = bgp_attr_extra_get(&attr); extra->mp_nexthop_global = *nexthop6; extra->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL; } -#endif attr.med = metric; attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC); @@ -5887,12 +5871,10 @@ route_vty_out (struct vty *vty, struct prefix *p, vty_out (vty, "%s", inet_ntop(af, &attr->extra->mp_nexthop_global_in, buf, BUFSIZ)); break; -#if HAVE_IPV6 case AF_INET6: vty_out (vty, "%s", inet_ntop(af, &attr->extra->mp_nexthop_global, buf, BUFSIZ)); break; -#endif default: vty_out(vty, "?"); break; @@ -6139,7 +6121,6 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t else json_object_string_add(json_net, "nextHop", inet_ntoa (attr->nexthop)); } -#ifdef HAVE_IPV6 else if (p->family == AF_INET6 || BGP_ATTR_NEXTHOP_AFI_IP6(attr)) { char buf[BUFSIZ]; @@ -6147,7 +6128,6 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t json_object_string_add(json_net, "netHopGloabal", inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global, buf, BUFSIZ)); } -#endif /* HAVE_IPV6 */ if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC)) json_object_int_add(json_net, "metric", attr->med); @@ -6180,7 +6160,6 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t else vty_out (vty, "%-16s", inet_ntoa (attr->nexthop)); } -#ifdef HAVE_IPV6 else if (p->family == AF_INET6 || BGP_ATTR_NEXTHOP_AFI_IP6(attr)) { int len; @@ -6197,7 +6176,6 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t else vty_out (vty, "%*s", len, " "); } -#endif /* HAVE_IPV6 */ if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC)) vty_out (vty, "%10u", attr->med); else @@ -6278,7 +6256,6 @@ route_vty_out_tag (struct vty *vty, struct prefix *p, vty_out (vty, "%-16s", inet_ntoa (attr->nexthop)); } } -#ifdef HAVE_IPV6 else if (p->family == AF_INET6 || BGP_ATTR_NEXTHOP_AFI_IP6(attr)) { assert (attr->extra); @@ -6315,7 +6292,6 @@ route_vty_out_tag (struct vty *vty, struct prefix *p, } } -#endif /* HAVE_IPV6 */ } label = decode_label (binfo->extra->tag); @@ -10565,7 +10541,6 @@ bgp_route_init (void) install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbor_prefix_counts_cmd); install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbor_prefix_counts_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_neighbor_prefix_counts_cmd); -#ifdef HAVE_IPV6 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_prefix_counts_cmd); install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbor_prefix_counts_cmd); @@ -10585,7 +10560,6 @@ bgp_route_init (void) /* Statistics */ install_element (ENABLE_NODE, &show_bgp_statistics_cmd); install_element (ENABLE_NODE, &show_bgp_statistics_view_cmd); -#endif /* HAVE_IPV6 */ install_element (BGP_NODE, &bgp_distance_cmd); install_element (BGP_NODE, &no_bgp_distance_cmd); diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index e3e018c07..4f7f51fbb 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -1916,7 +1916,6 @@ static struct route_map_rule_cmd route_set_tag_cmd = }; -#ifdef HAVE_IPV6 /* `match ipv6 address IP_ACCESS_LIST' */ static route_map_result_t @@ -2341,8 +2340,6 @@ struct route_map_rule_cmd route_set_ipv6_nexthop_peer_cmd = route_set_ipv6_nexthop_peer_free }; -#endif /* HAVE_IPV6 */ - /* `set vpnv4 nexthop A.B.C.D' */ static route_map_result_t @@ -3755,7 +3752,6 @@ DEFUN (no_set_aggregator_as, return ret; } -#ifdef HAVE_IPV6 DEFUN (match_ipv6_next_hop, match_ipv6_next_hop_cmd, "match ipv6 next-hop X:X::X:X", @@ -3884,7 +3880,6 @@ DEFUN (no_set_ipv6_nexthop_global, return generic_set_delete (vty, VTY_GET_CONTEXT(route_map_index), "ipv6 next-hop global", argv[idx_ipv6]->arg); } -#endif /* HAVE_IPV6 */ DEFUN (set_vpnv4_nexthop, set_vpnv4_nexthop_cmd, @@ -4085,7 +4080,6 @@ bgp_route_map_init (void) install_element (RMAP_NODE, &set_originator_id_cmd); install_element (RMAP_NODE, &no_set_originator_id_cmd); -#ifdef HAVE_IPV6 route_map_install_match (&route_match_ipv6_address_cmd); route_map_install_match (&route_match_ipv6_next_hop_cmd); route_map_install_match (&route_match_ipv6_address_prefix_list_cmd); @@ -4102,7 +4096,6 @@ bgp_route_map_init (void) install_element (RMAP_NODE, &no_set_ipv6_nexthop_prefer_global_cmd); install_element (RMAP_NODE, &set_ipv6_nexthop_peer_cmd); install_element (RMAP_NODE, &no_set_ipv6_nexthop_peer_cmd); -#endif /* HAVE_IPV6 */ } void diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h index 2f839c4af..3c96dac61 100644 --- a/bgpd/bgp_table.h +++ b/bgpd/bgp_table.h @@ -222,8 +222,6 @@ bgp_node_match_ipv4 (const struct bgp_table *table, struct in_addr *addr) addr)); } -#ifdef HAVE_IPV6 - /* * bgp_node_match_ipv6 */ @@ -234,8 +232,6 @@ bgp_node_match_ipv6 (const struct bgp_table *table, struct in6_addr *addr) addr)); } -#endif /* HAVE_IPV6 */ - static inline unsigned long bgp_table_count (const struct bgp_table *const table) { diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index df154d976..48f56a29b 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -711,7 +711,6 @@ subgroup_default_originate (struct update_subgroup *subgrp, int withdraw) if (afi == AFI_IP) str2prefix ("0.0.0.0/0", &p); -#ifdef HAVE_IPV6 else if (afi == AFI_IP6) { struct attr_extra *ae = attr.extra; @@ -727,7 +726,6 @@ subgroup_default_originate (struct update_subgroup *subgrp, int withdraw) && !IN6_IS_ADDR_UNSPECIFIED (&peer->nexthop.v6_local)) ae->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL; } -#endif /* HAVE_IPV6 */ if (peer->default_rmap[afi][safi].name) { @@ -785,10 +783,8 @@ subgroup_default_originate (struct update_subgroup *subgrp, int withdraw) */ if (afi == AFI_IP) str2prefix ("0.0.0.0/0", &p); -#ifdef HAVE_IPV6 else str2prefix ("::/0", &p); -#endif /* HAVE_IPV6 */ rn = bgp_afi_node_get (bgp->rib[afi][safi], afi, safi, &p, NULL); bgp_adj_out_unset_subgroup (rn, subgrp, 0, BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE); diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index e18ba235c..cb05cf0a8 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -988,10 +988,8 @@ subgroup_default_update_packet (struct update_subgroup *subgrp, if (afi == AFI_IP) str2prefix ("0.0.0.0/0", &p); -#ifdef HAVE_IPV6 else str2prefix ("::/0", &p); -#endif /* HAVE_IPV6 */ /* Logging the attribute. */ if (bgp_debug_update(NULL, &p, subgrp->update_group, 0)) @@ -1066,10 +1064,8 @@ subgroup_default_withdraw_packet (struct update_subgroup *subgrp) if (afi == AFI_IP) str2prefix ("0.0.0.0/0", &p); -#ifdef HAVE_IPV6 else str2prefix ("::/0", &p); -#endif /* HAVE_IPV6 */ if (bgp_debug_update(NULL, &p, subgrp->update_group, 0)) { diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 5129c0ecf..95b7250d3 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -115,11 +115,9 @@ bgp_vty_afi_from_arg(const char *afi_str) if (!strcmp(afi_str, "ipv4")) { afi = AFI_IP; } -#ifdef HAVE_IPV6 else if (!strcmp(afi_str, "ipv6")) { afi = AFI_IP6; } -#endif /* HAVE_IPV6 */ return afi; } @@ -216,11 +214,9 @@ peer_address_self_check (struct bgp *bgp, union sockunion *su) if (su->sa.sa_family == AF_INET) ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr, bgp->vrf_id); -#ifdef HAVE_IPV6 else if (su->sa.sa_family == AF_INET6) ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr, su->sin6.sin6_scope_id, bgp->vrf_id); -#endif /* HAVE IPV6 */ if (ifp) return 1; @@ -7518,7 +7514,6 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js || p->afc_recv[AFI_IP][SAFI_UNICAST] || p->afc_adv[AFI_IP][SAFI_MULTICAST] || p->afc_recv[AFI_IP][SAFI_MULTICAST] -#ifdef HAVE_IPV6 || p->afc_adv[AFI_IP6][SAFI_UNICAST] || p->afc_recv[AFI_IP6][SAFI_UNICAST] || p->afc_adv[AFI_IP6][SAFI_MULTICAST] @@ -7527,7 +7522,6 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN] || p->afc_adv[AFI_IP6][SAFI_ENCAP] || p->afc_recv[AFI_IP6][SAFI_ENCAP] -#endif /* HAVE_IPV6 */ || p->afc_adv[AFI_IP][SAFI_ENCAP] || p->afc_recv[AFI_IP][SAFI_ENCAP] || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] @@ -8277,21 +8271,18 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js if (use_json) { json_object_string_add(json_neigh, "nexthop", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ)); -#ifdef HAVE_IPV6 json_object_string_add(json_neigh, "nexthopGlobal", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ)); json_object_string_add(json_neigh, "nexthopLocal", inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ)); if (p->shared_network) json_object_string_add(json_neigh, "bgpConnection", "sharedNetwork"); else json_object_string_add(json_neigh, "bgpConnection", "nonSharedNetwork"); -#endif /* HAVE_IPV6 */ } else { vty_out (vty, "Nexthop: %s%s", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), VTY_NEWLINE); -#ifdef HAVE_IPV6 vty_out (vty, "Nexthop global: %s%s", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), VTY_NEWLINE); @@ -8301,7 +8292,6 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js vty_out (vty, "BGP connection: %s%s", p->shared_network ? "shared network" : "non shared network", VTY_NEWLINE); -#endif /* HAVE_IPV6 */ } } @@ -9561,7 +9551,6 @@ DEFUN (no_bgp_redistribute_ipv4, return bgp_redistribute_unset (bgp, AFI_IP, type, 0); } -#ifdef HAVE_IPV6 DEFUN (bgp_redistribute_ipv6, bgp_redistribute_ipv6_cmd, "redistribute <kernel|connected|static|ripng|ospf6|isis|table>", @@ -9725,7 +9714,6 @@ DEFUN (no_bgp_redistribute_ipv6, return bgp_redistribute_unset (bgp, AFI_IP6, type, 0); } -#endif /* HAVE_IPV6 */ int bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, @@ -10688,18 +10676,14 @@ bgp_vty_init (void) /* address-family commands. */ install_element (BGP_NODE, &address_family_ipv4_cmd); install_element (BGP_NODE, &address_family_ipv4_safi_cmd); -#ifdef HAVE_IPV6 install_element (BGP_NODE, &address_family_ipv6_cmd); install_element (BGP_NODE, &address_family_ipv6_safi_cmd); -#endif /* HAVE_IPV6 */ install_element (BGP_NODE, &address_family_vpnv4_cmd); install_element (BGP_NODE, &address_family_vpnv6_cmd); install_element (BGP_NODE, &address_family_encap_cmd); -#ifdef HAVE_IPV6 install_element (BGP_NODE, &address_family_encapv6_cmd); -#endif /* "exit-address-family" command. */ install_element (BGP_IPV4_NODE, &exit_address_family_cmd); @@ -10776,14 +10760,12 @@ bgp_vty_init (void) install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); -#ifdef HAVE_IPV6 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); -#endif /* HAVE_IPV6 */ /* ttl_security commands */ install_element (BGP_NODE, &neighbor_ttl_security_cmd); diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 3d3bd90f5..8bc7bd302 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -698,7 +698,6 @@ zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length, return 0; } -#ifdef HAVE_IPV6 /* Zebra route add and delete treatment. */ static int zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length, @@ -817,7 +816,6 @@ zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length, return 0; } -#endif /* HAVE_IPV6 */ struct interface * if_lookup_by_ipv4 (struct in_addr *addr, vrf_id_t vrf_id) @@ -870,7 +868,6 @@ if_lookup_by_ipv4_exact (struct in_addr *addr, vrf_id_t vrf_id) return NULL; } -#ifdef HAVE_IPV6 struct interface * if_lookup_by_ipv6 (struct in6_addr *addr, ifindex_t ifindex, vrf_id_t vrf_id) { @@ -979,7 +976,6 @@ if_get_ipv6_local (struct interface *ifp, struct in6_addr *addr) } return 0; } -#endif /* HAVE_IPV6 */ static int if_get_ipv4_address (struct interface *ifp, struct in_addr *addr) @@ -1022,7 +1018,6 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote, else ifp = if_lookup_by_ipv4_exact (&local->sin.sin_addr, peer->bgp->vrf_id); } -#ifdef HAVE_IPV6 if (local->sa.sa_family == AF_INET6) { if (IN6_IS_ADDR_LINKLOCAL (&local->sin6.sin6_addr)) @@ -1037,7 +1032,6 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote, local->sin6.sin6_scope_id, peer->bgp->vrf_id); } -#endif /* HAVE_IPV6 */ if (!ifp) return -1; @@ -1047,7 +1041,6 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote, /* IPv4 connection, fetch and store IPv6 local address(es) if any. */ if (local->sa.sa_family == AF_INET) { -#ifdef HAVE_IPV6 /* IPv6 nexthop*/ ret = if_get_ipv6_global (ifp, &nexthop->v6_global); @@ -1069,10 +1062,8 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote, peer->shared_network = 1; else peer->shared_network = 0; -#endif /* HAVE_IPV6 */ } -#ifdef HAVE_IPV6 /* IPv6 connection, fetch and store IPv4 local address if any. */ if (local->sa.sa_family == AF_INET6) { @@ -1135,7 +1126,6 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote, SET_IN6_LINKLOCAL_IFINDEX (nexthop->v6_local, 0); } #endif /* KAME */ -#endif /* HAVE_IPV6 */ /* If we have identified the local interface, there is no error for now. */ return 0; @@ -1390,7 +1380,6 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp, zapi_ipv4_route (valid_nh_count ? ZEBRA_IPV4_ROUTE_ADD: ZEBRA_IPV4_ROUTE_DELETE, zclient, (struct prefix_ipv4 *) p, &api); } -#ifdef HAVE_IPV6 /* We have to think about a IPv6 link-local address curse. */ if (p->family == AF_INET6 || @@ -1601,7 +1590,6 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp, zclient, (struct prefix_ipv6 *) p, &api); } } -#endif /* HAVE_IPV6 */ } /* Announce all routes of a table to zebra */ @@ -1700,7 +1688,6 @@ bgp_zebra_withdraw (struct prefix *p, struct bgp_info *info, safi_t safi) zapi_ipv4_route (ZEBRA_IPV4_ROUTE_DELETE, zclient, (struct prefix_ipv4 *) p, &api); } -#ifdef HAVE_IPV6 /* We have to think about a IPv6 link-local address curse. */ if (p->family == AF_INET6) { @@ -1740,8 +1727,8 @@ bgp_zebra_withdraw (struct prefix *p, struct bgp_info *info, safi_t safi) zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, (struct prefix_ipv6 *) p, &api); } -#endif /* HAVE_IPV6 */ } + struct bgp_redist * bgp_redist_lookup (struct bgp *bgp, afi_t afi, u_char type, u_short instance) { diff --git a/bgpd/bgp_zebra.h b/bgpd/bgp_zebra.h index 24b4634eb..d22a00e8f 100644 --- a/bgpd/bgp_zebra.h +++ b/bgpd/bgp_zebra.h @@ -57,10 +57,8 @@ extern int bgp_redistribute_unreg (struct bgp *, afi_t, int, u_short); extern struct interface *if_lookup_by_ipv4 (struct in_addr *, vrf_id_t); extern struct interface *if_lookup_by_ipv4_exact (struct in_addr *, vrf_id_t); -#ifdef HAVE_IPV6 extern struct interface *if_lookup_by_ipv6 (struct in6_addr *, ifindex_t, vrf_id_t); extern struct interface *if_lookup_by_ipv6_exact (struct in6_addr *, ifindex_t, vrf_id_t); -#endif /* HAVE_IPV6 */ extern int bgp_zebra_num_connects(void); diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 76e19ac53..9befd6370 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -405,10 +405,8 @@ struct bgp_nexthop { struct interface *ifp; struct in_addr v4; -#ifdef HAVE_IPV6 struct in6_addr v6_global; struct in6_addr v6_local; -#endif /* HAVE_IPV6 */ }; /* BGP addpath values */ diff --git a/configure.ac b/configure.ac index d883063dd..519b1ea2e 100755 --- a/configure.ac +++ b/configure.ac @@ -1097,9 +1097,6 @@ dnl ---------- AC_MSG_ERROR([Failed to detect IPv6 stack]) fi -dnl this is unconditial, for compatibility -AC_DEFINE(HAVE_IPV6,1,IPv6) - dnl ------------------ dnl IPv6 header checks dnl ------------------ diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index 7f8e8decc..f55092487 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -145,10 +145,8 @@ isis_delete_adj (void *arg) list_delete (adj->area_addrs); if (adj->ipv4_addrs) list_delete (adj->ipv4_addrs); -#ifdef HAVE_IPV6 if (adj->ipv6_addrs) list_delete (adj->ipv6_addrs); -#endif XFREE (MTYPE_ISIS_ADJACENCY, adj); return; @@ -301,10 +299,8 @@ isis_adj_print (struct isis_adjacency *adj) struct isis_dynhn *dyn; struct listnode *node; struct in_addr *ipv4_addr; -#ifdef HAVE_IPV6 struct in6_addr *ipv6_addr; u_char ip6[INET6_ADDRSTRLEN]; -#endif /* HAVE_IPV6 */ if (!adj) return; @@ -323,7 +319,6 @@ isis_adj_print (struct isis_adjacency *adj) zlog_debug ("%s", inet_ntoa (*ipv4_addr)); } -#ifdef HAVE_IPV6 if (adj->ipv6_addrs && listcount (adj->ipv6_addrs) > 0) { zlog_debug ("IPv6 Address(es):"); @@ -333,7 +328,6 @@ isis_adj_print (struct isis_adjacency *adj) zlog_debug ("%s", ip6); } } -#endif /* HAVE_IPV6 */ zlog_debug ("Speaks: %s", nlpid2string (&adj->nlpids)); return; @@ -363,10 +357,8 @@ isis_adj_expire (struct thread *thread) void isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty, char detail) { -#ifdef HAVE_IPV6 struct in6_addr *ipv6_addr; u_char ip6[INET6_ADDRSTRLEN]; -#endif /* HAVE_IPV6 */ struct in_addr *ip_addr; time_t now; struct isis_dynhn *dyn; @@ -457,7 +449,6 @@ isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty, char detail) for (ALL_LIST_ELEMENTS_RO (adj->ipv4_addrs, node, ip_addr)) vty_out (vty, " %s%s", inet_ntoa (*ip_addr), VTY_NEWLINE); } -#ifdef HAVE_IPV6 if (adj->ipv6_addrs && listcount (adj->ipv6_addrs) > 0) { vty_out (vty, " IPv6 Address(es):%s", VTY_NEWLINE); @@ -467,7 +458,6 @@ isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty, char detail) vty_out (vty, " %s%s", ip6, VTY_NEWLINE); } } -#endif /* HAVE_IPV6 */ vty_out (vty, "%s", VTY_NEWLINE); } return; diff --git a/isisd/isis_adjacency.h b/isisd/isis_adjacency.h index 99d0c493b..8539b03d6 100644 --- a/isisd/isis_adjacency.h +++ b/isisd/isis_adjacency.h @@ -85,10 +85,8 @@ struct isis_adjacency struct nlpids nlpids; /* protocols spoken ... */ struct list *ipv4_addrs; struct in_addr router_address; -#ifdef HAVE_IPV6 struct list *ipv6_addrs; struct in6_addr router_address6; -#endif /* HAVE_IPV6 */ u_char prio[ISIS_LEVELS]; /* priorityOfNeighbour for DIS */ int circuit_t; /* from hello PDU hdr */ int level; /* level (1 or 2) */ diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index dfa756148..b138b8950 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -284,10 +284,8 @@ isis_circuit_del_addr (struct isis_circuit *circuit, struct prefix_ipv4 *ipv4, *ip = NULL; struct listnode *node; char buf[PREFIX2STR_BUFFER]; -#ifdef HAVE_IPV6 struct prefix_ipv6 *ipv6, *ip6 = NULL; int found = 0; -#endif /* HAVE_IPV6 */ if (connected->address->family == AF_INET) { @@ -321,7 +319,6 @@ isis_circuit_del_addr (struct isis_circuit *circuit, prefix_ipv4_free (ipv4); } -#ifdef HAVE_IPV6 if (connected->address->family == AF_INET6) { ipv6 = prefix_ipv6_new (); @@ -379,7 +376,6 @@ isis_circuit_del_addr (struct isis_circuit *circuit, prefix_ipv6_free (ipv6); } -#endif /* HAVE_IPV6 */ return; } @@ -467,10 +463,8 @@ isis_circuit_if_add (struct isis_circuit *circuit, struct interface *ifp) } circuit->ip_addrs = list_new (); -#ifdef HAVE_IPV6 circuit->ipv6_link = list_new (); circuit->ipv6_non_link = list_new (); -#endif /* HAVE_IPV6 */ for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, conn)) isis_circuit_add_addr (circuit, conn); @@ -497,7 +491,6 @@ isis_circuit_if_del (struct isis_circuit *circuit, struct interface *ifp) circuit->ip_addrs = NULL; } -#ifdef HAVE_IPV6 if (circuit->ipv6_link) { assert (listcount(circuit->ipv6_link) == 0); @@ -511,7 +504,6 @@ isis_circuit_if_del (struct isis_circuit *circuit, struct interface *ifp) list_delete (circuit->ipv6_non_link); circuit->ipv6_non_link = NULL; } -#endif /* HAVE_IPV6 */ circuit->circ_type = CIRCUIT_T_UNKNOWN; circuit->circuit_id = 0; @@ -857,13 +849,11 @@ circuit_update_nlpids (struct isis_circuit *circuit) circuit->nlpids.nlpids[0] = NLPID_IP; circuit->nlpids.count++; } -#ifdef HAVE_IPV6 if (circuit->ipv6_router) { circuit->nlpids.nlpids[circuit->nlpids.count] = NLPID_IPV6; circuit->nlpids.count++; } -#endif /* HAVE_IPV6 */ return; } @@ -1045,14 +1035,12 @@ isis_interface_config_write (struct vty *vty) vty_out (vty, " isis network point-to-point%s", VTY_NEWLINE); write++; } -#ifdef HAVE_IPV6 if (circuit->ipv6_router) { vty_out (vty, " ipv6 router isis %s%s", area->area_tag, VTY_NEWLINE); write++; } -#endif /* HAVE_IPV6 */ /* ISIS - circuit type */ if (circuit->is_type == IS_LEVEL_1) diff --git a/isisd/isis_circuit.h b/isisd/isis_circuit.h index 035e558c0..bb0dc0f98 100644 --- a/isisd/isis_circuit.h +++ b/isisd/isis_circuit.h @@ -124,11 +124,9 @@ struct isis_circuit int ip_router; /* Route IP ? */ int is_passive; /* Is Passive ? */ struct list *ip_addrs; /* our IP addresses */ -#ifdef HAVE_IPV6 int ipv6_router; /* Route IPv6 ? */ struct list *ipv6_link; /* our link local IPv6 addresses */ struct list *ipv6_non_link; /* our non-link local IPv6 addresses */ -#endif /* HAVE_IPV6 */ u_int16_t upadjcount[2]; #define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01 u_char flags; diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index dedf2a71d..0ece4c919 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -156,9 +156,7 @@ lsp_destroy (struct isis_lsp *lsp) } isis_spf_schedule (lsp->area, lsp->level); -#ifdef HAVE_IPV6 isis_spf_schedule6 (lsp->area, lsp->level); -#endif if (lsp->pdu) stream_free (lsp->pdu); @@ -427,9 +425,7 @@ lsp_inc_seqnum (struct isis_lsp *lsp, u_int32_t seq_num) ntohs (lsp->lsp_header->pdu_len) - 12, 12); isis_spf_schedule (lsp->area, lsp->level); -#ifdef HAVE_IPV6 isis_spf_schedule6 (lsp->area, lsp->level); -#endif return; } @@ -510,10 +506,8 @@ lsp_update_data (struct isis_lsp *lsp, struct stream *stream, expected |= TLVFLAG_IPV4_ADDR; expected |= TLVFLAG_IPV4_INT_REACHABILITY; expected |= TLVFLAG_IPV4_EXT_REACHABILITY; -#ifdef HAVE_IPV6 expected |= TLVFLAG_IPV6_ADDR; expected |= TLVFLAG_IPV6_REACHABILITY; -#endif /* HAVE_IPV6 */ retval = parse_tlvs (area->area_tag, STREAM_DATA (lsp->pdu) + ISIS_FIXED_HDR_LEN + ISIS_LSP_HDR_LEN, @@ -638,9 +632,7 @@ lsp_insert (struct isis_lsp *lsp, dict_t * lspdb) if (lsp->lsp_header->seq_num != 0) { isis_spf_schedule (lsp->area, lsp->level); -#ifdef HAVE_IPV6 isis_spf_schedule6 (lsp->area, lsp->level); -#endif } } @@ -840,11 +832,9 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost) struct ipv4_reachability *ipv4_reach; struct in_addr *ipv4_addr; struct te_ipv4_reachability *te_ipv4_reach; -#ifdef HAVE_IPV6 struct ipv6_reachability *ipv6_reach; struct in6_addr in6; u_char buff[BUFSIZ]; -#endif u_char LSPid[255]; u_char hostname[255]; u_char ipv4_reach_prefix[20]; @@ -953,7 +943,6 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost) } /* IPv6 tlv */ -#ifdef HAVE_IPV6 if (lsp->tlv_data.ipv6_reachs) for (ALL_LIST_ELEMENTS_RO (lsp->tlv_data.ipv6_reachs, lnode, ipv6_reach)) { @@ -971,7 +960,6 @@ lsp_print_detail (struct isis_lsp *lsp, struct vty *vty, char dynhost) ntohl (ipv6_reach->metric), buff, ipv6_reach->prefix_len, VTY_NEWLINE); } -#endif /* TE IS neighbor tlv */ if (lsp->tlv_data.te_is_neighs) @@ -1348,10 +1336,8 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area) struct ipv4_reachability *ipreach; struct te_ipv4_reachability *te_ipreach; struct isis_adjacency *nei; -#ifdef HAVE_IPV6 struct prefix_ipv6 *ipv6, ip6prefix; struct ipv6_reachability *ip6reach; -#endif /* HAVE_IPV6 */ struct tlvs tlv_data; struct isis_lsp *lsp0 = lsp; struct in_addr *routerid; @@ -1391,11 +1377,7 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area) tlv_add_area_addrs (lsp->tlv_data.area_addrs, lsp->pdu); /* Protocols Supported */ - if (area->ip_circuits > 0 -#ifdef HAVE_IPV6 - || area->ipv6_circuits > 0 -#endif /* HAVE_IPV6 */ - ) + if (area->ip_circuits > 0 || area->ipv6_circuits > 0) { lsp->tlv_data.nlpids = XCALLOC (MTYPE_ISIS_TLV, sizeof (struct nlpids)); lsp->tlv_data.nlpids->count = 0; @@ -1405,7 +1387,6 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area) lsp->tlv_data.nlpids->count++; lsp->tlv_data.nlpids->nlpids[0] = NLPID_IP; } -#ifdef HAVE_IPV6 if (area->ipv6_circuits > 0) { lsp_debug("ISIS (%s): Found IPv6 circuit, adding IPv6 to NLPIDs", area->area_tag); @@ -1413,7 +1394,6 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area) lsp->tlv_data.nlpids->nlpids[lsp->tlv_data.nlpids->count - 1] = NLPID_IPV6; } -#endif /* HAVE_IPV6 */ tlv_add_nlpid (lsp->tlv_data.nlpids, lsp->pdu); } @@ -1560,7 +1540,6 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area) } } -#ifdef HAVE_IPV6 /* * Add IPv6 reachability of this circuit */ @@ -1598,7 +1577,6 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area) listnode_add (tlv_data.ipv6_reachs, ip6reach); } } -#endif /* HAVE_IPV6 */ switch (circuit->circ_type) { @@ -1799,7 +1777,6 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area) lsp0, area, level); } -#ifdef HAVE_IPV6 while (tlv_data.ipv6_reachs && listcount (tlv_data.ipv6_reachs)) { if (lsp->tlv_data.ipv6_reachs == NULL) @@ -1812,7 +1789,6 @@ lsp_build (struct isis_lsp *lsp, struct isis_area *area) lsp = lsp_next_frag (LSP_FRAGMENT (lsp->lsp_header->lsp_id) + 1, lsp0, area, level); } -#endif /* HAVE_IPV6 */ while (tlv_data.is_neighs && listcount (tlv_data.is_neighs)) { diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 96e459a79..e111a17de 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -357,7 +357,6 @@ tlvs_to_adj_ipv4_addrs (struct tlvs *tlvs, struct isis_adjacency *adj) } } -#ifdef HAVE_IPV6 static void tlvs_to_adj_ipv6_addrs (struct tlvs *tlvs, struct isis_adjacency *adj) { @@ -381,7 +380,6 @@ tlvs_to_adj_ipv6_addrs (struct tlvs *tlvs, struct isis_adjacency *adj) } } -#endif /* HAVE_IPV6 */ /* * RECEIVE SIDE @@ -527,12 +525,6 @@ process_p2p_hello (struct isis_circuit *circuit) zlog_warn ("ISIS-Adj: IPv4 addresses present but no overlap " "in P2P IIH from %s\n", circuit->interface->name); } -#ifndef HAVE_IPV6 - else /* !(found & TLVFLAG_IPV4_ADDR) */ - zlog_warn ("ISIS-Adj: no IPv4 in P2P IIH from %s " - "(this isisd has no IPv6)\n", circuit->interface->name); - -#else if (found & TLVFLAG_IPV6_ADDR) { /* TBA: check that we have a linklocal ourselves? */ @@ -553,7 +545,6 @@ process_p2p_hello (struct isis_circuit *circuit) if (!(found & (TLVFLAG_IPV4_ADDR | TLVFLAG_IPV6_ADDR))) zlog_warn ("ISIS-Adj: neither IPv4 nor IPv6 addr in P2P IIH from %s\n", circuit->interface->name); -#endif if (!v6_usable && !v4_usable) { @@ -639,10 +630,8 @@ process_p2p_hello (struct isis_circuit *circuit) set_circuitparams_rmt_ipaddr (circuit->mtc, *ip_addr); } -#ifdef HAVE_IPV6 if (found & TLVFLAG_IPV6_ADDR) tlvs_to_adj_ipv6_addrs (&tlvs, adj); -#endif /* HAVE_IPV6 */ /* lets take care of the expiry */ THREAD_TIMER_OFF (adj->t_expire); @@ -1125,12 +1114,6 @@ process_lan_hello (int level, struct isis_circuit *circuit, const u_char *ssnpa) zlog_warn ("ISIS-Adj: IPv4 addresses present but no overlap " "in LAN IIH from %s\n", circuit->interface->name); } -#ifndef HAVE_IPV6 - else /* !(found & TLVFLAG_IPV4_ADDR) */ - zlog_warn ("ISIS-Adj: no IPv4 in LAN IIH from %s " - "(this isisd has no IPv6)\n", circuit->interface->name); - -#else if (found & TLVFLAG_IPV6_ADDR) { /* TBA: check that we have a linklocal ourselves? */ @@ -1151,7 +1134,6 @@ process_lan_hello (int level, struct isis_circuit *circuit, const u_char *ssnpa) if (!(found & (TLVFLAG_IPV4_ADDR | TLVFLAG_IPV6_ADDR))) zlog_warn ("ISIS-Adj: neither IPv4 nor IPv6 addr in LAN IIH from %s\n", circuit->interface->name); -#endif if (!v6_usable && !v4_usable) { @@ -1236,10 +1218,8 @@ process_lan_hello (int level, struct isis_circuit *circuit, const u_char *ssnpa) if (found & TLVFLAG_IPV4_ADDR) tlvs_to_adj_ipv4_addrs (&tlvs, adj); -#ifdef HAVE_IPV6 if (found & TLVFLAG_IPV6_ADDR) tlvs_to_adj_ipv6_addrs (&tlvs, adj); -#endif /* HAVE_IPV6 */ adj->circuit_t = hdr.circuit_t; @@ -2357,13 +2337,11 @@ send_hello (struct isis_circuit *circuit, int level) if (tlv_add_ip_addrs (circuit->ip_addrs, circuit->snd_stream)) return ISIS_WARNING; -#ifdef HAVE_IPV6 /* IPv6 Interface Address TLV */ if (circuit->ipv6_router && circuit->ipv6_link && listcount (circuit->ipv6_link) > 0) if (tlv_add_ipv6_addrs (circuit->ipv6_link, circuit->snd_stream)) return ISIS_WARNING; -#endif /* HAVE_IPV6 */ if (circuit->pad_hellos) if (tlv_add_padding (circuit->snd_stream)) diff --git a/isisd/isis_route.c b/isisd/isis_route.c index cc3ecba0d..b2b858feb 100644 --- a/isisd/isis_route.c +++ b/isisd/isis_route.c @@ -128,7 +128,6 @@ nexthops_print (struct list *nhs) } #endif /* EXTREME_DEBUG */ -#ifdef HAVE_IPV6 static struct isis_nexthop6 * isis_nexthop6_new (struct in6_addr *ip6, ifindex_t ifindex) { @@ -217,7 +216,6 @@ nexthops6_print (struct list *nhs6) nexthop6_print (nh6); } #endif /* EXTREME_DEBUG */ -#endif /* HAVE_IPV6 */ static void adjinfo2nexthop (struct list *nexthops, struct isis_adjacency *adj) @@ -242,7 +240,6 @@ adjinfo2nexthop (struct list *nexthops, struct isis_adjacency *adj) } } -#ifdef HAVE_IPV6 static void adjinfo2nexthop6 (struct list *nexthops6, struct isis_adjacency *adj) { @@ -265,7 +262,6 @@ adjinfo2nexthop6 (struct list *nexthops6, struct isis_adjacency *adj) } } } -#endif /* HAVE_IPV6 */ static struct isis_route_info * isis_route_info_new (struct prefix *prefix, uint32_t cost, uint32_t depth, @@ -291,7 +287,6 @@ isis_route_info_new (struct prefix *prefix, uint32_t cost, uint32_t depth, adjinfo2nexthop (rinfo->nexthops, adj); } } -#ifdef HAVE_IPV6 if (prefix->family == AF_INET6) { rinfo->nexthops6 = list_new (); @@ -307,8 +302,6 @@ isis_route_info_new (struct prefix *prefix, uint32_t cost, uint32_t depth, } } -#endif /* HAVE_IPV6 */ - rinfo->cost = cost; rinfo->depth = depth; @@ -324,13 +317,11 @@ isis_route_info_delete (struct isis_route_info *route_info) list_delete (route_info->nexthops); } -#ifdef HAVE_IPV6 if (route_info->nexthops6) { route_info->nexthops6->del = (void (*)(void *)) isis_nexthop6_delete; list_delete (route_info->nexthops6); } -#endif /* HAVE_IPV6 */ XFREE (MTYPE_ISIS_ROUTE_INFO, route_info); } @@ -353,9 +344,7 @@ isis_route_info_same (struct isis_route_info *new, { struct listnode *node; struct isis_nexthop *nexthop; -#ifdef HAVE_IPV6 struct isis_nexthop6 *nexthop6; -#endif /* HAVE_IPV6 */ if (!CHECK_FLAG (old->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED)) return 0; @@ -378,7 +367,6 @@ isis_route_info_same (struct isis_route_info *new, == 0) return 0; } -#ifdef HAVE_IPV6 else if (family == AF_INET6) { for (ALL_LIST_ELEMENTS_RO (new->nexthops6, node, nexthop6)) @@ -391,7 +379,6 @@ isis_route_info_same (struct isis_route_info *new, nexthop6->ifindex) == 0) return 0; } -#endif /* HAVE_IPV6 */ return 1; } @@ -414,10 +401,8 @@ isis_route_create (struct prefix *prefix, u_int32_t cost, u_int32_t depth, if (family == AF_INET) route_node = route_node_get (area->route_table[level - 1], prefix); -#ifdef HAVE_IPV6 else if (family == AF_INET6) route_node = route_node_get (area->route_table6[level - 1], prefix); -#endif /* HAVE_IPV6 */ else { isis_route_info_delete (rinfo_new); @@ -547,7 +532,6 @@ isis_route_validate_table (struct isis_area *area, struct route_table *table) drnode->info = NULL; } -#ifdef HAVE_IPV6 if (rnode->p.family == AF_INET6) { drnode = route_node_get (area->route_table6[0], &rnode->p); @@ -557,7 +541,6 @@ isis_route_validate_table (struct isis_area *area, struct route_table *table) if (drnode->info == rnode->info) drnode->info = NULL; } -#endif isis_route_delete (&rnode->p, table); } @@ -585,10 +568,8 @@ isis_route_validate_merge (struct isis_area *area, int family) if (family == AF_INET) table = area->route_table[0]; -#ifdef HAVE_IPV6 else if (family == AF_INET6) table = area->route_table6[0]; -#endif for (rnode = route_top (table); rnode; rnode = route_next (rnode)) { @@ -600,10 +581,8 @@ isis_route_validate_merge (struct isis_area *area, int family) if (family == AF_INET) table = area->route_table[1]; -#ifdef HAVE_IPV6 else if (family == AF_INET6) table = area->route_table6[1]; -#endif for (rnode = route_top (table); rnode; rnode = route_next (rnode)) { @@ -634,14 +613,12 @@ isis_route_validate (struct isis_area *area) else isis_route_validate_merge (area, AF_INET); -#ifdef HAVE_IPV6 if (area->is_type == IS_LEVEL_1) isis_route_validate_table (area, area->route_table6[0]); else if (area->is_type == IS_LEVEL_2) isis_route_validate_table (area, area->route_table6[1]); else isis_route_validate_merge (area, AF_INET6); -#endif if (!area->circuit_list) { return; diff --git a/isisd/isis_route.h b/isisd/isis_route.h index 0d2379cbe..de23070aa 100644 --- a/isisd/isis_route.h +++ b/isisd/isis_route.h @@ -25,7 +25,6 @@ #ifndef _ZEBRA_ISIS_ROUTE_H #define _ZEBRA_ISIS_ROUTE_H -#ifdef HAVE_IPV6 struct isis_nexthop6 { ifindex_t ifindex; @@ -33,7 +32,6 @@ struct isis_nexthop6 struct in6_addr router_address6; unsigned int lock; }; -#endif /* HAVE_IPV6 */ struct isis_nexthop { @@ -52,9 +50,7 @@ struct isis_route_info u_int32_t cost; u_int32_t depth; struct list *nexthops; -#ifdef HAVE_IPV6 struct list *nexthops6; -#endif /* HAVE_IPV6 */ }; struct isis_route_info *isis_route_create (struct prefix *prefix, diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 041f2ed3f..086f5b23d 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -139,14 +139,12 @@ vtype2string (enum vertextype vtype) case VTYPE_IPREACH_TE: return "IP TE"; break; -#ifdef HAVE_IPV6 case VTYPE_IP6REACH_INTERNAL: return "IP6 internal"; break; case VTYPE_IP6REACH_EXTERNAL: return "IP6 external"; break; -#endif /* HAVE_IPV6 */ default: return "UNKNOWN"; } @@ -170,10 +168,8 @@ vid2string (struct isis_vertex *vertex, char * buff, int size) case VTYPE_IPREACH_INTERNAL: case VTYPE_IPREACH_EXTERNAL: case VTYPE_IPREACH_TE: -#ifdef HAVE_IPV6 case VTYPE_IP6REACH_INTERNAL: case VTYPE_IP6REACH_EXTERNAL: -#endif /* HAVE_IPV6 */ prefix2str ((struct prefix *) &vertex->N.prefix, buff, size); break; default: @@ -205,10 +201,8 @@ isis_vertex_new (void *id, enum vertextype vtype) case VTYPE_IPREACH_INTERNAL: case VTYPE_IPREACH_EXTERNAL: case VTYPE_IPREACH_TE: -#ifdef HAVE_IPV6 case VTYPE_IP6REACH_INTERNAL: case VTYPE_IP6REACH_EXTERNAL: -#endif /* HAVE_IPV6 */ memcpy (&vertex->N.prefix, (struct prefix *) id, sizeof (struct prefix)); break; @@ -314,20 +308,16 @@ spftree_area_init (struct isis_area *area) { if (area->spftree[0] == NULL) area->spftree[0] = isis_spftree_new (area); -#ifdef HAVE_IPV6 if (area->spftree6[0] == NULL) area->spftree6[0] = isis_spftree_new (area); -#endif } if (area->is_type & IS_LEVEL_2) { if (area->spftree[1] == NULL) area->spftree[1] = isis_spftree_new (area); -#ifdef HAVE_IPV6 if (area->spftree6[1] == NULL) area->spftree6[1] = isis_spftree_new (area); -#endif } return; @@ -343,13 +333,11 @@ spftree_area_del (struct isis_area *area) isis_spftree_del (area->spftree[0]); area->spftree[0] = NULL; } -#ifdef HAVE_IPV6 if (area->spftree6[0]) { isis_spftree_del (area->spftree6[0]); area->spftree6[0] = NULL; } -#endif } if (area->is_type & IS_LEVEL_2) @@ -359,13 +347,11 @@ spftree_area_del (struct isis_area *area) isis_spftree_del (area->spftree[1]); area->spftree[1] = NULL; } -#ifdef HAVE_IPV6 if (area->spftree6[1] != NULL) { isis_spftree_del (area->spftree6[1]); area->spftree6[1] = NULL; } -#endif } return; @@ -378,20 +364,16 @@ spftree_area_adj_del (struct isis_area *area, struct isis_adjacency *adj) { if (area->spftree[0] != NULL) isis_spftree_adj_del (area->spftree[0], adj); -#ifdef HAVE_IPV6 if (area->spftree6[0] != NULL) isis_spftree_adj_del (area->spftree6[0], adj); -#endif } if (area->is_type & IS_LEVEL_2) { if (area->spftree[1] != NULL) isis_spftree_adj_del (area->spftree[1], adj); -#ifdef HAVE_IPV6 if (area->spftree6[1] != NULL) isis_spftree_adj_del (area->spftree6[1], adj); -#endif } return; @@ -475,10 +457,8 @@ isis_find_vertex (struct list *list, void *id, enum vertextype vtype) case VTYPE_IPREACH_INTERNAL: case VTYPE_IPREACH_EXTERNAL: case VTYPE_IPREACH_TE: -#ifdef HAVE_IPV6 case VTYPE_IP6REACH_INTERNAL: case VTYPE_IP6REACH_EXTERNAL: -#endif /* HAVE_IPV6 */ p1 = (struct prefix *) id; p2 = (struct prefix *) &vertex->N.id; if (p1->family == p2->family && p1->prefixlen == p2->prefixlen && @@ -718,9 +698,7 @@ isis_spf_process_lsp (struct isis_spftree *spftree, struct isis_lsp *lsp, struct te_ipv4_reachability *te_ipv4_reach; enum vertextype vtype; struct prefix prefix; -#ifdef HAVE_IPV6 struct ipv6_reachability *ip6reach; -#endif /* HAVE_IPV6 */ static const u_char null_sysid[ISIS_SYS_ID_LEN]; if (!speaks (lsp->tlv_data.nlpids, family)) @@ -820,7 +798,6 @@ lspfragloop: family, parent); } } -#ifdef HAVE_IPV6 if (family == AF_INET6 && lsp->tlv_data.ipv6_reachs) { prefix.family = AF_INET6; @@ -839,7 +816,6 @@ lspfragloop: family, parent); } } -#endif /* HAVE_IPV6 */ if (fragnode == NULL) fragnode = listhead (lsp->lspu.frags); @@ -939,9 +915,7 @@ isis_spf_preload_tent (struct isis_spftree *spftree, int level, int retval = ISIS_OK; u_char lsp_id[ISIS_SYS_ID_LEN + 2]; static u_char null_lsp_id[ISIS_SYS_ID_LEN + 2]; -#ifdef HAVE_IPV6 struct prefix_ipv6 *ipv6; -#endif /* HAVE_IPV6 */ for (ALL_LIST_ELEMENTS_RO (spftree->area->circuit_list, cnode, circuit)) { @@ -951,10 +925,8 @@ isis_spf_preload_tent (struct isis_spftree *spftree, int level, continue; if (family == AF_INET && !circuit->ip_router) continue; -#ifdef HAVE_IPV6 if (family == AF_INET6 && !circuit->ipv6_router) continue; -#endif /* HAVE_IPV6 */ /* * Add IP(v6) addresses of this circuit */ @@ -970,7 +942,6 @@ isis_spf_preload_tent (struct isis_spftree *spftree, int level, NULL, 0, family, parent); } } -#ifdef HAVE_IPV6 if (family == AF_INET6) { prefix.family = AF_INET6; @@ -983,7 +954,6 @@ isis_spf_preload_tent (struct isis_spftree *spftree, int level, &prefix, NULL, 0, family, parent); } } -#endif /* HAVE_IPV6 */ if (circuit->circ_type == CIRCUIT_T_BROADCAST) { /* @@ -1185,20 +1155,16 @@ isis_run_spf (struct isis_area *area, int level, int family, u_char *sysid) if (family == AF_INET) spftree = area->spftree[level - 1]; -#ifdef HAVE_IPV6 else if (family == AF_INET6) spftree = area->spftree6[level - 1]; -#endif assert (spftree); assert (sysid); /* Make all routes in current route table inactive. */ if (family == AF_INET) table = area->route_table[level - 1]; -#ifdef HAVE_IPV6 else if (family == AF_INET6) table = area->route_table6[level - 1]; -#endif isis_route_invalidate_table (area, table); @@ -1382,7 +1348,6 @@ isis_spf_schedule (struct isis_area *area, int level) return ISIS_OK; } -#ifdef HAVE_IPV6 static int isis_run_spf6_l1 (struct thread *thread) { @@ -1479,7 +1444,6 @@ isis_spf_schedule6 (struct isis_area *area, int level) return retval; } -#endif static void isis_print_paths (struct vty *vty, struct list *paths, u_char *root_sysid) @@ -1569,7 +1533,6 @@ DEFUN (show_isis_topology, isis_print_paths (vty, area->spftree[level]->paths, isis->sysid); vty_out (vty, "%s", VTY_NEWLINE); } -#ifdef HAVE_IPV6 if (area->ipv6_circuits > 0 && area->spftree6[level] && area->spftree6[level]->paths->count > 0) { @@ -1579,7 +1542,6 @@ DEFUN (show_isis_topology, isis_print_paths (vty, area->spftree6[level]->paths, isis->sysid); vty_out (vty, "%s", VTY_NEWLINE); } -#endif /* HAVE_IPV6 */ } vty_out (vty, "%s", VTY_NEWLINE); @@ -1615,7 +1577,6 @@ DEFUN (show_isis_topology_l1, isis_print_paths (vty, area->spftree[0]->paths, isis->sysid); vty_out (vty, "%s", VTY_NEWLINE); } -#ifdef HAVE_IPV6 if (area->ipv6_circuits > 0 && area->spftree6[0] && area->spftree6[0]->paths->count > 0) { @@ -1624,7 +1585,6 @@ DEFUN (show_isis_topology_l1, isis_print_paths (vty, area->spftree6[0]->paths, isis->sysid); vty_out (vty, "%s", VTY_NEWLINE); } -#endif /* HAVE_IPV6 */ vty_out (vty, "%s", VTY_NEWLINE); } @@ -1658,7 +1618,6 @@ DEFUN (show_isis_topology_l2, isis_print_paths (vty, area->spftree[1]->paths, isis->sysid); vty_out (vty, "%s", VTY_NEWLINE); } -#ifdef HAVE_IPV6 if (area->ipv6_circuits > 0 && area->spftree6[1] && area->spftree6[1]->paths->count > 0) { @@ -1667,7 +1626,6 @@ DEFUN (show_isis_topology_l2, isis_print_paths (vty, area->spftree6[1]->paths, isis->sysid); vty_out (vty, "%s", VTY_NEWLINE); } -#endif /* HAVE_IPV6 */ vty_out (vty, "%s", VTY_NEWLINE); } diff --git a/isisd/isis_spf.h b/isisd/isis_spf.h index aa543b705..0e42cac81 100644 --- a/isisd/isis_spf.h +++ b/isisd/isis_spf.h @@ -33,12 +33,9 @@ enum vertextype VTYPE_ES, VTYPE_IPREACH_INTERNAL, VTYPE_IPREACH_EXTERNAL, - VTYPE_IPREACH_TE -#ifdef HAVE_IPV6 - , + VTYPE_IPREACH_TE, VTYPE_IP6REACH_INTERNAL, VTYPE_IP6REACH_EXTERNAL -#endif /* HAVE_IPV6 */ }; /* @@ -83,7 +80,5 @@ void spftree_area_adj_del (struct isis_area *area, struct isis_adjacency *adj); int isis_spf_schedule (struct isis_area *area, int level); void isis_spf_cmds_init (void); -#ifdef HAVE_IPV6 int isis_spf_schedule6 (struct isis_area *area, int level); -#endif #endif /* _ZEBRA_ISIS_SPF_H */ diff --git a/isisd/isis_tlv.c b/isisd/isis_tlv.c index 1d29d7828..c1526af31 100644 --- a/isisd/isis_tlv.c +++ b/isisd/isis_tlv.c @@ -81,12 +81,10 @@ free_tlvs (struct tlvs *tlvs) list_delete (tlvs->ipv4_ext_reachs); if (tlvs->te_ipv4_reachs) list_delete (tlvs->te_ipv4_reachs); -#ifdef HAVE_IPV6 if (tlvs->ipv6_addrs) list_delete (tlvs->ipv6_addrs); if (tlvs->ipv6_reachs) list_delete (tlvs->ipv6_reachs); -#endif /* HAVE_IPV6 */ memset (tlvs, 0, sizeof (struct tlvs)); @@ -111,11 +109,9 @@ parse_tlvs (char *areatag, u_char * stream, int size, u_int32_t * expected, struct in_addr *ipv4_addr; struct ipv4_reachability *ipv4_reach; struct te_ipv4_reachability *te_ipv4_reach; -#ifdef HAVE_IPV6 struct in6_addr *ipv6_addr; struct ipv6_reachability *ipv6_reach; int prefix_octets; -#endif /* HAVE_IPV6 */ int value_len, retval = ISIS_OK; u_char *start = stream, *pnt = stream, *endpnt; @@ -626,7 +622,6 @@ parse_tlvs (char *areatag, u_char * stream, int size, u_int32_t * expected, pnt = endpnt; break; -#ifdef HAVE_IPV6 case IPV6_ADDR: /* +-------+-------+-------+-------+-------+-------+-------+-------+ * + IP version 6 address + 16 @@ -696,7 +691,6 @@ parse_tlvs (char *areatag, u_char * stream, int size, u_int32_t * expected, pnt = endpnt; break; -#endif /* HAVE_IPV6 */ case WAY3_HELLO: /* +---------------------------------------------------------------+ @@ -1095,7 +1089,6 @@ tlv_add_te_ipv4_reachs (struct list *te_ipv4_reachs, struct stream *stream) return add_tlv (TE_IPV4_REACHABILITY, pos - value, value, stream); } -#ifdef HAVE_IPV6 int tlv_add_ipv6_addrs (struct list *ipv6_addrs, struct stream *stream) { @@ -1152,7 +1145,6 @@ tlv_add_ipv6_reachs (struct list *ipv6_reachs, struct stream *stream) return add_tlv (IPV6_REACHABILITY, pos - value, value, stream); } -#endif /* HAVE_IPV6 */ int tlv_add_padding (struct stream *stream) diff --git a/isisd/isis_tlv.h b/isisd/isis_tlv.h index 5a39d564d..bf2d51daa 100644 --- a/isisd/isis_tlv.h +++ b/isisd/isis_tlv.h @@ -231,7 +231,6 @@ struct idrp_info u_char *value; }; -#ifdef HAVE_IPV6 struct ipv6_reachability { u_int32_t metric; @@ -250,7 +249,6 @@ struct ipv6_reachability #define DISTRIBUTION_EXTERNAL 0x40 #define CTRL_INFO_SUBTLVS 0x20 -#endif /* HAVE_IPV6 */ /* * Pointer to each tlv type, filled by parse_tlvs() @@ -272,10 +270,8 @@ struct tlvs struct list *ipv4_int_reachs; struct list *ipv4_ext_reachs; struct list *te_ipv4_reachs; -#ifdef HAVE_IPV6 struct list *ipv6_addrs; struct list *ipv6_reachs; -#endif struct isis_passwd auth_info; }; @@ -330,10 +326,8 @@ int tlv_add_lsp_entries (struct list *lsps, struct stream *stream); int tlv_add_ipv4_int_reachs (struct list *ipv4_reachs, struct stream *stream); int tlv_add_ipv4_ext_reachs (struct list *ipv4_reachs, struct stream *stream); int tlv_add_te_ipv4_reachs (struct list *te_ipv4_reachs, struct stream *stream); -#ifdef HAVE_IPV6 int tlv_add_ipv6_addrs (struct list *ipv6_addrs, struct stream *stream); int tlv_add_ipv6_reachs (struct list *ipv6_reachs, struct stream *stream); -#endif /* HAVE_IPV6 */ int tlv_add_padding (struct stream *stream); diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index 646c5fa88..dfb9b4d7a 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -187,10 +187,8 @@ isis_zebra_if_address_add (int command, struct zclient *zclient, #ifdef EXTREME_DEBUG if (p->family == AF_INET) zlog_debug ("connected IP address %s", buf); -#ifdef HAVE_IPV6 if (p->family == AF_INET6) zlog_debug ("connected IPv6 address %s", buf); -#endif /* HAVE_IPV6 */ #endif /* EXTREME_DEBUG */ if (if_is_operative (c->ifp)) isis_circuit_add_addr (circuit_scan_by_ifp (c->ifp), c); @@ -223,10 +221,8 @@ isis_zebra_if_address_del (int command, struct zclient *client, if (p->family == AF_INET) zlog_debug ("disconnected IP address %s", buf); -#ifdef HAVE_IPV6 if (p->family == AF_INET6) zlog_debug ("disconnected IPv6 address %s", buf); -#endif /* HAVE_IPV6 */ #endif /* EXTREME_DEBUG */ if (if_is_operative (ifp)) @@ -352,7 +348,6 @@ isis_zebra_route_del_ipv4 (struct prefix *prefix, return; } -#ifdef HAVE_IPV6 static void isis_zebra_route_add_ipv6 (struct prefix *prefix, struct isis_route_info *route_info) @@ -518,8 +513,6 @@ isis_zebra_route_del_ipv6 (struct prefix *prefix, XFREE (MTYPE_ISIS_TMP, ifindex_list); } -#endif /* HAVE_IPV6 */ - void isis_zebra_route_update (struct prefix *prefix, struct isis_route_info *route_info) @@ -535,19 +528,15 @@ isis_zebra_route_update (struct prefix *prefix, { if (prefix->family == AF_INET) isis_zebra_route_add_ipv4 (prefix, route_info); -#ifdef HAVE_IPV6 else if (prefix->family == AF_INET6) isis_zebra_route_add_ipv6 (prefix, route_info); -#endif /* HAVE_IPV6 */ } else { if (prefix->family == AF_INET) isis_zebra_route_del_ipv4 (prefix, route_info); -#ifdef HAVE_IPV6 else if (prefix->family == AF_INET6) isis_zebra_route_del_ipv6 (prefix, route_info); -#endif /* HAVE_IPV6 */ } return; } @@ -709,10 +698,8 @@ isis_zebra_init (struct thread_master *master) zclient->interface_link_params = isis_zebra_link_params; zclient->redistribute_route_ipv4_add = isis_zebra_read_ipv4; zclient->redistribute_route_ipv4_del = isis_zebra_read_ipv4; -#ifdef HAVE_IPV6 zclient->redistribute_route_ipv6_add = isis_zebra_read_ipv6; zclient->redistribute_route_ipv6_del = isis_zebra_read_ipv6; -#endif /* HAVE_IPV6 */ return; } diff --git a/isisd/isisd.c b/isisd/isisd.c index 1d4dab4fd..9bef25088 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -89,9 +89,7 @@ isis_new (unsigned long process_id) isis->init_circ_list = list_new (); isis->uptime = time (NULL); isis->nexthops = list_new (); -#ifdef HAVE_IPV6 isis->nexthops6 = list_new (); -#endif /* HAVE_IPV6 */ dyn_cache_init (); /* * uncomment the next line for full debugs @@ -124,17 +122,13 @@ isis_area_create (const char *area_tag) { area->lspdb[0] = lsp_db_init (); area->route_table[0] = route_table_init (); -#ifdef HAVE_IPV6 area->route_table6[0] = route_table_init (); -#endif /* HAVE_IPV6 */ } if (area->is_type & IS_LEVEL_2) { area->lspdb[1] = lsp_db_init (); area->route_table[1] = route_table_init (); -#ifdef HAVE_IPV6 area->route_table6[1] = route_table_init (); -#endif /* HAVE_IPV6 */ } spftree_area_init (area); @@ -231,9 +225,7 @@ isis_area_destroy (struct vty *vty, const char *area_tag) for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit)) { circuit->ip_router = 0; -#ifdef HAVE_IPV6 circuit->ipv6_router = 0; -#endif isis_csm_state_change (ISIS_DISABLE, circuit, area); } list_delete (area->circuit_list); @@ -267,7 +259,6 @@ isis_area_destroy (struct vty *vty, const char *area_tag) route_table_finish (area->route_table[1]); area->route_table[1] = NULL; } -#ifdef HAVE_IPV6 if (area->route_table6[0]) { route_table_finish (area->route_table6[0]); @@ -278,7 +269,6 @@ isis_area_destroy (struct vty *vty, const char *area_tag) route_table_finish (area->route_table6[1]); area->route_table6[1] = NULL; } -#endif /* HAVE_IPV6 */ isis_redist_area_finish(area); @@ -1355,7 +1345,6 @@ DEFUN (show_isis_summary, vty_out (vty, " run count : %d%s", spftree->runcount, VTY_NEWLINE); -#ifdef HAVE_IPV6 spftree = area->spftree6[level - 1]; if (spftree->pending) vty_out (vty, " IPv6 SPF: (pending)%s", VTY_NEWLINE); @@ -1374,7 +1363,6 @@ DEFUN (show_isis_summary, vty_out (vty, " run count : %d%s", spftree->runcount, VTY_NEWLINE); -#endif } } vty_out (vty, "%s", VTY_NEWLINE); @@ -1658,25 +1646,21 @@ area_resign_level (struct isis_area *area, int level) isis_spftree_del (area->spftree[level - 1]); area->spftree[level - 1] = NULL; } -#ifdef HAVE_IPV6 if (area->spftree6[level - 1]) { isis_spftree_del (area->spftree6[level - 1]); area->spftree6[level - 1] = NULL; } -#endif if (area->route_table[level - 1]) { route_table_finish (area->route_table[level - 1]); area->route_table[level - 1] = NULL; } -#ifdef HAVE_IPV6 if (area->route_table6[level - 1]) { route_table_finish (area->route_table6[level - 1]); area->route_table6[level - 1] = NULL; } -#endif /* HAVE_IPV6 */ sched_debug("ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.", area->area_tag, level); @@ -1707,10 +1691,8 @@ isis_area_is_type_set(struct isis_area *area, int is_type) area->lspdb[1] = lsp_db_init (); if (area->route_table[1] == NULL) area->route_table[1] = route_table_init (); -#ifdef HAVE_IPV6 if (area->route_table6[1] == NULL) area->route_table6[1] = route_table_init (); -#endif /* HAVE_IPV6 */ break; case IS_LEVEL_1_AND_2: @@ -1728,10 +1710,8 @@ isis_area_is_type_set(struct isis_area *area, int is_type) area->lspdb[0] = lsp_db_init (); if (area->route_table[0] == NULL) area->route_table[0] = route_table_init (); -#ifdef HAVE_IPV6 if (area->route_table6[0] == NULL) area->route_table6[0] = route_table_init (); -#endif /* HAVE_IPV6 */ break; default: diff --git a/isisd/isisd.h b/isisd/isisd.h index f7dc0efe2..efbfafc5f 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -48,9 +48,7 @@ struct isis struct list *area_list; /* list of IS-IS areas */ struct list *init_circ_list; struct list *nexthops; /* IPv4 next hops from this IS */ -#ifdef HAVE_IPV6 struct list *nexthops6; /* IPv6 next hops from this IS */ -#endif /* HAVE_IPV6 */ u_char max_area_addrs; /* maximumAreaAdresses */ struct area_addr *man_area_addrs; /* manualAreaAddresses */ u_int32_t debugs; /* bitmap for debug */ @@ -71,10 +69,8 @@ struct isis_area dict_t *lspdb[ISIS_LEVELS]; /* link-state dbs */ struct isis_spftree *spftree[ISIS_LEVELS]; /* The v4 SPTs */ struct route_table *route_table[ISIS_LEVELS]; /* IPv4 routes */ -#ifdef HAVE_IPV6 struct isis_spftree *spftree6[ISIS_LEVELS]; /* The v6 SPTs */ struct route_table *route_table6[ISIS_LEVELS]; /* IPv6 routes */ -#endif #define DEFAULT_LSP_MTU 1497 unsigned int lsp_mtu; /* Size of LSPs to generate */ struct list *circuit_list; /* IS-IS circuits */ @@ -124,9 +120,7 @@ struct isis_area int ip_circuits; /* logging adjacency changes? */ u_char log_adj_changes; -#ifdef HAVE_IPV6 int ipv6_circuits; -#endif /* HAVE_IPV6 */ /* Counters */ u_int32_t circuit_state_changes; struct isis_redist redist_settings[REDIST_PROTOCOL_COUNT] @@ -179,11 +179,9 @@ bfd_peer_sendmsg (struct zclient *zclient, struct bfd_info *bfd_info, case AF_INET: stream_put_in_addr (s, (struct in_addr *)dst_ip); break; -#ifdef HAVE_IPV6 case AF_INET6: stream_put(s, dst_ip, 16); break; -#endif default: break; } @@ -207,11 +205,9 @@ bfd_peer_sendmsg (struct zclient *zclient, struct bfd_info *bfd_info, case AF_INET: stream_put_in_addr (s, (struct in_addr *) src_ip); break; - #ifdef HAVE_IPV6 case AF_INET6: stream_put(s, src_ip, 16); break; - #endif default: break; } @@ -221,13 +217,11 @@ bfd_peer_sendmsg (struct zclient *zclient, struct bfd_info *bfd_info, else { stream_putc(s, 0); -#ifdef HAVE_IPV6 if ((family == AF_INET6) && (src_ip)) { stream_putw(s, family); stream_put(s, src_ip, 16); } -#endif if (if_name) { len = strlen(if_name); diff --git a/lib/filter.c b/lib/filter.c index 072d3ddc2..cd17a562f 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -105,7 +105,6 @@ static struct access_master access_master_ipv4 = NULL, }; -#ifdef HAVE_IPV6 /* Static structure for IPv6 access_list's master. */ static struct access_master access_master_ipv6 = { @@ -114,17 +113,14 @@ static struct access_master access_master_ipv6 = NULL, NULL, }; -#endif /* HAVE_IPV6 */ static struct access_master * access_master_get (afi_t afi) { if (afi == AFI_IP) return &access_master_ipv4; -#ifdef HAVE_IPV6 else if (afi == AFI_IP6) return &access_master_ipv6; -#endif /* HAVE_IPV6 */ return NULL; } @@ -434,9 +430,7 @@ void access_list_add_hook (void (*func) (struct access_list *access)) { access_master_ipv4.add_hook = func; -#ifdef HAVE_IPV6 access_master_ipv6.add_hook = func; -#endif /* HAVE_IPV6 */ } /* Delete hook function. */ @@ -444,9 +438,7 @@ void access_list_delete_hook (void (*func) (struct access_list *access)) { access_master_ipv4.delete_hook = func; -#ifdef HAVE_IPV6 access_master_ipv6.delete_hook = func; -#endif /* HAVE_IPV6 */ } /* Add new filter to the end of specified access_list. */ @@ -1289,7 +1281,6 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str, return CMD_WARNING; } } -#ifdef HAVE_IPV6 else if (afi == AFI_IP6) { ret = str2prefix_ipv6 (prefix_str, (struct prefix_ipv6 *) &p); @@ -1300,7 +1291,6 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str, return CMD_WARNING; } } -#endif /* HAVE_IPV6 */ else return CMD_WARNING; @@ -1530,7 +1520,6 @@ DEFUN (no_access_list_remark_comment, } -#ifdef HAVE_IPV6 DEFUN (ipv6_access_list, ipv6_access_list_cmd, "ipv6 access-list WORD <deny|permit> X:X::X:X/M", @@ -1716,8 +1705,6 @@ DEFUN (no_ipv6_access_list_remark_comment, { return no_ipv6_access_list_remark (self, vty, argc, argv); } - -#endif /* HAVE_IPV6 */ void config_write_access_zebra (struct vty *, struct filter *); void config_write_access_cisco (struct vty *, struct filter *); @@ -1855,7 +1842,6 @@ DEFUN (show_ip_access_list_name, return filter_show (vty, argv[idx_acl]->arg, AFI_IP); } -#ifdef HAVE_IPV6 DEFUN (show_ipv6_access_list, show_ipv6_access_list_cmd, "show ipv6 access-list", @@ -1877,7 +1863,6 @@ DEFUN (show_ipv6_access_list_name, int idx_word = 3; return filter_show (vty, argv[idx_word]->arg, AFI_IP6); } -#endif /* HAVE_IPV6 */ void config_write_access_cisco (struct vty *vty, struct filter *mfilter) @@ -2109,7 +2094,6 @@ access_list_init_ipv4 (void) install_element (CONFIG_NODE, &no_access_list_remark_comment_cmd); } -#ifdef HAVE_IPV6 static struct cmd_node access_ipv6_node = { ACCESS_IPV6_NODE, @@ -2172,22 +2156,17 @@ access_list_init_ipv6 (void) install_element (CONFIG_NODE, &no_ipv6_access_list_remark_cmd); install_element (CONFIG_NODE, &no_ipv6_access_list_remark_comment_cmd); } -#endif /* HAVE_IPV6 */ void access_list_init () { access_list_init_ipv4 (); -#ifdef HAVE_IPV6 access_list_init_ipv6(); -#endif /* HAVE_IPV6 */ } void access_list_reset () { access_list_reset_ipv4 (); -#ifdef HAVE_IPV6 access_list_reset_ipv6(); -#endif /* HAVE_IPV6 */ } @@ -1019,11 +1019,9 @@ connected_same_prefix (struct prefix *p1, struct prefix *p2) if (p1->family == AF_INET && IPV4_ADDR_SAME (&p1->u.prefix4, &p2->u.prefix4)) return 1; -#ifdef HAVE_IPV6 if (p1->family == AF_INET6 && IPV6_ADDR_SAME (&p1->u.prefix6, &p2->u.prefix6)) return 1; -#endif /* HAVE_IPV6 */ } return 0; } diff --git a/lib/plist.c b/lib/plist.c index 1f5e595fd..279c85d6d 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -103,7 +103,6 @@ static struct prefix_master prefix_master_ipv4 = PLC_MAXLEVELV4, }; -#ifdef HAVE_IPV6 /* Static structure of IPv6 prefix-list's master. */ static struct prefix_master prefix_master_ipv6 = { @@ -115,7 +114,6 @@ static struct prefix_master prefix_master_ipv6 = NULL, PLC_MAXLEVELV6, }; -#endif /* HAVE_IPV6*/ /* Static structure of BGP ORF prefix_list's master. */ static struct prefix_master prefix_master_orf_v4 = @@ -408,9 +406,7 @@ void prefix_list_add_hook (void (*func) (struct prefix_list *plist)) { prefix_master_ipv4.add_hook = func; -#ifdef HAVE_IPV6 prefix_master_ipv6.add_hook = func; -#endif /* HAVE_IPV6 */ } /* Delete hook function. */ @@ -418,9 +414,7 @@ void prefix_list_delete_hook (void (*func) (struct prefix_list *plist)) { prefix_master_ipv4.delete_hook = func; -#ifdef HAVE_IPV6 prefix_master_ipv6.delete_hook = func; -#endif /* HAVE_IPVt6 */ } /* Calculate new sequential number. */ @@ -1102,7 +1096,6 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, return CMD_WARNING; } } -#ifdef HAVE_IPV6 else if (afi == AFI_IP6) { if (strncmp ("any", prefix, strlen (prefix)) == 0) @@ -1120,7 +1113,6 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, return CMD_WARNING; } } -#endif /* HAVE_IPV6 */ /* Lookup prefix entry. */ pentry = prefix_list_entry_lookup(plist, &p, type, seqnum, lenum, genum); @@ -2128,7 +2120,6 @@ DEFUN (clear_ip_prefix_list_name_prefix, return vty_clear_prefix_list (vty, AFI_IP, argv[idx_word]->arg, argv[idx_ipv4_prefixlen]->arg); } -#ifdef HAVE_IPV6 DEFUN (ipv6_prefix_list, ipv6_prefix_list_cmd, "ipv6 prefix-list WORD <deny|permit> <X:X::X:X/M|any>", @@ -2839,7 +2830,6 @@ DEFUN (clear_ipv6_prefix_list_name_prefix, int idx_ipv6_prefixlen = 4; return vty_clear_prefix_list (vty, AFI_IP6, argv[idx_word]->arg, argv[idx_ipv6_prefixlen]->arg); } -#endif /* HAVE_IPV6 */ /* Configuration write function. */ static int @@ -3214,7 +3204,6 @@ prefix_list_init_ipv4 (void) install_element (ENABLE_NODE, &clear_ip_prefix_list_name_prefix_cmd); } -#ifdef HAVE_IPV6 /* Prefix-list node. */ static struct cmd_node prefix_ipv6_node = { @@ -3279,15 +3268,12 @@ prefix_list_init_ipv6 (void) install_element (ENABLE_NODE, &clear_ipv6_prefix_list_name_cmd); install_element (ENABLE_NODE, &clear_ipv6_prefix_list_name_prefix_cmd); } -#endif /* HAVE_IPV6 */ void prefix_list_init () { prefix_list_init_ipv4 (); -#ifdef HAVE_IPV6 prefix_list_init_ipv6 (); -#endif /* HAVE_IPV6 */ } void diff --git a/lib/prefix.c b/lib/prefix.c index 84a04c530..828959378 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -207,10 +207,8 @@ afi2family (afi_t afi) { if (afi == AFI_IP) return AF_INET; -#ifdef HAVE_IPV6 else if (afi == AFI_IP6) return AF_INET6; -#endif /* HAVE_IPV6 */ else if (afi == AFI_ETHER) return AF_ETHERNET; return 0; @@ -221,10 +219,8 @@ family2afi (int family) { if (family == AF_INET) return AFI_IP; -#ifdef HAVE_IPV6 else if (family == AF_INET6) return AFI_IP6; -#endif /* HAVE_IPV6 */ else if (family == AF_ETHERNET) return AFI_ETHER; return 0; @@ -302,10 +298,8 @@ prefix_copy (struct prefix *dest, const struct prefix *src) if (src->family == AF_INET) dest->u.prefix4 = src->u.prefix4; -#ifdef HAVE_IPV6 else if (src->family == AF_INET6) dest->u.prefix6 = src->u.prefix6; -#endif /* HAVE_IPV6 */ else if (src->family == AF_UNSPEC) { dest->u.lp.id = src->u.lp.id; @@ -345,11 +339,9 @@ prefix_same (const struct prefix *p1, const struct prefix *p2) if (p1->family == AF_INET) if (IPV4_ADDR_SAME (&p1->u.prefix4.s_addr, &p2->u.prefix4.s_addr)) return 1; -#ifdef HAVE_IPV6 if (p1->family == AF_INET6 ) if (IPV6_ADDR_SAME (&p1->u.prefix6.s6_addr, &p2->u.prefix6.s6_addr)) return 1; -#endif /* HAVE_IPV6 */ if (p1->family == AF_ETHERNET) { if (!memcmp(p1->u.prefix_eth.octet, p2->u.prefix_eth.octet, ETHER_ADDR_LEN)) return 1; @@ -414,10 +406,8 @@ prefix_common_bits (const struct prefix *p1, const struct prefix *p2) if (p1->family == AF_INET) length = IPV4_MAX_BYTELEN; -#ifdef HAVE_IPV6 if (p1->family == AF_INET6) length = IPV6_MAX_BYTELEN; -#endif if (p1->family != p2->family || !length) return -1; @@ -441,10 +431,8 @@ prefix_family_str (const struct prefix *p) { if (p->family == AF_INET) return "inet"; -#ifdef HAVE_IPV6 if (p->family == AF_INET6) return "inet6"; -#endif /* HAVE_IPV6 */ if (p->family == AF_ETHERNET) return "ether"; return "unspec"; @@ -617,8 +605,6 @@ prefix_ipv4_any (const struct prefix_ipv4 *p) return (p->prefix.s_addr == 0 && p->prefixlen == 0); } -#ifdef HAVE_IPV6 - /* Allocate a new ip version 6 route */ struct prefix_ipv6 * prefix_ipv6_new (void) @@ -749,7 +735,6 @@ str2in6_addr (const char *str, struct in6_addr *addr) addr->s6_addr[i] = x & 0xff; } } -#endif /* HAVE_IPV6 */ void apply_mask (struct prefix *p) @@ -759,11 +744,9 @@ apply_mask (struct prefix *p) case AF_INET: apply_mask_ipv4 ((struct prefix_ipv4 *)p); break; -#ifdef HAVE_IPV6 case AF_INET6: apply_mask_ipv6 ((struct prefix_ipv6 *)p); break; -#endif /* HAVE_IPV6 */ default: break; } @@ -786,7 +769,6 @@ sockunion2prefix (const union sockunion *dest, p->prefixlen = ip_masklen (mask->sin.sin_addr); return (struct prefix *) p; } -#ifdef HAVE_IPV6 if (dest->sa.sa_family == AF_INET6) { struct prefix_ipv6 *p; @@ -797,7 +779,6 @@ sockunion2prefix (const union sockunion *dest, memcpy (&p->prefix, &dest->sin6.sin6_addr, sizeof (struct in6_addr)); return (struct prefix *) p; } -#endif /* HAVE_IPV6 */ return NULL; } @@ -815,7 +796,6 @@ sockunion2hostprefix (const union sockunion *su, struct prefix *prefix) p->prefixlen = IPV4_MAX_BITLEN; return (struct prefix *) p; } -#ifdef HAVE_IPV6 if (su->sa.sa_family == AF_INET6) { struct prefix_ipv6 *p; @@ -826,7 +806,6 @@ sockunion2hostprefix (const union sockunion *su, struct prefix *prefix) memcpy (&p->prefix, &su->sin6.sin6_addr, sizeof (struct in6_addr)); return (struct prefix *) p; } -#endif /* HAVE_IPV6 */ return NULL; } @@ -838,10 +817,8 @@ prefix2sockunion (const struct prefix *p, union sockunion *su) su->sa.sa_family = p->family; if (p->family == AF_INET) su->sin.sin_addr = p->u.prefix4; -#ifdef HAVE_IPV6 if (p->family == AF_INET6) memcpy (&su->sin6.sin6_addr, &p->u.prefix6, sizeof (struct in6_addr)); -#endif /* HAVE_IPV6 */ } int @@ -852,11 +829,9 @@ prefix_blen (const struct prefix *p) case AF_INET: return IPV4_MAX_BYTELEN; break; -#ifdef HAVE_IPV6 case AF_INET6: return IPV6_MAX_BYTELEN; break; -#endif /* HAVE_IPV6 */ case AF_ETHERNET: return ETHER_ADDR_LEN; } @@ -874,12 +849,10 @@ str2prefix (const char *str, struct prefix *p) if (ret) return ret; -#ifdef HAVE_IPV6 /* Next we try to convert string to struct prefix_ipv6. */ ret = str2prefix_ipv6 (str, (struct prefix_ipv6 *) p); if (ret) return ret; -#endif /* HAVE_IPV6 */ /* Next we try to convert string to struct prefix_eth. */ ret = str2prefix_eth (str, (struct prefix_eth *) p); @@ -1035,7 +1008,6 @@ netmask_str2prefix_str (const char *net_str, const char *mask_str, return 1; } -#ifdef HAVE_IPV6 /* Utility function for making IPv6 address string. */ const char * inet6_ntoa (struct in6_addr addr) @@ -1045,4 +1017,3 @@ inet6_ntoa (struct in6_addr addr) inet_ntop (AF_INET6, &addr, buf, INET6_ADDRSTRLEN); return buf; } -#endif /* HAVE_IPV6 */ diff --git a/lib/prefix.h b/lib/prefix.h index 85488ccea..5e4b1f9c8 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -74,9 +74,7 @@ struct prefix { u_char prefix; struct in_addr prefix4; -#ifdef HAVE_IPV6 struct in6_addr prefix6; -#endif /* HAVE_IPV6 */ struct { struct in_addr id; @@ -97,14 +95,12 @@ struct prefix_ipv4 }; /* IPv6 prefix structure. */ -#ifdef HAVE_IPV6 struct prefix_ipv6 { u_char family; u_char prefixlen; struct in6_addr prefix __attribute__ ((aligned (8))); }; -#endif /* HAVE_IPV6 */ struct prefix_ls { @@ -271,7 +267,6 @@ extern in_addr_t ipv4_broadcast_addr (in_addr_t hostaddr, int masklen); extern int netmask_str2prefix_str (const char *, const char *, char *); -#ifdef HAVE_IPV6 extern struct prefix_ipv6 *prefix_ipv6_new (void); extern void prefix_ipv6_free (struct prefix_ipv6 *); extern int str2prefix_ipv6 (const char *, struct prefix_ipv6 *); @@ -298,8 +293,6 @@ static inline int ipv6_martian (struct in6_addr *addr) return 0; } -#endif /* HAVE_IPV6 */ - extern int all_digit (const char *); /* NOTE: This routine expects the address argument in network byte order. */ diff --git a/lib/smux.c b/lib/smux.c index bf3892637..3abfadcd2 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -154,16 +154,10 @@ static int smux_socket (void) { int ret; -#ifdef HAVE_IPV6 struct addrinfo hints, *res0, *res; int gai; -#else - struct sockaddr_in serv; - struct servent *sp; -#endif int sock = 0; -#ifdef HAVE_IPV6 memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; @@ -183,9 +177,7 @@ smux_socket (void) for(res=res0; res; res=res->ai_next) { if (res->ai_family != AF_INET -#ifdef HAVE_IPV6 && res->ai_family != AF_INET6 -#endif /* HAVE_IPV6 */ ) continue; @@ -206,40 +198,6 @@ smux_socket (void) freeaddrinfo(res0); if (sock < 0) zlog_warn ("Can't connect to SNMP agent with SMUX"); -#else - sock = socket (AF_INET, SOCK_STREAM, 0); - if (sock < 0) - { - zlog_warn ("Can't make socket for SNMP"); - return -1; - } - - memset (&serv, 0, sizeof (struct sockaddr_in)); - serv.sin_family = AF_INET; -#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN - serv.sin_len = sizeof (struct sockaddr_in); -#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ - - sp = getservbyname ("smux", "tcp"); - if (sp != NULL) - serv.sin_port = sp->s_port; - else - serv.sin_port = htons (SMUX_PORT_DEFAULT); - - serv.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - - sockopt_reuseaddr (sock); - sockopt_reuseport (sock); - - ret = connect (sock, (struct sockaddr *) &serv, sizeof (struct sockaddr_in)); - if (ret < 0) - { - close (sock); - smux_sock = -1; - zlog_warn ("Can't connect to SNMP agent with SMUX"); - return -1; - } -#endif return sock; } diff --git a/lib/sockopt.c b/lib/sockopt.c index 461e1f7f5..2a9f907cb 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -86,7 +86,6 @@ getsockopt_cmsg_data (struct msghdr *msgh, int level, int type) return NULL; } -#ifdef HAVE_IPV6 /* Set IPv6 packet info to the socket. */ int setsockopt_ipv6_pktinfo (int sock, int val) @@ -198,7 +197,6 @@ setsockopt_ipv6_tclass(int sock, int tclass) #endif return ret; } -#endif /* HAVE_IPV6 */ /* * Process multicast socket options for IPv4 in an OS-dependent manner. @@ -444,11 +442,9 @@ setsockopt_ifindex (int af, int sock, ifindex_t val) case AF_INET: ret = setsockopt_ipv4_ifindex (sock, val); break; -#ifdef HAVE_IPV6 case AF_INET6: ret = setsockopt_ipv6_pktinfo (sock, val); break; -#endif default: zlog_warn ("setsockopt_ifindex: unknown address family %d", af); } @@ -535,11 +531,9 @@ getsockopt_ifindex (int af, struct msghdr *msgh) case AF_INET: return (getsockopt_ipv4_ifindex (msgh)); break; -#ifdef HAVE_IPV6 case AF_INET6: return (getsockopt_ipv6_ifindex (msgh)); break; -#endif default: zlog_warn ("getsockopt_ifindex: unknown address family %d", af); return 0; @@ -646,7 +640,6 @@ sockopt_tcp_signature (int sock, union sockunion *su, const char *password) return 0; } -#ifdef HAVE_IPV6 /* If this does not work, then all users of this sockopt will need to * differentiate between IPv4 and IPv6, and keep seperate sockets for * each. @@ -663,7 +656,6 @@ sockopt_tcp_signature (int sock, union sockunion *su, const char *password) su2->sin6.sin6_addr.s6_addr32[2] = htonl(0xffff); memcpy (&su2->sin6.sin6_addr.s6_addr32[3], &su->sin.sin_addr, 4); } -#endif } memset (&md5sig, 0, sizeof (md5sig)); diff --git a/lib/sockopt.h b/lib/sockopt.h index b3ab57ab7..1b7be1e49 100644 --- a/lib/sockopt.h +++ b/lib/sockopt.h @@ -28,7 +28,6 @@ extern void setsockopt_so_recvbuf (int sock, int size); extern void setsockopt_so_sendbuf (const int sock, int size); extern int getsockopt_so_sendbuf (const int sock); -#ifdef HAVE_IPV6 extern int setsockopt_ipv6_pktinfo (int, int); extern int setsockopt_ipv6_checksum (int, int); extern int setsockopt_ipv6_multicast_hops (int, int); @@ -36,13 +35,7 @@ extern int setsockopt_ipv6_unicast_hops (int, int); extern int setsockopt_ipv6_hoplimit (int, int); extern int setsockopt_ipv6_multicast_loop (int, int); extern int setsockopt_ipv6_tclass (int, int); -#endif /* HAVE_IPV6 */ -/* - * It is OK to reference in6_pktinfo here without a protecting #if - * because this macro will only be used #if HAVE_IPV6, and in6_pktinfo - * is not optional for HAVE_IPV6. - */ #define SOPT_SIZE_CMSG_PKTINFO_IPV6() (sizeof (struct in6_pktinfo)); /* diff --git a/lib/sockunion.c b/lib/sockunion.c index f4b6ce12c..5b508d1bf 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -38,11 +38,9 @@ inet_sutop (const union sockunion *su, char *str) case AF_INET: inet_ntop (AF_INET, &su->sin.sin_addr, str, INET_ADDRSTRLEN); break; -#ifdef HAVE_IPV6 case AF_INET6: inet_ntop (AF_INET6, &su->sin6.sin6_addr, str, INET6_ADDRSTRLEN); break; -#endif /* HAVE_IPV6 */ } return str; } @@ -63,7 +61,6 @@ str2sockunion (const char *str, union sockunion *su) #endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ return 0; } -#ifdef HAVE_IPV6 ret = inet_pton (AF_INET6, str, &su->sin6.sin6_addr); if (ret > 0) /* Valid IPv6 address format. */ { @@ -73,7 +70,6 @@ str2sockunion (const char *str, union sockunion *su) #endif /* SIN6_LEN */ return 0; } -#endif /* HAVE_IPV6 */ return -1; } @@ -87,10 +83,8 @@ sockunion2str (const union sockunion *su, char *buf, size_t len) return buf; case AF_INET: return inet_ntop (AF_INET, &su->sin.sin_addr, buf, len); -#ifdef HAVE_IPV6 case AF_INET6: return inet_ntop (AF_INET6, &su->sin6.sin6_addr, buf, len); -#endif /* HAVE_IPV6 */ } snprintf (buf, len, "(af %d)", sockunion_family(su)); return buf; @@ -114,7 +108,6 @@ sockunion_normalise_mapped (union sockunion *su) { struct sockaddr_in sin; -#ifdef HAVE_IPV6 if (su->sa.sa_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED (&su->sin6.sin6_addr)) { @@ -124,7 +117,6 @@ sockunion_normalise_mapped (union sockunion *su) memcpy (&sin.sin_addr, ((char *)&su->sin6.sin6_addr) + 12, 4); memcpy (su, &sin, sizeof (struct sockaddr_in)); } -#endif /* HAVE_IPV6 */ } /* return sockunion structure : this function should be revised. */ @@ -190,11 +182,9 @@ sockunion_sizeof (const union sockunion *su) case AF_INET: ret = sizeof (struct sockaddr_in); break; -#ifdef HAVE_IPV6 case AF_INET6: ret = sizeof (struct sockaddr_in6); break; -#endif /* AF_INET6 */ } return ret; } @@ -218,7 +208,6 @@ sockunion_connect (int fd, const union sockunion *peersu, unsigned short port, case AF_INET: su.sin.sin_port = port; break; -#ifdef HAVE_IPV6 case AF_INET6: su.sin6.sin6_port = port; #ifdef KAME @@ -229,7 +218,6 @@ sockunion_connect (int fd, const union sockunion *peersu, unsigned short port, } #endif /* KAME */ break; -#endif /* HAVE_IPV6 */ } /* Make socket non-block. */ @@ -299,7 +287,6 @@ sockunion_bind (int sock, union sockunion *su, unsigned short port, if (su_addr == NULL) sockunion2ip (su) = htonl (INADDR_ANY); } -#ifdef HAVE_IPV6 else if (su->sa.sa_family == AF_INET6) { size = sizeof (struct sockaddr_in6); @@ -316,8 +303,6 @@ sockunion_bind (int sock, union sockunion *su, unsigned short port, #endif /* LINUX_IPV6 */ } } -#endif /* HAVE_IPV6 */ - ret = bind (sock, (struct sockaddr *)su, size); if (ret < 0) @@ -388,7 +373,6 @@ sockopt_ttl (int family, int sock, int ttl) return 0; } #endif /* IP_TTL */ -#ifdef HAVE_IPV6 if (family == AF_INET6) { ret = setsockopt (sock, IPPROTO_IPV6, IPV6_UNICAST_HOPS, @@ -401,7 +385,6 @@ sockopt_ttl (int family, int sock, int ttl) } return 0; } -#endif /* HAVE_IPV6 */ return 0; } @@ -469,7 +452,6 @@ sockopt_v6only (int family, int sock) { int ret, on = 1; -#ifdef HAVE_IPV6 #ifdef IPV6_V6ONLY if (family == AF_INET6) { @@ -484,7 +466,6 @@ sockopt_v6only (int family, int sock) return 0; } #endif /* IPV6_V6ONLY */ -#endif /* HAVE_IPV6 */ return 0; } @@ -503,7 +484,6 @@ sockunion_same (const union sockunion *su1, const union sockunion *su2) ret = memcmp (&su1->sin.sin_addr, &su2->sin.sin_addr, sizeof (struct in_addr)); break; -#ifdef HAVE_IPV6 case AF_INET6: ret = memcmp (&su1->sin6.sin6_addr, &su2->sin6.sin6_addr, sizeof (struct in6_addr)); @@ -514,7 +494,6 @@ sockunion_same (const union sockunion *su1, const union sockunion *su2) ret = (su1->sin6.sin6_scope_id == su2->sin6.sin6_scope_id) ? 0 : 1; } break; -#endif /* HAVE_IPV6 */ } if (ret == 0) return 1; @@ -529,10 +508,8 @@ sockunion_hash (const union sockunion *su) { case AF_INET: return jhash_1word(su->sin.sin_addr.s_addr, 0); -#ifdef HAVE_IPV6 case AF_INET6: return jhash2(su->sin6.sin6_addr.s6_addr32, ZEBRA_NUM_OF(su->sin6.sin6_addr.s6_addr32), 0); -#endif /* HAVE_IPV6 */ } return 0; } @@ -544,10 +521,8 @@ family2addrsize(int family) { case AF_INET: return sizeof(struct in_addr); -#ifdef HAVE_IPV6 case AF_INET6: return sizeof(struct in6_addr); -#endif /* HAVE_IPV6 */ } return 0; } @@ -565,10 +540,8 @@ sockunion_get_addr(const union sockunion *su) { case AF_INET: return (const u_char *) &su->sin.sin_addr.s_addr; -#ifdef HAVE_IPV6 case AF_INET6: return (const u_char *) &su->sin6.sin6_addr; -#endif /* HAVE_IPV6 */ } return NULL; } @@ -585,11 +558,9 @@ sockunion_set(union sockunion *su, int family, const u_char *addr, size_t bytes) case AF_INET: memcpy(&su->sin.sin_addr.s_addr, addr, bytes); break; -#ifdef HAVE_IPV6 case AF_INET6: memcpy(&su->sin6.sin6_addr, addr, bytes); break; -#endif /* HAVE_IPV6 */ } } @@ -603,9 +574,7 @@ sockunion_getsockname (int fd) { struct sockaddr sa; struct sockaddr_in sin; -#ifdef HAVE_IPV6 struct sockaddr_in6 sin6; -#endif /* HAVE_IPV6 */ char tmp_buffer[128]; } name; union sockunion *su; @@ -627,7 +596,6 @@ sockunion_getsockname (int fd) memcpy (su, &name, sizeof (struct sockaddr_in)); return su; } -#ifdef HAVE_IPV6 if (name.sa.sa_family == AF_INET6) { su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion)); @@ -635,7 +603,6 @@ sockunion_getsockname (int fd) sockunion_normalise_mapped (su); return su; } -#endif /* HAVE_IPV6 */ return NULL; } @@ -649,9 +616,7 @@ sockunion_getpeername (int fd) { struct sockaddr sa; struct sockaddr_in sin; -#ifdef HAVE_IPV6 struct sockaddr_in6 sin6; -#endif /* HAVE_IPV6 */ char tmp_buffer[128]; } name; union sockunion *su; @@ -672,7 +637,6 @@ sockunion_getpeername (int fd) memcpy (su, &name, sizeof (struct sockaddr_in)); return su; } -#ifdef HAVE_IPV6 if (name.sa.sa_family == AF_INET6) { su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion)); @@ -680,7 +644,6 @@ sockunion_getpeername (int fd) sockunion_normalise_mapped (su); return su; } -#endif /* HAVE_IPV6 */ return NULL; } @@ -696,7 +659,6 @@ sockunion_print (const union sockunion *su) case AF_INET: printf ("%s\n", inet_ntoa (su->sin.sin_addr)); break; -#ifdef HAVE_IPV6 case AF_INET6: { char buf [SU_ADDRSTRLEN]; @@ -705,7 +667,6 @@ sockunion_print (const union sockunion *su) buf, sizeof (buf))); } break; -#endif /* HAVE_IPV6 */ #ifdef AF_LINK case AF_LINK: @@ -723,7 +684,6 @@ sockunion_print (const union sockunion *su) } } -#ifdef HAVE_IPV6 static int in6addr_cmp (const struct in6_addr *addr1, const struct in6_addr *addr2) { @@ -742,7 +702,6 @@ in6addr_cmp (const struct in6_addr *addr1, const struct in6_addr *addr2) } return 0; } -#endif /* HAVE_IPV6 */ int sockunion_cmp (const union sockunion *su1, const union sockunion *su2) @@ -761,10 +720,8 @@ sockunion_cmp (const union sockunion *su1, const union sockunion *su2) else return -1; } -#ifdef HAVE_IPV6 if (su1->sa.sa_family == AF_INET6) return in6addr_cmp (&su1->sin6.sin6_addr, &su2->sin6.sin6_addr); -#endif /* HAVE_IPV6 */ return 0; } diff --git a/lib/sockunion.h b/lib/sockunion.h index 3af3d7805..bed68e1ee 100644 --- a/lib/sockunion.h +++ b/lib/sockunion.h @@ -47,11 +47,7 @@ enum connect_result }; /* Default address family. */ -#ifdef HAVE_IPV6 #define AF_INET_UNION AF_INET6 -#else -#define AF_INET_UNION AF_INET -#endif /* Sockunion address string length. Same as INET6_ADDRSTRLEN. */ #define SU_ADDRSTRLEN 46 diff --git a/lib/table.c b/lib/table.c index 5133ef697..7335b2a81 100644 --- a/lib/table.c +++ b/lib/table.c @@ -250,7 +250,6 @@ route_node_match_ipv4 (const struct route_table *table, return route_node_match (table, (struct prefix *) &p); } -#ifdef HAVE_IPV6 struct route_node * route_node_match_ipv6 (const struct route_table *table, const struct in6_addr *addr) @@ -264,7 +263,6 @@ route_node_match_ipv6 (const struct route_table *table, return route_node_match (table, (struct prefix *) &p); } -#endif /* HAVE_IPV6 */ /* Lookup same prefix node. Return NULL when we can't find route. */ struct route_node * diff --git a/lib/table.h b/lib/table.h index 78bf5da74..5f3eb8de3 100644 --- a/lib/table.h +++ b/lib/table.h @@ -162,10 +162,8 @@ extern struct route_node *route_node_match (const struct route_table *, const struct prefix *); extern struct route_node *route_node_match_ipv4 (const struct route_table *, const struct in_addr *); -#ifdef HAVE_IPV6 extern struct route_node *route_node_match_ipv6 (const struct route_table *, const struct in6_addr *); -#endif /* HAVE_IPV6 */ extern unsigned long route_table_count (const struct route_table *); @@ -1867,7 +1867,6 @@ vty_accept (struct thread *thread) } } -#ifdef HAVE_IPV6 /* VTY's ipv6 accesslist apply. */ if (p.family == AF_INET6 && vty_ipv6_accesslist_name) { @@ -1884,7 +1883,6 @@ vty_accept (struct thread *thread) return 0; } } -#endif /* HAVE_IPV6 */ on = 1; ret = setsockopt (vty_sock, IPPROTO_TCP, TCP_NODELAY, @@ -1901,7 +1899,6 @@ vty_accept (struct thread *thread) return 0; } -#ifdef HAVE_IPV6 static void vty_serv_sock_addrinfo (const char *hostname, unsigned short port) { @@ -1932,9 +1929,7 @@ vty_serv_sock_addrinfo (const char *hostname, unsigned short port) do { if (ainfo->ai_family != AF_INET -#ifdef HAVE_IPV6 && ainfo->ai_family != AF_INET6 -#endif /* HAVE_IPV6 */ ) continue; @@ -1967,76 +1962,6 @@ vty_serv_sock_addrinfo (const char *hostname, unsigned short port) freeaddrinfo (ainfo_save); } -#else /* HAVE_IPV6 */ - -/* Make vty server socket. */ -static void -vty_serv_sock_family (const char* addr, unsigned short port, int family) -{ - int ret; - union sockunion su; - int accept_sock; - void* naddr=NULL; - - memset (&su, 0, sizeof (union sockunion)); - su.sa.sa_family = family; - if(addr) - switch(family) - { - case AF_INET: - naddr=&su.sin.sin_addr; - break; -#ifdef HAVE_IPV6 - case AF_INET6: - naddr=&su.sin6.sin6_addr; - break; -#endif - } - - if(naddr) - switch(inet_pton(family,addr,naddr)) - { - case -1: - zlog_err("bad address %s",addr); - naddr=NULL; - break; - case 0: - zlog_err("error translating address %s: %s",addr,safe_strerror(errno)); - naddr=NULL; - } - - /* Make new socket. */ - accept_sock = sockunion_stream_socket (&su); - if (accept_sock < 0) - return; - - /* This is server, so reuse address. */ - sockopt_reuseaddr (accept_sock); - sockopt_reuseport (accept_sock); - set_cloexec (accept_sock); - - /* Bind socket to universal address and given port. */ - ret = sockunion_bind (accept_sock, &su, port, naddr); - if (ret < 0) - { - zlog_warn("can't bind socket"); - close (accept_sock); /* Avoid sd leak. */ - return; - } - - /* Listen socket under queue 3. */ - ret = listen (accept_sock, 3); - if (ret < 0) - { - zlog (NULL, LOG_WARNING, "can't listen socket"); - close (accept_sock); /* Avoid sd leak. */ - return; - } - - /* Add vty server event. */ - vty_event (VTY_SERV, accept_sock, NULL); -} -#endif /* HAVE_IPV6 */ #ifdef VTYSH /* For sockaddr_un. */ @@ -2279,14 +2204,7 @@ vty_serv_sock (const char *addr, unsigned short port, const char *path) { /* If port is set to 0, do not listen on TCP/IP at all! */ if (port) - { - -#ifdef HAVE_IPV6 - vty_serv_sock_addrinfo (addr, port); -#else /* ! HAVE_IPV6 */ - vty_serv_sock_family (addr,port, AF_INET); -#endif /* HAVE_IPV6 */ - } + vty_serv_sock_addrinfo (addr, port); #ifdef VTYSH vty_serv_un (path); @@ -2858,7 +2776,6 @@ DEFUN (no_vty_access_class, return CMD_SUCCESS; } -#ifdef HAVE_IPV6 /* Set vty access class. */ DEFUN (vty_ipv6_access_class, vty_ipv6_access_class_cmd, @@ -2902,7 +2819,6 @@ DEFUN (no_vty_ipv6_access_class, return CMD_SUCCESS; } -#endif /* HAVE_IPV6 */ /* vty login. */ DEFUN (vty_login, @@ -3184,10 +3100,8 @@ vty_init (struct thread_master *master_thread) install_element (VTY_NODE, &no_vty_access_class_cmd); install_element (VTY_NODE, &vty_login_cmd); install_element (VTY_NODE, &no_vty_login_cmd); -#ifdef HAVE_IPV6 install_element (VTY_NODE, &vty_ipv6_access_class_cmd); install_element (VTY_NODE, &no_vty_ipv6_access_class_cmd); -#endif /* HAVE_IPV6 */ } void diff --git a/lib/zclient.c b/lib/zclient.c index 440de3635..a4c5fa4af 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -786,7 +786,6 @@ zapi_ipv4_route (u_char cmd, struct zclient *zclient, struct prefix_ipv4 *p, return zclient_send_message(zclient); } -#ifdef HAVE_IPV6 int zapi_ipv4_route_ipv6_nexthop (u_char cmd, struct zclient *zclient, struct prefix_ipv4 *p, struct zapi_ipv6 *api) @@ -918,7 +917,6 @@ zapi_ipv6_route (u_char cmd, struct zclient *zclient, struct prefix_ipv6 *p, return zclient_send_message(zclient); } -#endif /* HAVE_IPV6 */ /* * send a ZEBRA_REDISTRIBUTE_ADD or ZEBRA_REDISTRIBUTE_DELETE diff --git a/lib/zclient.h b/lib/zclient.h index 4312cdc83..ccb7b0509 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -214,7 +214,6 @@ extern int zapi_ipv4_route (u_char, struct zclient *, struct prefix_ipv4 *, extern struct interface *zebra_interface_link_params_read (struct stream *); extern size_t zebra_interface_link_params_write (struct stream *, struct interface *); -#ifdef HAVE_IPV6 /* IPv6 prefix add and delete function prototype. */ struct zapi_ipv6 @@ -249,6 +248,5 @@ extern int zapi_ipv6_route (u_char cmd, struct zclient *zclient, struct prefix_ipv6 *p, struct zapi_ipv6 *api); extern int zapi_ipv4_route_ipv6_nexthop (u_char, struct zclient *, struct prefix_ipv4 *, struct zapi_ipv6 *); -#endif /* HAVE_IPV6 */ #endif /* _ZEBRA_ZCLIENT_H */ diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 9540ffab5..819141afe 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -88,7 +88,7 @@ my $cli_stomp = 0; foreach (@ARGV) { $file = $_; - open (FH, "@CPP@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -DHAVE_IPV6 -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_builddir@/lib -I@top_srcdir@/bgpd -I@top_srcdir@/@LIBRFP@ -I@top_srcdir@/bgpd/rfapi @CPPFLAGS@ $file |"); + open (FH, "@CPP@ -DHAVE_CONFIG_H -DVTYSH_EXTRACT_PL -I@top_builddir@ -I@srcdir@/ -I@srcdir@/.. -I@top_srcdir@/lib -I@top_builddir@/lib -I@top_srcdir@/bgpd -I@top_srcdir@/@LIBRFP@ -I@top_srcdir@/bgpd/rfapi @CPPFLAGS@ $file |"); local $/; undef $/; $line = <FH>; close (FH); diff --git a/zebra/client_main.c b/zebra/client_main.c index 8290eafc4..f40d99546 100644 --- a/zebra/client_main.c +++ b/zebra/client_main.c @@ -79,7 +79,6 @@ zebra_test_ipv4 (int command, int type, char *prefix, char *gateway, } } -#ifdef HAVE_IPV6 /* IPv6 route add and delete test. */ void zebra_test_v6 (int sock) @@ -95,7 +94,6 @@ zebra_test_v6 (int sock) sleep (5); /* zebra_ipv6_delete (sock, ZEBRA_ROUTE_STATIC, 0, &p, &nexthop, 1); */ } -#endif /* HAVE_IPV6 */ /* Print out usage and exit. */ void diff --git a/zebra/connected.c b/zebra/connected.c index bc54aab01..ebd948252 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -59,10 +59,8 @@ connected_withdraw (struct connected *ifc) if (ifc->address->family == AF_INET) connected_down_ipv4 (ifc->ifp, ifc); -#ifdef HAVE_IPV6 else connected_down_ipv6 (ifc->ifp, ifc); -#endif UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL); } @@ -103,10 +101,8 @@ connected_announce (struct interface *ifp, struct connected *ifc) { if (ifc->address->family == AF_INET) connected_up_ipv4 (ifp, ifc); -#ifdef HAVE_IPV6 else connected_up_ipv6 (ifp, ifc); -#endif } } diff --git a/zebra/connected.h b/zebra/connected.h index f35f47fb6..bdcf6085e 100644 --- a/zebra/connected.h +++ b/zebra/connected.h @@ -41,7 +41,6 @@ connected_delete_ipv4_unnumbered (struct connected *ifc); extern void connected_up_ipv4 (struct interface *, struct connected *); extern void connected_down_ipv4 (struct interface *, struct connected *); -#ifdef HAVE_IPV6 extern void connected_add_ipv6 (struct interface *ifp, int flags, struct in6_addr *address, u_char prefixlen, struct in6_addr *broad, @@ -53,8 +52,6 @@ connected_delete_ipv6 (struct interface *ifp, struct in6_addr *address, extern void connected_up_ipv6 (struct interface *, struct connected *); extern void connected_down_ipv6 (struct interface *ifp, struct connected *); -#endif /* HAVE_IPV6 */ - extern int connected_is_unnumbered (struct interface *); #endif /*_ZEBRA_CONNECTED_H */ diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c index cc348fc23..36b0a6c79 100644 --- a/zebra/if_ioctl.c +++ b/zebra/if_ioctl.c @@ -244,7 +244,6 @@ if_getaddrs (void) connected_add_ipv4 (ifp, flags, &addr->sin_addr, prefixlen, dest_pnt, NULL); } -#ifdef HAVE_IPV6 if (ifap->ifa_addr->sa_family == AF_INET6) { struct sockaddr_in6 *addr; @@ -289,7 +288,6 @@ if_getaddrs (void) connected_add_ipv6 (ifp, flags, &addr->sin6_addr, prefixlen, dest_pnt, NULL); } -#endif /* HAVE_IPV6 */ } freeifaddrs (ifapfree); @@ -336,9 +334,9 @@ interface_list (struct zebra_ns *zns) if_getaddrs (); -#if defined(HAVE_IPV6) && defined(HAVE_PROC_NET_IF_INET6) +#if defined(HAVE_PROC_NET_IF_INET6) /* Linux provides interface's IPv6 address via /proc/net/if_inet6. */ ifaddr_proc_ipv6 (); -#endif /* HAVE_IPV6 && HAVE_PROC_NET_IF_INET6 */ +#endif /* HAVE_PROC_NET_IF_INET6 */ } diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c index 0e727b9dc..f27dc8900 100644 --- a/zebra/if_ioctl_solaris.c +++ b/zebra/if_ioctl_solaris.c @@ -177,12 +177,7 @@ calculate_lifc_len: /* must hold privileges to enter here */ if (lifreq->lifr_addr.ss_family == AF_INET6) { -#ifdef HAVE_IPV6 ifp->flags |= IFF_IPV6; -#else - lifreq++; - continue; -#endif /* HAVE_IPV6 */ } if_add_update (ifp); @@ -309,7 +304,6 @@ if_get_addr (struct interface *ifp, struct sockaddr *addr, const char *label) dest_pnt = (char *) &SIN (&dest)->sin_addr; } } -#ifdef HAVE_IPV6 else if (af == AF_INET6) { if (if_ioctl_ipv6 (SIOCGLIFSUBNET, (caddr_t) & lifreq) < 0) @@ -325,17 +319,14 @@ if_get_addr (struct interface *ifp, struct sockaddr *addr, const char *label) prefixlen = lifreq.lifr_addrlen; } } -#endif /* HAVE_IPV6 */ /* Set address to the interface. */ if (af == AF_INET) connected_add_ipv4 (ifp, flags, &SIN (addr)->sin_addr, prefixlen, (struct in_addr *) dest_pnt, label); -#ifdef HAVE_IPV6 else if (af == AF_INET6) connected_add_ipv6 (ifp, flags, &SIN6 (addr)->sin6_addr, prefixlen, (struct in6_addr *) dest_pnt, label); -#endif /* HAVE_IPV6 */ return 0; } @@ -367,7 +358,6 @@ interface_list (struct zebra_ns *zns) struct connected * if_lookup_linklocal (struct interface *ifp) { -#ifdef HAVE_IPV6 struct listnode *node; struct connected *ifc; @@ -380,7 +370,6 @@ if_lookup_linklocal (struct interface *ifp) (IN6_IS_ADDR_LINKLOCAL (&ifc->address->u.prefix6))) return ifc; } -#endif /* HAVE_IPV6 */ return NULL; } diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index c5fd16b9c..678c21732 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -373,7 +373,6 @@ interface_lookup_netlink (struct zebra_ns *zns) if (ret < 0) return ret; -#ifdef HAVE_IPV6 /* Get IPv6 address of the interfaces. */ ret = netlink_request (AF_INET6, RTM_GETADDR, &zns->netlink_cmd); if (ret < 0) @@ -381,7 +380,6 @@ interface_lookup_netlink (struct zebra_ns *zns) ret = netlink_parse_info (netlink_interface_addr, &zns->netlink_cmd, zns, 0); if (ret < 0) return ret; -#endif /* HAVE_IPV6 */ return 0; } @@ -468,10 +466,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h, ifa = NLMSG_DATA (h); if (ifa->ifa_family != AF_INET -#ifdef HAVE_IPV6 - && ifa->ifa_family != AF_INET6 -#endif /* HAVE_IPV6 */ - ) + && ifa->ifa_family != AF_INET6) return 0; if (h->nlmsg_type != RTM_NEWADDR && h->nlmsg_type != RTM_DELADDR) @@ -571,7 +566,6 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h, (struct in_addr *) addr, ifa->ifa_prefixlen, (struct in_addr *) broad); } -#ifdef HAVE_IPV6 if (ifa->ifa_family == AF_INET6) { if (h->nlmsg_type == RTM_NEWADDR) @@ -589,7 +583,6 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h, (struct in6_addr *) addr, ifa->ifa_prefixlen, (struct in6_addr *) broad); } -#endif /* HAVE_IPV6 */ return 0; } diff --git a/zebra/interface.c b/zebra/interface.c index 4a0409702..5a9de5b70 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -439,7 +439,6 @@ if_addr_wakeup (struct interface *ifp) * from the kernel has been received. * It will also be added to the interface's subnet list then. */ } -#ifdef HAVE_IPV6 if (p->family == AF_INET6) { if (! if_is_up (ifp)) @@ -461,7 +460,6 @@ if_addr_wakeup (struct interface *ifp) /* The address will be advertised to zebra clients when the notification * from the kernel has been received. */ } -#endif /* HAVE_IPV6 */ } } } @@ -1060,10 +1058,8 @@ if_dump_vty (struct vty *vty, struct interface *ifp) vty_out (vty, " index %d metric %d mtu %d ", ifp->ifindex, ifp->metric, ifp->mtu); -#ifdef HAVE_IPV6 if (ifp->mtu6 != ifp->mtu) vty_out (vty, "mtu6 %d ", ifp->mtu6); -#endif vty_out (vty, "%s flags: %s%s", VTY_NEWLINE, if_flag_dump (ifp->flags), VTY_NEWLINE); @@ -2547,7 +2543,6 @@ DEFUN (no_ip_address_label, } #endif /* HAVE_NETLINK */ -#ifdef HAVE_IPV6 static int ipv6_address_install (struct vty *vty, struct interface *ifp, const char *addr_str, const char *peer_str, @@ -2723,7 +2718,6 @@ DEFUN (no_ipv6_address, VTY_DECLVAR_CONTEXT (interface, ifp); return ipv6_address_uninstall (vty, ifp, argv[idx_ipv6_prefixlen]->arg, NULL, NULL, 0); } -#endif /* HAVE_IPV6 */ static int link_params_config_write (struct vty *vty, struct interface *ifp) @@ -2896,10 +2890,8 @@ zebra_if_init (void) install_element (INTERFACE_NODE, &no_bandwidth_if_cmd); install_element (INTERFACE_NODE, &ip_address_cmd); install_element (INTERFACE_NODE, &no_ip_address_cmd); -#ifdef HAVE_IPV6 install_element (INTERFACE_NODE, &ipv6_address_cmd); install_element (INTERFACE_NODE, &no_ipv6_address_cmd); -#endif /* HAVE_IPV6 */ #ifdef HAVE_NETLINK install_element (INTERFACE_NODE, &ip_address_label_cmd); install_element (INTERFACE_NODE, &no_ip_address_label_cmd); diff --git a/zebra/ioctl.c b/zebra/ioctl.c index 1835fb310..112504331 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -80,7 +80,6 @@ if_ioctl (u_long request, caddr_t buffer) return 0; } -#ifdef HAVE_IPV6 static int if_ioctl_ipv6 (u_long request, caddr_t buffer) { @@ -114,7 +113,6 @@ if_ioctl_ipv6 (u_long request, caddr_t buffer) } return 0; } -#endif /* HAVE_IPV6 */ /* * get interface metric @@ -437,8 +435,6 @@ if_unset_flags (struct interface *ifp, uint64_t flags) return 0; } -#ifdef HAVE_IPV6 - #ifdef LINUX_IPV6 #ifndef _LINUX_IN6_H /* linux/include/net/ipv6.h */ @@ -594,5 +590,3 @@ if_prefix_delete_ipv6 (struct interface *ifp, struct connected *ifc) #endif /* HAVE_STRUCT_IN6_ALIASREQ */ #endif /* LINUX_IPV6 */ - -#endif /* HAVE_IPV6 */ diff --git a/zebra/ioctl.h b/zebra/ioctl.h index fee9b725c..9e3fd5b3f 100644 --- a/zebra/ioctl.h +++ b/zebra/ioctl.h @@ -37,10 +37,8 @@ extern int if_unset_prefix (struct interface *, struct connected *); extern void if_get_metric (struct interface *); extern void if_get_mtu (struct interface *); -#ifdef HAVE_IPV6 extern int if_prefix_add_ipv6 (struct interface *, struct connected *); extern int if_prefix_delete_ipv6 (struct interface *, struct connected *); -#endif /* HAVE_IPV6 */ #ifdef SOLARIS_IPV6 extern int if_ioctl_ipv6(u_long, caddr_t); diff --git a/zebra/ioctl_solaris.c b/zebra/ioctl_solaris.c index b5bf1ccb0..1de583577 100644 --- a/zebra/ioctl_solaris.c +++ b/zebra/ioctl_solaris.c @@ -85,7 +85,6 @@ if_ioctl (u_long request, caddr_t buffer) int if_ioctl_ipv6 (u_long request, caddr_t buffer) { -#ifdef HAVE_IPV6 int sock; int ret; int err; @@ -117,7 +116,6 @@ if_ioctl_ipv6 (u_long request, caddr_t buffer) errno = err; return ret; } -#endif /* HAVE_IPV6 */ return 0; } @@ -177,7 +175,6 @@ if_get_mtu (struct interface *ifp) } } -#ifdef HAVE_IPV6 if (ifp->flags & IFF_IPV6) { memset(&lifreq, 0, sizeof(lifreq)); @@ -195,7 +192,6 @@ if_get_mtu (struct interface *ifp) changed = 1; } } -#endif /* HAVE_IPV6 */ if (changed) zebra_interface_up_update(ifp); @@ -403,8 +399,6 @@ if_unset_flags (struct interface *ifp, uint64_t flags) return ret; } -#ifdef HAVE_IPV6 - /* Interface's address add/delete functions. */ int if_prefix_add_ipv6 (struct interface *ifp, struct connected *ifc) @@ -431,5 +425,3 @@ if_prefix_delete_ipv6 (struct interface *ifp, struct connected *ifc) return 0; } - -#endif /* HAVE_IPV6 */ diff --git a/zebra/ipforward.h b/zebra/ipforward.h index 8a935c139..a75073cb3 100644 --- a/zebra/ipforward.h +++ b/zebra/ipforward.h @@ -26,10 +26,8 @@ extern int ipforward (void); extern int ipforward_on (void); extern int ipforward_off (void); -#ifdef HAVE_IPV6 extern int ipforward_ipv6 (void); extern int ipforward_ipv6_on (void); extern int ipforward_ipv6_off (void); -#endif /* HAVE_IPV6 */ #endif /* _ZEBRA_IPFORWARD_H */ diff --git a/zebra/ipforward_proc.c b/zebra/ipforward_proc.c index 2876eded3..910fd61d0 100644 --- a/zebra/ipforward_proc.c +++ b/zebra/ipforward_proc.c @@ -123,7 +123,6 @@ ipforward_off (void) return ipforward (); } -#ifdef HAVE_IPV6 char proc_ipv6_forwarding[] = "/proc/sys/net/ipv6/conf/all/forwarding"; @@ -152,7 +151,7 @@ ipforward_ipv6_on (void) FILE *fp; if ( zserv_privs.change(ZPRIVS_RAISE) ) - zlog_err ("Can't raise privileges, %s", safe_strerror (errno)); + zlog_err ("Can't raise privileges, %s", safe_strerror (errno)); fp = fopen (proc_ipv6_forwarding, "w"); @@ -172,13 +171,14 @@ ipforward_ipv6_on (void) return ipforward_ipv6 (); } + int ipforward_ipv6_off (void) { FILE *fp; if ( zserv_privs.change(ZPRIVS_RAISE) ) - zlog_err ("Can't raise privileges, %s", safe_strerror (errno)); + zlog_err ("Can't raise privileges, %s", safe_strerror (errno)); fp = fopen (proc_ipv6_forwarding, "w"); @@ -197,4 +197,3 @@ ipforward_ipv6_off (void) return ipforward_ipv6 (); } -#endif /* HAVE_IPV6 */ diff --git a/zebra/ipforward_solaris.c b/zebra/ipforward_solaris.c index 4aa1b797a..8eccfe133 100644 --- a/zebra/ipforward_solaris.c +++ b/zebra/ipforward_solaris.c @@ -145,7 +145,6 @@ ipforward_off (void) (void) solaris_nd_set("ip_forwarding", 0); return ipforward(); } -#ifdef HAVE_IPV6 int ipforward_ipv6(void) { return solaris_nd_get("ip6_forwarding"); @@ -162,4 +161,3 @@ ipforward_ipv6_off (void) (void) solaris_nd_set("ip6_forwarding", 0); return ipforward_ipv6(); } -#endif /* HAVE_IPV6 */ diff --git a/zebra/ipforward_sysctl.c b/zebra/ipforward_sysctl.c index 57ed18578..be4c9cd99 100644 --- a/zebra/ipforward_sysctl.c +++ b/zebra/ipforward_sysctl.c @@ -95,8 +95,6 @@ ipforward_off (void) return ipforwarding; } -#ifdef HAVE_IPV6 - /* IPv6 forwarding control MIB. */ int mib_ipv6[MIB_SIZ] = { @@ -173,4 +171,3 @@ ipforward_ipv6_off (void) zlog (NULL, LOG_ERR, "Can't lower privileges"); return ip6forwarding; } -#endif /* HAVE_IPV6 */ diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index bcd92e15f..6d81c9d05 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -111,7 +111,7 @@ extern struct zebra_privs_t zserv_privs; */ #if defined(HAVE_STRUCT_SOCKADDR_SA_LEN) #define SAROUNDUP(X) ROUNDUP(((struct sockaddr *)(X))->sa_len) -#elif defined(HAVE_IPV6) +#else /* * One would hope all fixed-size structure definitions are aligned, * but round them up nonetheless. @@ -123,12 +123,6 @@ extern struct zebra_privs_t zserv_privs; ROUNDUP(sizeof(struct sockaddr_in6)) : \ (((struct sockaddr *)(X))->sa_family == AF_LINK ? \ ROUNDUP(sizeof(struct sockaddr_dl)) : sizeof(struct sockaddr)))) -#else /* HAVE_IPV6 */ -#define SAROUNDUP(X) \ - (((struct sockaddr *)(X))->sa_family == AF_INET ? \ - ROUNDUP(sizeof(struct sockaddr_in)):\ - (((struct sockaddr *)(X))->sa_family == AF_LINK ? \ - ROUNDUP(sizeof(struct sockaddr_dl)) : sizeof(struct sockaddr))) #endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */ #endif /* !SA_SIZE */ @@ -299,10 +293,8 @@ af_check (int family) { if (family == AF_INET) return 1; -#ifdef HAVE_IPV6 if (family == AF_INET6) return 1; -#endif /* HAVE_IPV6 */ return 0; } @@ -682,9 +674,7 @@ ifam_read_mesg (struct ifa_msghdr *ifm, switch (family) { case AF_INET: -#ifdef HAVE_IPV6 case AF_INET6: -#endif { char buf[4][INET6_ADDRSTRLEN]; zlog_debug ("%s: ifindex %d, ifname %s, ifam_addrs 0x%x, " @@ -772,7 +762,6 @@ ifam_read (struct ifa_msghdr *ifam) ip_masklen (mask.sin.sin_addr), &brd.sin.sin_addr); break; -#ifdef HAVE_IPV6 case AF_INET6: /* Unset interface index from link-local address when IPv6 stack is KAME. */ @@ -792,7 +781,6 @@ ifam_read (struct ifa_msghdr *ifam) ip6_masklen (mask.sin6.sin6_addr), &brd.sin6.sin6_addr); break; -#endif /* HAVE_IPV6 */ default: /* Unsupported family silently ignore... */ break; diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 9c7ef5f12..4b2aabd18 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -63,14 +63,12 @@ is_default (struct prefix *p) if (p->family == AF_INET) if (p->u.prefix4.s_addr == 0 && p->prefixlen == 0) return 1; -#ifdef HAVE_IPV6 #if 0 /* IPv6 default separation is now pending until protocol daemon can handle that. */ if (p->family == AF_INET6) if (IN6_IS_ADDR_UNSPECIFIED (&p->u.prefix6) && p->prefixlen == 0) return 1; #endif /* 0 */ -#endif /* HAVE_IPV6 */ return 0; } diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index f168ef395..2e7f336d2 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -559,7 +559,6 @@ netlink_route_read (struct zebra_ns *zns) if (ret < 0) return ret; -#ifdef HAVE_IPV6 /* Get IPv6 routing table. */ ret = netlink_request (AF_INET6, RTM_GETROUTE, &zns->netlink_cmd); if (ret < 0) @@ -567,7 +566,6 @@ netlink_route_read (struct zebra_ns *zns) ret = netlink_parse_info (netlink_routing_table, &zns->netlink_cmd, zns, 0); if (ret < 0) return ret; -#endif /* HAVE_IPV6 */ return 0; } diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 6a0d01a07..12e4873ad 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -46,7 +46,7 @@ extern struct zebra_privs_t zserv_privs; -#if defined (HAVE_IPV6) && defined (HAVE_RTADV) +#if defined (HAVE_RTADV) #ifdef OPEN_BSD #include <netinet/icmp6.h> @@ -1728,4 +1728,4 @@ rtadv_cmd_init (void) { /* Empty.*/; } -#endif /* HAVE_RTADV && HAVE_IPV6 */ +#endif /* HAVE_RTADV */ diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index a09008b39..0d9f80932 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -54,14 +54,13 @@ addr_to_a (u_char af, void *addr) case AF_INET: return inet_ntoa (*((struct in_addr *) addr)); - -#ifdef HAVE_IPV6 + break; case AF_INET6: return inet6_ntoa (*((struct in6_addr *) addr)); -#endif - + break; default: return "<Addr in unknown AF>"; + break; } } @@ -93,12 +92,10 @@ af_addr_size (u_char af) case AF_INET: return 4; - -#ifdef HAVE_IPV6 + break; case AF_INET6: return 16; -#endif - + break; default: assert(0); return 16; diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index c5223199a..194833f1e 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -714,13 +714,11 @@ zebra_ptm_bfd_dst_register (struct zserv *client, int sock, u_short length, inet_ntop(AF_INET, &dst_p.u.prefix4, buf, sizeof(buf)); ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_DST_IP_FIELD, buf); } -#ifdef HAVE_IPV6 else { inet_ntop(AF_INET6, &dst_p.u.prefix6, buf, sizeof(buf)); ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_DST_IP_FIELD, buf); } -#endif /* HAVE_IPV6 */ min_rx_timer = stream_getl(s); sprintf(tmp_buf, "%d", min_rx_timer); @@ -755,14 +753,12 @@ zebra_ptm_bfd_dst_register (struct zserv *client, int sock, u_short length, ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_SRC_IP_FIELD, buf); } -#ifdef HAVE_IPV6 else { inet_ntop(AF_INET6, &src_p.u.prefix6, buf, sizeof(buf)); ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_SRC_IP_FIELD, buf); } -#endif /* HAVE_IPV6 */ multi_hop_cnt = stream_getc(s); sprintf(tmp_buf, "%d", multi_hop_cnt); @@ -775,7 +771,6 @@ zebra_ptm_bfd_dst_register (struct zserv *client, int sock, u_short length, } else { -#ifdef HAVE_IPV6 if (dst_p.family == AF_INET6) { src_p.family = stream_getw(s); @@ -799,7 +794,6 @@ zebra_ptm_bfd_dst_register (struct zserv *client, int sock, u_short length, ZEBRA_PTM_BFD_SRC_IP_FIELD, buf); } } -#endif /* HAVE_IPV6 */ len = stream_getc(s); stream_get(if_name, s, len); if_name[len] = '\0'; @@ -875,17 +869,11 @@ zebra_ptm_bfd_dst_deregister (struct zserv *client, int sock, u_short length, stream_get(&dst_p.u.prefix, s, dst_p.prefixlen); if (dst_p.family == AF_INET) - { - inet_ntop(AF_INET, &dst_p.u.prefix4, buf, sizeof(buf)); - ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_DST_IP_FIELD, buf); - } -#ifdef HAVE_IPV6 + inet_ntop(AF_INET, &dst_p.u.prefix4, buf, sizeof(buf)); else - { - inet_ntop(AF_INET6, &dst_p.u.prefix6, buf, sizeof(buf)); - ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_DST_IP_FIELD, buf); - } -#endif /* HAVE_IPV6 */ + inet_ntop(AF_INET6, &dst_p.u.prefix6, buf, sizeof(buf)); + ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_DST_IP_FIELD, buf); + multi_hop = stream_getc(s); if (multi_hop) @@ -908,21 +896,18 @@ zebra_ptm_bfd_dst_deregister (struct zserv *client, int sock, u_short length, ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_SRC_IP_FIELD, buf); } -#ifdef HAVE_IPV6 else { inet_ntop(AF_INET6, &src_p.u.prefix6, buf, sizeof(buf)); ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_SRC_IP_FIELD, buf); } -#endif /* HAVE_IPV6 */ if (zvrf_id (zvrf) != VRF_DEFAULT) ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_VRF_NAME_FIELD, zvrf_name (zvrf)); } else { -#ifdef HAVE_IPV6 if (dst_p.family == AF_INET6) { src_p.family = stream_getw(s); @@ -946,7 +931,6 @@ zebra_ptm_bfd_dst_deregister (struct zserv *client, int sock, u_short length, ZEBRA_PTM_BFD_SRC_IP_FIELD, buf); } } -#endif /* HAVE_IPV6 */ len = stream_getc(s); stream_get(if_name, s, len); diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index c4c11f98d..315d4832d 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -900,7 +900,6 @@ send_client (struct rnh *rnh, struct zserv *client, rnh_type_t type, vrf_id_t vr stream_put_in_addr (s, &nexthop->gate.ipv4); stream_putl (s, nexthop->ifindex); break; -#ifdef HAVE_IPV6 case NEXTHOP_TYPE_IPV6: stream_put (s, &nexthop->gate.ipv6, 16); break; @@ -908,7 +907,6 @@ send_client (struct rnh *rnh, struct zserv *client, rnh_type_t type, vrf_id_t vr stream_put (s, &nexthop->gate.ipv6, 16); stream_putl (s, nexthop->ifindex); break; -#endif /* HAVE_IPV6 */ default: /* do nothing */ break; diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index c467609f0..27bff68c7 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -1240,11 +1240,8 @@ route_set_src_compile (const char *arg) { union g_addr src, *psrc; - if ( -#ifdef HAVE_IPV6 - (inet_pton(AF_INET6, arg, &src.ipv6) == 1) || -#endif /* HAVE_IPV6 */ - (src.ipv4.s_addr && (inet_pton(AF_INET, arg, &src.ipv4) == 1))) + if (inet_pton(AF_INET6, arg, &src.ipv6) == 1 || + src.ipv4.s_addr && (inet_pton(AF_INET, arg, &src.ipv4) == 1)) { psrc = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (union g_addr)); *psrc = src; diff --git a/zebra/zserv.c b/zebra/zserv.c index b7e45d8df..d3c204d11 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -2525,7 +2525,6 @@ DEFUN (show_ip_forwarding, return CMD_SUCCESS; } -#ifdef HAVE_IPV6 /* Only display ipv6 forwarding is enabled or not. */ DEFUN (show_ipv6_forwarding, show_ipv6_forwarding_cmd, @@ -2599,8 +2598,6 @@ DEFUN (no_ipv6_forwarding, return CMD_SUCCESS; } -#endif /* HAVE_IPV6 */ - /* IPForwarding configuration write function. */ static int config_write_forwarding (struct vty *vty) @@ -2610,10 +2607,8 @@ config_write_forwarding (struct vty *vty) if (!ipforward ()) vty_out (vty, "no ip forwarding%s", VTY_NEWLINE); -#ifdef HAVE_IPV6 if (!ipforward_ipv6 ()) vty_out (vty, "no ipv6 forwarding%s", VTY_NEWLINE); -#endif /* HAVE_IPV6 */ vty_out (vty, "!%s", VTY_NEWLINE); return 0; } @@ -2671,11 +2666,9 @@ zebra_init (void) install_element (CONFIG_NODE, &no_config_table_cmd); #endif /* HAVE_NETLINK */ -#ifdef HAVE_IPV6 install_element (VIEW_NODE, &show_ipv6_forwarding_cmd); install_element (CONFIG_NODE, &ipv6_forwarding_cmd); install_element (CONFIG_NODE, &no_ipv6_forwarding_cmd); -#endif /* HAVE_IPV6 */ /* Route-map */ zebra_route_map_init (); |