summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/ChangeLog5
-rw-r--r--bgpd/bgp_nexthop.c46
2 files changed, 10 insertions, 41 deletions
diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog
index 97f78caa..257b0eeb 100644
--- a/bgpd/ChangeLog
+++ b/bgpd/ChangeLog
@@ -1,3 +1,8 @@
+2006-12-12 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+ * bgp_nexthop.c: (bgp_connected_add, bgp_connected_delete)
+ Simplify logic by using new CONNECTED_PREFIX macro.
+
2006-12-07 Paul Jakma <paul.jakma@sun.com>
* bgp_fsm.c: Bug #302 fix, diagnosis, suggestions and testing
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index bfc41a18..50ae74e4 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))