From 2c61ae37821f4ece2b2f22d716ac8a135808e70c Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 16 Aug 2005 15:22:14 +0000 Subject: 2005-08-16 Paul Jakma * ripd.c: (general) Fix previous commit, broke multicast bind and hence setting of source port, which broke communication with non-borken ripd. Fix removes more stuff from rip_interface.c than it adds to ripd.c ;) (rip_create_socket) the to argument really is a from argument, rename it. Set the source port to RIP port unconditionally, it's required. (rip_send_packet) Set from address correctly for multicast. (rip_output_process) trivial: num can be BSS specified, rather than in body. * rip_interface.c: (rip_interface_multicast_set) strip out redundant stuff related to bind, which rip_create_socket does. Just make it set the multicast socket option, as per the interface concerned, no more. --- ripd/rip_interface.c | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) (limited to 'ripd/rip_interface.c') diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 4a6f78e2..5fa4b7d3 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -139,9 +139,6 @@ rip_interface_new () void rip_interface_multicast_set (int sock, struct connected *connected) { - int ret; - struct servent *sp; - struct sockaddr_in from; struct in_addr addr; struct prefix_ipv4 *p; @@ -161,43 +158,8 @@ rip_interface_multicast_set (int sock, struct connected *connected) "source address %s for interface %s", sock, inet_ntoa(addr), connected->ifp->name); - return; - } - - /* Bind myself. */ - memset (&from, 0, sizeof (struct sockaddr_in)); - - /* Set RIP port. */ - sp = getservbyname ("router", "udp"); - if (sp) - from.sin_port = sp->s_port; - else - from.sin_port = htons (RIP_PORT_DEFAULT); - - /* Address should be any address. */ - from.sin_family = AF_INET; - from.sin_addr = connected->address->u.prefix4; -#ifdef HAVE_SIN_LEN - from.sin_len = sizeof (struct sockaddr_in); -#endif /* HAVE_SIN_LEN */ - - if (ripd_privs.change (ZPRIVS_RAISE)) - zlog_err ("rip_interface_multicast_set: could not raise privs"); - - ret = bind (sock, (struct sockaddr *) & from, sizeof (struct sockaddr_in)); - if (ret < 0) - { - zlog_warn ("Can't bind socket fd %d to %s port %d for " - "interface %s: %s", - sock,inet_ntoa(from.sin_addr), - (int)ntohs(from.sin_port), - connected->ifp->name, - safe_strerror (errno)); } - - if (ripd_privs.change (ZPRIVS_LOWER)) - zlog_err ("rip_interface_multicast_set: could not lower privs"); - + return; } -- cgit v1.2.1