Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster

This commit is contained in:
vivek 2015-11-20 08:51:48 -08:00
commit 922705ecdc
10 changed files with 28 additions and 130 deletions

View File

@ -383,36 +383,6 @@ if_lookup_address (void *matchaddr, int family)
return if_lookup_address_vrf (matchaddr, family, VRF_DEFAULT); return if_lookup_address_vrf (matchaddr, family, VRF_DEFAULT);
} }
/* Lookup anchor interface by IPv4 address. */
struct connected *
if_anchor_lookup_by_address (struct in_addr src)
{
struct listnode *node;
struct listnode *cnode;
struct interface *ifp;
struct prefix *p;
struct connected *c;
for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
{
for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, c))
{
if (CHECK_FLAG(c->flags, ZEBRA_IFA_UNNUMBERED) ||
!CHECK_FLAG(c->conf, ZEBRA_IFC_REAL))
continue;
p = c->address;
if (p && p->family == AF_INET)
{
if (IPV4_ADDR_SAME (&p->u.prefix4, &src))
return c;
}
}
}
return NULL;
}
/* Lookup interface by prefix */ /* Lookup interface by prefix */
struct interface * struct interface *
if_lookup_prefix_vrf (struct prefix *prefix, vrf_id_t vrf_id) if_lookup_prefix_vrf (struct prefix *prefix, vrf_id_t vrf_id)

View File

@ -190,12 +190,6 @@ struct connected
Note: destination may be NULL if ZEBRA_IFA_PEER is not set. */ Note: destination may be NULL if ZEBRA_IFA_PEER is not set. */
struct prefix *destination; struct prefix *destination;
/* A list of unnumbered IFCs borrowing the address from me */
struct list *unnumbered;
/* Pointer to the anchor IFC if I'm unnumbered */
struct connected *anchor;
/* Label for Linux 2.2.X and upper. */ /* Label for Linux 2.2.X and upper. */
char *label; char *label;
}; };
@ -271,7 +265,6 @@ extern struct interface *if_lookup_by_index (unsigned int);
extern struct interface *if_lookup_exact_address (void *matchaddr, int family); extern struct interface *if_lookup_exact_address (void *matchaddr, int family);
extern struct interface *if_lookup_address (void *matchaddr, int family); extern struct interface *if_lookup_address (void *matchaddr, int family);
extern struct interface *if_lookup_prefix (struct prefix *prefix); extern struct interface *if_lookup_prefix (struct prefix *prefix);
extern struct connected *if_anchor_lookup_by_address (struct in_addr src);
extern struct interface *if_create_vrf (const char *name, int namelen, extern struct interface *if_create_vrf (const char *name, int namelen,
vrf_id_t vrf_id); vrf_id_t vrf_id);

View File

