Hi there I fixed RIP with IPv4 on Linux for both versions of RIP (broadcast and multicast).
The difference to my previous patch is, now both transmission and reception work. Cheers, Roman On 21/10/11 16:43, Roman Hoog Antink wrote: > RIP could not send packets under Linux/IPv4 because the source address > was set to the multicast destination address or the broadcast address > respectively. > This resulted in the following error when sending out the first packet: > Unexpected error at rip transmit: Invalid argument > Eventually no RIP packet could leave the host.
commit 104d91a3cf038b063badcdd2bb11966cede4604a Author: Roman Hoog Antink <[email protected]> Date: Wed Oct 26 14:42:48 2011 +1100 fix RIP with IPv4 for Linux RIP could neither receive nor send packets under Linux/IPv4 because of wrong source and bind address when creating the UDP socket. This resulted in the following error when sending out the first packet: Unexpected error at rip transmit: Invalid argument Eventually no RIP packet could leave the host. And neither multicast nor broadcast (RIP v1) could be received. diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 0259cfb..fe26ac4 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -709,14 +709,18 @@ new_iface(struct proto *p, struct iface *new, unsigned long flags, struct iface_ if (rif->multicast) { #ifndef IPV6 rif->sock->daddr = ipa_from_u32(0xe0000009); - rif->sock->saddr = ipa_from_u32(0xe0000009); + rif->sock->saddr = ipa_from_u32(INADDR_ANY); #else rif->sock->daddr = ipa_build(0xff020000, 0, 0, 9); rif->sock->saddr = new->addr->ip; #endif } else { rif->sock->daddr = new->addr->brd; - rif->sock->saddr = new->addr->brd; +#ifndef IPV6 + rif->sock->saddr = ipa_from_u32(INADDR_ANY); +#else + rif->sock->saddr = new->addr->ip; +#endif } }
