summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-01-13 13:57:57 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-01-13 14:05:50 +0100
commit56c1f7d852de98aa5d752f9c7777ece660c26fdb (patch)
tree7cac20e7ea1d0ec6dd46a5398cd9b43643071b52 /lib
parentMerge pull request #55 from donaldsharp/monotonic (diff)
downloadfrr-56c1f7d852de98aa5d752f9c7777ece660c26fdb.tar.xz
frr-56c1f7d852de98aa5d752f9c7777ece660c26fdb.zip
frr: Remove HAVE_IPV6 from code base
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/bfd.c6
-rw-r--r--lib/filter.c21
-rw-r--r--lib/if.c2
-rw-r--r--lib/plist.c14
-rw-r--r--lib/prefix.c29
-rw-r--r--lib/prefix.h7
-rw-r--r--lib/smux.c42
-rw-r--r--lib/sockopt.c8
-rw-r--r--lib/sockopt.h7
-rw-r--r--lib/sockunion.c43
-rw-r--r--lib/sockunion.h4
-rw-r--r--lib/table.c2
-rw-r--r--lib/table.h2
-rw-r--r--lib/vty.c88
-rw-r--r--lib/zclient.c2
-rw-r--r--lib/zclient.h2
16 files changed, 1 insertions, 278 deletions
diff --git a/lib/bfd.c b/lib/bfd.c
index a498daf76..5db08fea6 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -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 */
}
diff --git a/lib/if.c b/lib/if.c
index 0a1a8f6a2..20f792b8f 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -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 *);
diff --git a/lib/vty.c b/lib/vty.c
index 1fe2e5d29..a0bcf130e 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -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 */