@ -1021,7 +1021,7 @@ zlog_hexdump (void *mem, unsigned int len) {
if (j >= len) /* end of block, not really printing */ if (j >= len) /* end of block, not really printing */
s += sprintf(s, " "); s += sprintf(s, " ");
else if(isprint(((char*)mem)[j])) /* printable char */ else if(isprint((int)((char*)mem)[j])) /* printable char */
s += sprintf(s, "%c", 0xFF & ((char*)mem)[j]); s += sprintf(s, "%c", 0xFF & ((char*)mem)[j]);
else /* other char */ else /* other char */

View File

@ -79,20 +79,12 @@ connected_announce (struct interface *ifp, struct connected *ifc)
if (!ifc) if (!ifc)
return; return;
if (ifc->address->family == AF_INET) if (!if_is_loopback(ifp) && ifc->address->family == AF_INET)
{ {
if ((ifc->anchor = if_anchor_lookup_by_address(ifc->address->u.prefix4))) if (ifc->address->prefixlen == 32)
{
/* found an anchor, so I'm unnumbered */
SET_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED); SET_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED);
listnode_add (ifc->anchor->unnumbered, ifc);
}
else else
{
/* I'm numbered */
UNSET_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED); UNSET_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED);
ifc->unnumbered = list_new();
}
} }
listnode_add (ifp->connected, ifc); listnode_add (ifp->connected, ifc);
@ -339,42 +331,6 @@ connected_down_ipv4 (struct interface *ifp, struct connected *ifc)
rib_update_static (ifp->vrf_id); rib_update_static (ifp->vrf_id);
} }
void
connected_delete_ipv4_unnumbered (struct connected *ifc)
{
struct connected *new_anchor, *iter;
struct listnode *node;
if (CHECK_FLAG (ifc->flags, ZEBRA_IFA_UNNUMBERED))
{
listnode_delete (ifc->anchor->unnumbered, ifc);
ifc->anchor = NULL;
}
else /* I'm a numbered interface */
{
if (!list_isempty (ifc->unnumbered))
{
new_anchor = listgetdata (listhead (ifc->unnumbered));
new_anchor->unnumbered = ifc->unnumbered;
listnode_delete (new_anchor->unnumbered, new_anchor);
new_anchor->anchor = NULL;
/* new_anchor changed from unnumbered to numbered, notify clients */
zebra_interface_address_delete_update (new_anchor->ifp, new_anchor);
UNSET_FLAG (new_anchor->flags, ZEBRA_IFA_UNNUMBERED);
zebra_interface_address_add_update (new_anchor->ifp, new_anchor);
for (ALL_LIST_ELEMENTS_RO(new_anchor->unnumbered, node, iter))
iter->anchor = new_anchor;
}
else
{
list_free (ifc->unnumbered);
ifc->unnumbered = NULL;
}
}
}
/* Delete connected IPv4 route to the interface. */ /* Delete connected IPv4 route to the interface. */
void void
connected_delete_ipv4 (struct interface *ifp, int flags, struct in_addr *addr, connected_delete_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
@ -392,8 +348,6 @@ connected_delete_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
if (! ifc) if (! ifc)
return; return;
connected_delete_ipv4_unnumbered (ifc);
connected_withdraw (ifc); connected_withdraw (ifc);
if (IS_ZEBRA_DEBUG_RIB_DETAILED) if (IS_ZEBRA_DEBUG_RIB_DETAILED)

View File

@ -48,11 +48,11 @@
#define ZEBRA_PTM_SUPPORT #define ZEBRA_PTM_SUPPORT
#ifdef RTADV #if defined (HAVE_RTADV)
/* Order is intentional. Matches RFC4191. This array is also used for /* Order is intentional. Matches RFC4191. This array is also used for
command matching, so only modify with care. */ command matching, so only modify with care. */
const char *rtadv_pref_strs[] = { "medium", "high", "INVALID", "low", 0 }; const char *rtadv_pref_strs[] = { "medium", "high", "INVALID", "low", 0 };
#endif /* RTADV */ #endif /* HAVE_RTADV */
/* Called when new interface is added. */ /* Called when new interface is added. */
static int static int
@ -66,7 +66,7 @@ if_zebra_new_hook (struct interface *ifp)
zebra_if->shutdown = IF_ZEBRA_SHUTDOWN_OFF; zebra_if->shutdown = IF_ZEBRA_SHUTDOWN_OFF;
ifp->ptm_enable = zebra_ptm_get_enable_state(); ifp->ptm_enable = zebra_ptm_get_enable_state();
#ifdef RTADV #if defined (HAVE_RTADV)
{ {
/* Set default router advertise values. */ /* Set default router advertise values. */
struct rtadvconf *rtadv; struct rtadvconf *rtadv;
@ -92,7 +92,7 @@ if_zebra_new_hook (struct interface *ifp)
rtadv->AdvPrefixList = list_new (); rtadv->AdvPrefixList = list_new ();
} }
#endif /* RTADV */ #endif /* HAVE_RTADV */
/* Initialize installed address chains tree. */ /* Initialize installed address chains tree. */
zebra_if->ipv4_subnets = route_table_init (); zebra_if->ipv4_subnets = route_table_init ();
@ -478,7 +478,6 @@ if_delete_update (struct interface *ifp)
UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL); UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL);
UNSET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED); UNSET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED);
connected_delete_ipv4_unnumbered(ifc);
/* Remove from subnet chain. */ /* Remove from subnet chain. */
list_delete_node (addr_list, anode); list_delete_node (addr_list, anode);
@ -753,7 +752,7 @@ nbr_connected_dump_vty (struct vty *vty, struct nbr_connected *connected)
vty_out (vty, "%s", VTY_NEWLINE); vty_out (vty, "%s", VTY_NEWLINE);
} }
#ifdef RTADV #if defined (HAVE_RTADV)
/* Dump interface ND information to vty. */ /* Dump interface ND information to vty. */
static void static void
nd_dump_vty (struct vty *vty, struct interface *ifp) nd_dump_vty (struct vty *vty, struct interface *ifp)
@ -814,7 +813,7 @@ nd_dump_vty (struct vty *vty, struct interface *ifp)
VTY_NEWLINE); VTY_NEWLINE);
} }
} }
#endif /* RTADV */ #endif /* HAVE_RTADV */
/* Interface's information print out to vty interface. */ /* Interface's information print out to vty interface. */
static void static void
@ -924,9 +923,9 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
connected_dump_vty (vty, connected); connected_dump_vty (vty, connected);
} }
#ifdef RTADV #if defined (HAVE_RTADV)
nd_dump_vty (vty, ifp); nd_dump_vty (vty, ifp);
#endif /* RTADV */ #endif /* HAVE_RTADV */
if (listhead(ifp->nbr_connected)) if (listhead(ifp->nbr_connected))
vty_out (vty, " Neighbor address(s):%s", VTY_NEWLINE); vty_out (vty, " Neighbor address(s):%s", VTY_NEWLINE);
for (ALL_LIST_ELEMENTS_RO (ifp->nbr_connected, node, nbr_connected)) for (ALL_LIST_ELEMENTS_RO (ifp->nbr_connected, node, nbr_connected))
@ -1912,9 +1911,9 @@ if_config_write (struct vty *vty)
VTY_NEWLINE); VTY_NEWLINE);
} }
#ifdef RTADV #if defined (HAVE_RTADV)
rtadv_config_write (vty, ifp); rtadv_config_write (vty, ifp);
#endif /* RTADV */ #endif /* HAVE_RTADV */
#ifdef HAVE_IRDP #ifdef HAVE_IRDP
irdp_config_write (vty, ifp); irdp_config_write (vty, ifp);

