*: merge branch stable/0.99.23

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2014-08-19 18:15:40 +02:00
commit 1520e47481
8 changed files with 116 additions and 22 deletions

View File

@ -78,7 +78,7 @@ community_del_val (struct community *com, u_int32_t *val)
c = com->size -i -1; c = com->size -i -1;
if (c > 0) 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--; com->size--;

View File

@ -442,7 +442,7 @@ dnl Check other header files.
dnl ------------------------- dnl -------------------------
AC_CHECK_HEADERS([stropts.h sys/ksym.h sys/times.h sys/select.h \ 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/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]) sys/socket.h netinet/in.h time.h sys/time.h])
dnl Utility macro to avoid retyping includes all the time dnl Utility macro to avoid retyping includes all the time
@ -1204,21 +1204,22 @@ dnl ----------
if test "$zebra_cv_linux_ipv6" = "yes";then if test "$zebra_cv_linux_ipv6" = "yes";then
AC_MSG_CHECKING(for GNU libc >= 2.1) AC_MSG_CHECKING(for GNU libc >= 2.1)
AC_DEFINE(HAVE_IPV6,1,Linux IPv6) AC_DEFINE(HAVE_IPV6,1,Linux IPv6)
AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
AC_EGREP_CPP(yes, [ AC_EGREP_CPP(yes, [
#include <features.h> #include <features.h>
#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
yes yes
#endif], #endif],
[glibc=yes [glibc=yes
AC_DEFINE(LINUX_IPV6,1,Linux IPv6 stack)
AC_MSG_RESULT(yes)], AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
RIPNGD="ripngd" RIPNGD="ripngd"
OSPF6D="ospf6d" OSPF6D="ospf6d"
if test "$glibc" != "yes"; then if test "$glibc" != "yes"; then
INCLUDES="-I/usr/inet6/include"
if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then 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" LIB_IPV6="-L/usr/inet6/lib -linet6"
fi fi
fi fi

View File

@ -192,7 +192,7 @@ extern struct protosw isosw[];
#else #else
/* user utilities definitions from the iso library */ /* user utilities definitions from the iso library */
#ifdef SUNOS_5 #ifndef HAVE_SYS_CDEFS_H
#define __P(x) x #define __P(x) x
#define __BEGIN_DECLS #define __BEGIN_DECLS
#define __END_DECLS #define __END_DECLS

View File

@ -402,6 +402,7 @@ process_p2p_hello (struct isis_circuit *circuit)
u_int32_t expected = 0, found = 0, auth_tlv_offset = 0; u_int32_t expected = 0, found = 0, auth_tlv_offset = 0;
uint16_t pdu_len; uint16_t pdu_len;
struct tlvs tlvs; struct tlvs tlvs;
int v4_usable = 0, v6_usable = 0;
if (isis->debugs & DEBUG_ADJ_PACKETS) 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 * check if it's own interface ip match iih ip addrs
*/ */
if ((found & TLVFLAG_IPV4_ADDR) == 0 || if (found & TLVFLAG_IPV4_ADDR)
ip_match (circuit->ip_addrs, tlvs.ipv4_addrs) == 0) {
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); free_tlvs (&tlvs);
return ISIS_WARNING; return ISIS_WARNING;
} }
@ -859,6 +893,7 @@ process_lan_hello (int level, struct isis_circuit *circuit, u_char * ssnpa)
struct tlvs tlvs; struct tlvs tlvs;
u_char *snpa; u_char *snpa;
struct listnode *node; struct listnode *node;
int v4_usable = 0, v6_usable = 0;
if (isis->debugs & DEBUG_ADJ_PACKETS) if (isis->debugs & DEBUG_ADJ_PACKETS)
{ {
@ -1045,14 +1080,48 @@ process_lan_hello (int level, struct isis_circuit *circuit, u_char * ssnpa)
/* /*
* check if it's own interface ip match iih ip addrs * check if it's own interface ip match iih ip addrs
*/ */
if ((found & TLVFLAG_IPV4_ADDR) == 0 || if (found & TLVFLAG_IPV4_ADDR)
ip_match (circuit->ip_addrs, tlvs.ipv4_addrs) == 0)
{ {
zlog_debug ("ISIS-Adj: No usable IP interface addresses " if (ip_match (circuit->ip_addrs, tlvs.ipv4_addrs))
"in LAN IIH from %s\n", circuit->interface->name); v4_usable = 1;
retval = ISIS_WARNING; else
goto out; 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]); adj = isis_adj_lookup (hdr.source_id, circuit->u.bc.adjdb[level - 1]);
if ((adj == NULL) || (memcmp(adj->snpa, ssnpa, ETH_ALEN)) || if ((adj == NULL) || (memcmp(adj->snpa, ssnpa, ETH_ALEN)) ||

View File

@ -33,8 +33,6 @@
#ifndef _SYS_QUEUE_H_ #ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_ #define _SYS_QUEUE_H_
#include <sys/cdefs.h>
/* /*
* This file defines four types of data structures: singly-linked lists, * This file defines four types of data structures: singly-linked lists,
* singly-linked tail queues, lists and tail queues. * singly-linked tail queues, lists and tail queues.

View File

@ -805,6 +805,16 @@ zebra_interface_address_read (int type, struct stream *s)
ifc->flags = ifc_flags; ifc->flags = ifc_flags;
if (ifc->destination) if (ifc->destination)
ifc->destination->prefixlen = ifc->address->prefixlen; 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 else

View File

@ -478,7 +478,7 @@ parse_test (struct peer *peer, struct test_segment *t, int type)
printf ("parsed?: %s\n", ret ? "no" : "yes"); printf ("parsed?: %s\n", ret ? "no" : "yes");
if (ret != t->parses) if ((ret == 0) != (t->parses == 0))
failed++; failed++;
if (tty) if (tty)

View File

@ -282,9 +282,17 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
while (1) while (1)
{ {
char buf[NL_PKT_BUF_SIZE]; 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 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; struct nlmsghdr *h;
status = recvmsg (nl->sock, &msg, 0); status = recvmsg (nl->sock, &msg, 0);
@ -1312,8 +1320,16 @@ netlink_talk (struct nlmsghdr *n, struct nlsock *nl)
{ {
int status; int status;
struct sockaddr_nl snl; struct sockaddr_nl snl;
struct iovec iov = { (void *) n, n->nlmsg_len }; struct iovec iov = {
struct msghdr msg = { (void *) &snl, sizeof snl, &iov, 1, NULL, 0, 0 }; .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; int save_errno;
memset (&snl, 0, sizeof snl); memset (&snl, 0, sizeof snl);