summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMichele Marchetto <michele@cvs.openbsd.org>2009-04-11 10:21:21 +0000
committerMichele Marchetto <michele@cvs.openbsd.org>2009-04-11 10:21:21 +0000
commit533dc34a1ccddbda2257b81cc5b5fabbee043939 (patch)
treec3a0d0a8acd1d546db691514d8b361413b2fbe22 /usr.sbin
parent783eef0bbca00be1a5c397bffc135f476431c4e7 (diff)
When inserting a new route add as downstream interfaces just the ones with
downstream neighbors or group members. ok claudio@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/dvmrpd/rde.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/usr.sbin/dvmrpd/rde.c b/usr.sbin/dvmrpd/rde.c
index 97ab615b86e..92aac1e4a81 100644
--- a/usr.sbin/dvmrpd/rde.c
+++ b/usr.sbin/dvmrpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.13 2009/03/14 15:32:55 michele Exp $ */
+/* $OpenBSD: rde.c,v 1.14 2009/04/11 10:21:20 michele Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -43,6 +43,8 @@ void rde_sig_handler(int sig, short, void *);
void rde_shutdown(void);
void rde_dispatch_imsg(int, short, void *);
+int rde_select_ds_ifs(struct mfc *, struct iface *);
+
volatile sig_atomic_t rde_quit = 0;
struct dvmrpd_conf *rdeconf = NULL;
struct rde_nbr *nbrself;
@@ -254,7 +256,7 @@ rde_dispatch_imsg(int fd, short event, void *bula)
mfc.ttls[i] = 0;
LIST_FOREACH(iface, &rdeconf->iface_list, entry) {
- if (mfc.ifindex != iface->ifindex)
+ if (rde_select_ds_ifs(&mfc, iface))
mfc.ttls[iface->ifindex] = 1;
}
@@ -311,6 +313,30 @@ rde_dispatch_imsg(int fd, short event, void *bula)
imsg_event_add(ibuf);
}
+int
+rde_select_ds_ifs(struct mfc *mfc, struct iface *iface)
+{
+ struct rt_node *rn;
+
+ if (mfc->ifindex == iface->ifindex)
+ return (0);
+
+ if (rde_group_list_find(iface, mfc->group))
+ return (1);
+
+ rn = rt_match_origin(mfc->origin.s_addr);
+ if (rn == NULL) {
+ log_debug("rde_selected_ds_iface: no informations about "
+ "the origin %s", inet_ntoa(mfc->origin));
+ return (0);
+ }
+
+ if (rn->ds_cnt[iface->ifindex] != 0)
+ return (1);
+
+ return (0);
+}
+
/* rde group functions */
void
rde_group_list_add(struct iface *iface, struct in_addr group)