View File

@ -37,16 +37,7 @@
#define IF_ZEBRA_SHUTDOWN_OFF 0 #define IF_ZEBRA_SHUTDOWN_OFF 0
#define IF_ZEBRA_SHUTDOWN_ON 1 #define IF_ZEBRA_SHUTDOWN_ON 1
/* Router advertisement feature. */ #if defined (HAVE_RTADV)
#ifndef RTADV
#if (defined(LINUX_IPV6) && (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1)) || defined(KAME)
#ifdef HAVE_RTADV
#define RTADV
#endif
#endif
#endif
#ifdef RTADV
/* Router advertisement parameter. From RFC4861, RFC6275 and RFC4191. */ /* Router advertisement parameter. From RFC4861, RFC6275 and RFC4191. */
struct rtadvconf struct rtadvconf
{ {
@ -180,7 +171,7 @@ struct rtadvconf
#define RTADV_PREF_MEDIUM 0x0 /* Per RFC4191. */ #define RTADV_PREF_MEDIUM 0x0 /* Per RFC4191. */
}; };
#endif /* RTADV */ #endif /* HAVE_RTADV */
/* `zebra' daemon local interface structure. */ /* `zebra' daemon local interface structure. */
struct zebra_if struct zebra_if
@ -197,9 +188,9 @@ struct zebra_if
/* Installed addresses chains tree. */ /* Installed addresses chains tree. */
struct route_table *ipv4_subnets; struct route_table *ipv4_subnets;
#ifdef RTADV #if defined(HAVE_RTADV)
struct rtadvconf rtadv; struct rtadvconf rtadv;
#endif /* RTADV */ #endif /* HAVE_RTADV */
#ifdef HAVE_IRDP #ifdef HAVE_IRDP
struct irdp_interface irdp; struct irdp_interface irdp;

View File

