ripd: improve passive interface

"Remi Locherer" <[email protected]>
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
Hi tech,

The passive keyword in ripd.conf ensures, that no RIP packets are
processed on the given interface.

Other RIP implementation advertise the prefixes from a passive interface.
ospfd and ospf6d also advertise prefixes from passive interfaces

This diff implements that behaviour for ripd.

OK?

Remi


--- usr.sbin/ripd/ripd.c
+++ usr.sbin/ripd/ripd.c
@@ -461,6 +461,14 @@ rip_redistribute(struct kroute *kr)
 	if (kr->flags & F_RIPD_INSERTED)
 		return (1);
 
+	/* redistribute prefixes from passive interfaces */
+	if (kr->flags & F_CONNECTED) {
+		struct iface *iface = if_find_index(kr->ifindex);
+
+		if (iface != NULL && iface->passive)
+			return (1);
+	}
+
 	/* only allow 0.0.0.0/0 via REDIST_DEFAULT */
 	if (kr->prefix.s_addr == INADDR_ANY && kr->netmask.s_addr == INADDR_ANY)
 		is_default = 1;

--- usr.sbin/ripd/ripd.conf.5
+++ usr.sbin/ripd/ripd.conf.5
@@ -221,7 +221,8 @@ when the interface state is going down.
 The demotion counter will be decreased when the interface
 state is active again.
 .It Ic passive
-Prevent transmission and reception of RIP packets on this interface.
+Prevent transmission and reception of RIP packets on this interface 
+and advertise all prefixes configured on this interface.
 .El
 .Sh FILES
 .Bl -tag -width /etc/examples/ripd.conf -compact
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.