diff options
author | 2009-04-11 10:21:20 +0000 | |
---|---|---|
committer | 2009-04-11 10:21:20 +0000 | |
commit | f4f4ba25640210c80f587fed3ebd0af844ba386b (patch) | |
tree | 3a88ab093a8e878d036d4aeb07bd099019f30978 | |
parent | Show debug informations when a route is added and when a downstream router (diff) | |
download | wireguard-openbsd-f4f4ba25640210c80f587fed3ebd0af844ba386b.tar.xz wireguard-openbsd-f4f4ba25640210c80f587fed3ebd0af844ba386b.zip |
When inserting a new route add as downstream interfaces just the ones with
downstream neighbors or group members.
ok claudio@
-rw-r--r-- | usr.sbin/dvmrpd/rde.c | 30 |
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) |