diff options
Diffstat (limited to 'ripd')
-rw-r--r-- | ripd/ChangeLog | 9 | ||||
-rw-r--r-- | ripd/rip_interface.c | 15 | ||||
-rw-r--r-- | ripd/ripd.c | 13 |
3 files changed, 23 insertions, 14 deletions
diff --git a/ripd/ChangeLog b/ripd/ChangeLog index 68813f14..ba13a595 100644 --- a/ripd/ChangeLog +++ b/ripd/ChangeLog @@ -1,3 +1,12 @@ +2006-12-12 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * rip_interface.c: (rip_interface_multicast_set) Use new CONNECTED_ID + macro to simplify logic. + (rip_request_interface_send) Fix minor bug: ipv4_broadcast_addr does + not give a useful result if prefixlen is 32 (we require a peer + address in such cases). + * ripd.c: (rip_update_interface) Fix same bug as above. + 2006-09-11 Paul Jakma <paul.jakma@sun.com> * ripd.c: (rip_read) remove gratuitous use of mid-function diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index a5b12db6..c8a1a84f 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -141,16 +141,10 @@ void rip_interface_multicast_set (int sock, struct connected *connected) { struct in_addr addr; - struct prefix_ipv4 *p; assert (connected != NULL); - if (if_is_pointopoint(connected->ifp) && CONNECTED_DEST_HOST(connected)) - p = (struct prefix_ipv4 *) connected->destination; - else - p = (struct prefix_ipv4 *) connected->address; - - addr = p->prefix; + addr = CONNECTED_ID(connected)->u.prefix4; if (setsockopt_multicast_ipv4 (sock, IP_MULTICAST_IF, addr, 0, connected->ifp->ifindex) < 0) @@ -197,13 +191,16 @@ rip_request_interface_send (struct interface *ifp, u_char version) memset (&to, 0, sizeof (struct sockaddr_in)); to.sin_port = htons (RIP_PORT_DEFAULT); if (connected->destination) - /* use specified broadcast or point-to-point destination addr */ + /* use specified broadcast or peer destination addr */ to.sin_addr = connected->destination->u.prefix4; - else + else if (connected->address->prefixlen < IPV4_MAX_PREFIXLEN) /* calculate the appropriate broadcast address */ to.sin_addr.s_addr = ipv4_broadcast_addr(connected->address->u.prefix4.s_addr, connected->address->prefixlen); + else + /* do not know where to send the packet */ + continue; if (IS_RIP_DEBUG_EVENT) zlog_debug ("SEND request to %s", inet_ntoa (to.sin_addr)); diff --git a/ripd/ripd.c b/ripd/ripd.c index a1630f6c..afa49fd6 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -2449,19 +2449,22 @@ rip_update_interface (struct connected *ifc, u_char version, int route_type) /* Destination address and port setting. */ memset (&to, 0, sizeof (struct sockaddr_in)); if (ifc->destination) - /* use specified broadcast or point-to-point destination addr */ + /* use specified broadcast or peer destination addr */ to.sin_addr = ifc->destination->u.prefix4; - else + else if (ifc->address->prefixlen < IPV4_MAX_PREFIXLEN) /* calculate the appropriate broadcast address */ to.sin_addr.s_addr = ipv4_broadcast_addr(ifc->address->u.prefix4.s_addr, ifc->address->prefixlen); + else + /* do not know where to send the packet */ + return; to.sin_port = htons (RIP_PORT_DEFAULT); if (IS_RIP_DEBUG_EVENT) - zlog_debug ("%s announce to %s on %s", - if_is_pointopoint (ifc->ifp) ? "unicast" : "broadcast", - inet_ntoa (to.sin_addr), ifc->ifp->name); + zlog_debug("%s announce to %s on %s", + CONNECTED_PEER(ifc) ? "unicast" : "broadcast", + inet_ntoa (to.sin_addr), ifc->ifp->name); rip_output_process (ifc, &to, route_type, version); } |