summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2014-08-19 18:15:40 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2014-08-19 18:15:40 +0200
commit1520e4748129c4eb97ac3090bcc97149a1900611 (patch)
treef4501a77bcb9e3ecabfd9dd5f80ee3e71cb35119
parent342a31bfda21616209366679ac522471e5772a2f (diff)
parent90444ca35e3037ed43ec695428f0ef6d82f9a320 (diff)
*: merge branch stable/0.99.23
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--bgpd/bgp_community.c2
-rwxr-xr-xconfigure.ac7
-rw-r--r--isisd/include-netbsd/iso.h2
-rw-r--r--isisd/isis_pdu.c89
-rw-r--r--lib/queue.h2
-rw-r--r--lib/zclient.c10
-rw-r--r--tests/bgp_mp_attr_test.c2
-rw-r--r--zebra/rt_netlink.c24
8 files changed, 116 insertions, 22 deletions
diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c
index fc1bef88b7..1bd2dd84e4 100644
--- a/bgpd/bgp_community.c
+++ b/bgpd/bgp_community.c
@@ -78,7 +78,7 @@ community_del_val (struct community *com, u_int32_t *val)
c = com->size -i -1;
if (c > 0)
- memcpy (com->val + i, com->val + (i + 1), c * sizeof (*val));
+ memmove (com->val + i, com->val + (i + 1), c * sizeof (*val));
com->size--;
diff --git a/configure.ac b/configure.ac
index 220124ab8e..f1df482b32 100755
--- a/configure.ac
+++ b/configure.ac
@@ -442,7 +442,7 @@ dnl Check other header files.
dnl -------------------------
AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \
sys/types.h linux/version.h netdb.h asm/types.h \
- sys/param.h limits.h signal.h \
+ sys/cdefs.h sys/param.h limits.h signal.h \
sys/socket.h netinet/in.h time.h sys/time.h])
dnl Utility macro to avoid retyping includes all the time
@@ -1204,21 +1204,22 @@ dnl ----------
if test "$zebra_cv_linux_ipv6" = "yes";then
AC_MSG_CHECKING(for GNU libc >= 2.1)
AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
+ AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
+
AC_EGREP_CPP(yes, [
#include <features.h>
#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
yes
#endif],
[glibc=yes
- AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no)
)
RIPNGD="ripngd"
OSPF6D="ospf6d"
if test "$glibc" != "yes"; then
- INCLUDES="-I/usr/inet6/include"
if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
+ INCLUDES="-I/usr/inet6/include"
LIB_IPV6="-L/usr/inet6/lib -linet6"
fi
fi
diff --git a/isisd/include-netbsd/iso.h b/isisd/include-netbsd/iso.h
index 1a80aec8e8..42b9bc88de 100644
--- a/isisd/include-netbsd/iso.h
+++ b/isisd/include-netbsd/iso.h
@@ -192,7 +192,7 @@ extern struct protosw isosw[];
#else
/* user utilities definitions from the iso library */
-#ifdef SUNOS_5
+#ifndef HAVE_SYS_CDEFS_H
#define __P(x) x
#define __BEGIN_DECLS
#define __END_DECLS
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index 8a92789ff1..e0208fa47f 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -402,6 +402,7 @@ process_p2p_hello (struct isis_circuit *circuit)
u_int32_t expected = 0, found = 0, auth_tlv_offset = 0;
uint16_t pdu_len;
struct tlvs tlvs;
+ int v4_usable = 0, v6_usable = 0;
if (isis->debugs & DEBUG_ADJ_PACKETS)
{
@@ -518,11 +519,44 @@ process_p2p_hello (struct isis_circuit *circuit)
/*
* check if it's own interface ip match iih ip addrs
*/
- if ((found & TLVFLAG_IPV4_ADDR) == 0 ||
- ip_match (circuit->ip_addrs, tlvs.ipv4_addrs) == 0)
+ if (found & TLVFLAG_IPV4_ADDR)
+ {
+ if (ip_match (circuit->ip_addrs, tlvs.ipv4_addrs))
+ v4_usable = 1;
+ else
+ 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? */
+ struct listnode *node;
+ struct in6_addr *ip;
+ for (ALL_LIST_ELEMENTS_RO (tlvs.ipv6_addrs, node, ip))
+ if (IN6_IS_ADDR_LINKLOCAL (ip))
+ {
+ v6_usable = 1;
+ break;
+ }
+
+ if (!v6_usable)
+ zlog_warn ("ISIS-Adj: IPv6 addresses present but no link-local "
+ "in P2P IIH from %s\n", circuit->interface->name);
+ }
+
+ 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)
{
- zlog_warn ("ISIS-Adj: No usable IP interface addresses "
- "in LAN IIH from %s\n", circuit->interface->name);
free_tlvs (&tlvs);
return ISIS_WARNING;
}
@@ -859,6 +893,7 @@ process_lan_hello (int level, struct isis_circuit *circuit, u_char * ssnpa)
struct tlvs tlvs;
u_char *snpa;
struct listnode *node;
+ int v4_usable = 0, v6_usable = 0;
if (isis->debugs & DEBUG_ADJ_PACKETS)
{
@@ -1045,15 +1080,49 @@ process_lan_hello (int level, struct isis_circuit *circuit, u_char * ssnpa)
/*
* check if it's own interface ip match iih ip addrs
*/
- if ((found & TLVFLAG_IPV4_ADDR) == 0 ||
- ip_match (circuit->ip_addrs, tlvs.ipv4_addrs) == 0)
+ if (found & TLVFLAG_IPV4_ADDR)
{
- zlog_debug ("ISIS-Adj: No usable IP interface addresses "
- "in LAN IIH from %s\n", circuit->interface->name);
- retval = ISIS_WARNING;
- goto out;
+ if (ip_match (circuit->ip_addrs, tlvs.ipv4_addrs))
+ v4_usable = 1;
+ else
+ 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? */
+ struct listnode *node;
+ struct in6_addr *ip;
+ for (ALL_LIST_ELEMENTS_RO (tlvs.ipv6_addrs, node, ip))
+ if (IN6_IS_ADDR_LINKLOCAL (ip))
+ {
+ v6_usable = 1;
+ break;
+ }
+
+ if (!v6_usable)
+ zlog_warn ("ISIS-Adj: IPv6 addresses present but no link-local "
+ "in LAN IIH from %s\n", circuit->interface->name);
}
+ 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)
+ {
+ free_tlvs (&tlvs);
+ return ISIS_WARNING;
+ }
+
+
adj = isis_adj_lookup (hdr.source_id, circuit->u.bc.adjdb[level - 1]);
if ((adj == NULL) || (memcmp(adj->snpa, ssnpa, ETH_ALEN)) ||
(adj->level != level))
diff --git a/lib/queue.h b/lib/queue.h
index 70cffab1b2..48b363e24d 100644
--- a/lib/queue.h
+++ b/lib/queue.h
@@ -33,8 +33,6 @@
#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
-#include <sys/cdefs.h>
-
/*
* This file defines four types of data structures: singly-linked lists,
* singly-linked tail queues, lists and tail queues.
diff --git a/lib/zclient.c b/lib/zclient.c
index 20188f6abd..3b5477e903 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -805,6 +805,16 @@ zebra_interface_address_read (int type, struct stream *s)
ifc->flags = ifc_flags;
if (ifc->destination)
ifc->destination->prefixlen = ifc->address->prefixlen;
+ else if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER))
+ {
+ /* carp interfaces on OpenBSD with 0.0.0.0/0 as "peer" */
+ char buf[BUFSIZ];
+ prefix2str (ifc->address, buf, sizeof(buf));
+ zlog_warn("warning: interface %s address %s "
+ "with peer flag set, but no peer address!",
+ ifp->name, buf);
+ UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
+ }
}
}
else
diff --git a/tests/bgp_mp_attr_test.c b/tests/bgp_mp_attr_test.c
index 177c1ad8dc..aa8e485d6e 100644
--- a/tests/bgp_mp_attr_test.c
+++ b/tests/bgp_mp_attr_test.c
@@ -478,7 +478,7 @@ parse_test (struct peer *peer, struct test_segment *t, int type)
printf ("parsed?: %s\n", ret ? "no" : "yes");
- if (ret != t->parses)
+ if ((ret == 0) != (t->parses == 0))
failed++;
if (tty)
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 452ea64218..95a82fd2e4 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -282,9 +282,17 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
while (1)
{
char buf[NL_PKT_BUF_SIZE];
- struct iovec iov = { buf, sizeof buf };
+ struct iovec iov = {
+ .iov_base = buf,
+ .iov_len = sizeof buf
+ };
struct sockaddr_nl snl;
- struct msghdr msg = { (void *) &snl, sizeof snl, &iov, 1, NULL, 0, 0 };
+ struct msghdr msg = {
+ .msg_name = (void *) &snl,
+ .msg_namelen = sizeof snl,
+ .msg_iov = &iov,
+ .msg_iovlen = 1
+ };
struct nlmsghdr *h;
status = recvmsg (nl->sock, &msg, 0);
@@ -1312,8 +1320,16 @@ netlink_talk (struct nlmsghdr *n, struct nlsock *nl)
{
int status;
struct sockaddr_nl snl;
- struct iovec iov = { (void *) n, n->nlmsg_len };
- struct msghdr msg = { (void *) &snl, sizeof snl, &iov, 1, NULL, 0, 0 };
+ struct iovec iov = {
+ .iov_base = (void *) n,
+ .iov_len = n->nlmsg_len
+ };
+ struct msghdr msg = {
+ .msg_name = (void *) &snl,
+ .msg_namelen = sizeof snl,
+ .msg_iov = &iov,
+ .msg_iovlen = 1,
+ };
int save_errno;
memset (&snl, 0, sizeof snl);