[PATCH] fix src address for rip with IPv4

Roman Hoog Antink rha at open.ch
Fri Oct 21 07:43:19 CEST 2011


This patch fixes RIP under Linux with IPv4 (IPv6 not tested).

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.

Signed-off-by: Roman Hoog Antink <rha at open.ch>
---
 proto/rip/rip.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index 0259cfb..a17228d 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -709,15 +709,13 @@ 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);
 #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;
     }
+    rif->sock->saddr = new->addr->ip;
   }
    if (!ipa_nonzero(rif->sock->daddr)) {
-- 
1.7.4.1




More information about the Bird-users mailing list