summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_nexthop.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_nexthop.c')
-rw-r--r--bgpd/bgp_nexthop.c46
1 files changed, 5 insertions, 41 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index bfc41a184..50ae74e45 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -543,7 +543,6 @@ bgp_connected_add (struct connected *ifc)
{
struct prefix p;
struct prefix *addr;
- struct prefix *dest;
struct interface *ifp;
struct bgp_node *rn;
struct bgp_connected_ref *bc;
@@ -557,19 +556,10 @@ bgp_connected_add (struct connected *ifc)
return;
addr = ifc->address;
- dest = ifc->destination;
if (addr->family == AF_INET)
{
- memset (&p, 0, sizeof (struct prefix));
- p.family = AF_INET;
- p.prefixlen = addr->prefixlen;
-
- if (CONNECTED_POINTOPOINT_HOST(ifc))
- p.u.prefix4 = dest->u.prefix4;
- else
- p.u.prefix4 = addr->u.prefix4;
-
+ PREFIX_COPY_IPV4(&p, CONNECTED_PREFIX(ifc));
apply_mask_ipv4 ((struct prefix_ipv4 *) &p);
if (prefix_ipv4_any ((struct prefix_ipv4 *) &p))
@@ -590,17 +580,9 @@ bgp_connected_add (struct connected *ifc)
}
}
#ifdef HAVE_IPV6
- if (addr->family == AF_INET6)
+ else if (addr->family == AF_INET6)
{
- memset (&p, 0, sizeof (struct prefix));
- p.family = AF_INET6;
- p.prefixlen = addr->prefixlen;
-
- if (if_is_pointopoint (ifp) && dest)
- p.u.prefix6 = dest->u.prefix6;
- else
- p.u.prefix6 = addr->u.prefix6;
-
+ PREFIX_COPY_IPV6(&p, CONNECTED_PREFIX(ifc));
apply_mask_ipv6 ((struct prefix_ipv6 *) &p);
if (IN6_IS_ADDR_UNSPECIFIED (&p.u.prefix6))
@@ -631,7 +613,6 @@ bgp_connected_delete (struct connected *ifc)
{
struct prefix p;
struct prefix *addr;
- struct prefix *dest;
struct interface *ifp;
struct bgp_node *rn;
struct bgp_connected_ref *bc;
@@ -642,19 +623,10 @@ bgp_connected_delete (struct connected *ifc)
return;
addr = ifc->address;
- dest = ifc->destination;
if (addr->family == AF_INET)
{
- memset (&p, 0, sizeof (struct prefix));
- p.family = AF_INET;
- p.prefixlen = addr->prefixlen;
-
- if (CONNECTED_POINTOPOINT_HOST(ifc))
- p.u.prefix4 = dest->u.prefix4;
- else
- p.u.prefix4 = addr->u.prefix4;
-
+ PREFIX_COPY_IPV4(&p, CONNECTED_PREFIX(ifc));
apply_mask_ipv4 ((struct prefix_ipv4 *) &p);
if (prefix_ipv4_any ((struct prefix_ipv4 *) &p))
@@ -677,15 +649,7 @@ bgp_connected_delete (struct connected *ifc)
#ifdef HAVE_IPV6
else if (addr->family == AF_INET6)
{
- memset (&p, 0, sizeof (struct prefix));
- p.family = AF_INET6;
- p.prefixlen = addr->prefixlen;
-
- if (if_is_pointopoint (ifp) && dest)
- p.u.prefix6 = dest->u.prefix6;
- else
- p.u.prefix6 = addr->u.prefix6;
-
+ PREFIX_COPY_IPV6(&p, CONNECTED_PREFIX(ifc));
apply_mask_ipv6 ((struct prefix_ipv6 *) &p);
if (IN6_IS_ADDR_UNSPECIFIED (&p.u.prefix6))