@ -238,7 +238,7 @@ zebra_vrf_enable (vrf_id_t vrf_id, void **info)
assert (zvrf); assert (zvrf);
#ifdef RTADV #if defined (HAVE_RTADV)
rtadv_init (zvrf); rtadv_init (zvrf);
#endif #endif
kernel_init (zvrf); kernel_init (zvrf);
@ -269,7 +269,7 @@ zebra_vrf_disable (vrf_id_t vrf_id, void **info)
if_down (ifp); if_down (ifp);
} }
#ifdef RTADV #if defined (HAVE_RTADV)
rtadv_terminate (zvrf); rtadv_terminate (zvrf);
#endif #endif
kernel_terminate (zvrf); kernel_terminate (zvrf);
@ -417,7 +417,7 @@ main (int argc, char **argv)
zebra_vty_init (); zebra_vty_init ();
access_list_init (); access_list_init ();
prefix_list_init (); prefix_list_init ();
#ifdef RTADV #if defined (HAVE_RTADV)
rtadv_cmd_init (); rtadv_cmd_init ();
#endif #endif
#ifdef HAVE_IRDP #ifdef HAVE_IRDP

View File

@ -259,16 +259,7 @@ struct static_route
: ((tnexthop) = (nexthop)->next)) \ : ((tnexthop) = (nexthop)->next)) \
: (((recursing) = 0),((tnexthop) = (tnexthop)->next))) : (((recursing) = 0),((tnexthop) = (tnexthop)->next)))
/* Router advertisement feature. */ #if defined (HAVE_RTADV)
#ifndef RTADV
#if (defined(LINUX_IPV6) && (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1)) || defined(KAME)
#ifdef HAVE_RTADV
#define RTADV
#endif
#endif
#endif
#if defined (RTADV)
/* Structure which hold status of router advertisement. */ /* Structure which hold status of router advertisement. */
struct rtadv struct rtadv
{ {
@ -280,7 +271,7 @@ struct rtadv
struct thread *ra_read; struct thread *ra_read;
struct thread *ra_timer; struct thread *ra_timer;
}; };
#endif /* RTADV */ #endif /* HAVE_RTADV */
#ifdef HAVE_NETLINK #ifdef HAVE_NETLINK
/* Socket interface to kernel */ /* Socket interface to kernel */
@ -338,9 +329,9 @@ struct zebra_vrf
struct list *rid_lo_sorted_list; struct list *rid_lo_sorted_list;
struct prefix rid_user_assigned; struct prefix rid_user_assigned;
#if defined (RTADV) #if defined (HAVE_RTADV)
struct rtadv rtadv; struct rtadv rtadv;
#endif /* RTADV */ #endif /* HAVE_RTADV */
}; };
/* /*

View File

@ -41,7 +41,7 @@
extern struct zebra_privs_t zserv_privs; extern struct zebra_privs_t zserv_privs;
#if defined (HAVE_IPV6) && defined (RTADV) #if defined (HAVE_IPV6) && defined (HAVE_RTADV)
#ifdef OPEN_BSD #ifdef OPEN_BSD
#include <netinet/icmp6.h> #include <netinet/icmp6.h>
@ -1863,4 +1863,4 @@ rtadv_cmd_init (void)
{ {
/* Empty.*/; /* Empty.*/;
} }
#endif /* RTADV && HAVE_IPV6 */ #endif /* HAVE_RTADV && HAVE_IPV6 */

View File

@ -27,7 +27,7 @@
#include "zebra/interface.h" #include "zebra/interface.h"
/* NB: RTADV is defined in zebra/interface.h above */ /* NB: RTADV is defined in zebra/interface.h above */
#ifdef RTADV #if defined (HAVE_RTADV)
/* Router advertisement prefix. */ /* Router advertisement prefix. */
struct rtadv_prefix struct rtadv_prefix
@ -98,7 +98,7 @@ struct nd_opt_homeagent_info { /* Home Agent info */
extern const char *rtadv_pref_strs[]; extern const char *rtadv_pref_strs[];
#endif /* RTADV */ #endif /* HAVE_RTADV */
extern void rtadv_init (struct zebra_vrf *); extern void rtadv_init (struct zebra_vrf *);
extern void rtadv_terminate (struct zebra_vrf *); extern void rtadv_terminate (struct zebra_vrf *);