diff options
author | Michele Marchetto <michele@cvs.openbsd.org> | 2009-09-26 18:24:59 +0000 |
---|---|---|
committer | Michele Marchetto <michele@cvs.openbsd.org> | 2009-09-26 18:24:59 +0000 |
commit | 38b856dcd22219107f99d3513dff9a01bc21f92f (patch) | |
tree | bde8d12d88906d9ceb2737b510754dd9533bb01c /usr.sbin/ripd/interface.c | |
parent | 151bfa991daa354ecea4c9d2060f041f8fa09906 (diff) |
Preliminary rdomain support.
ok claudio@
Diffstat (limited to 'usr.sbin/ripd/interface.c')
-rw-r--r-- | usr.sbin/ripd/interface.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.sbin/ripd/interface.c b/usr.sbin/ripd/interface.c index 6d1752de309..1960251ecd2 100644 --- a/usr.sbin/ripd/interface.c +++ b/usr.sbin/ripd/interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interface.c,v 1.7 2009/09/26 11:12:50 michele Exp $ */ +/* $OpenBSD: interface.c,v 1.8 2009/09/26 18:24:58 michele Exp $ */ /* * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it> @@ -72,9 +72,24 @@ static const char * const if_event_names[] = { void if_init(struct ripd_conf *xconf, struct iface *iface) { + struct ifreq ifr; + u_int rdomain; + /* XXX as in ospfd I would like to kill that. This is a design error */ iface->fd = xconf->rip_socket; + strlcpy(ifr.ifr_name, iface->name, sizeof(ifr.ifr_name)); + if (ioctl(iface->fd, SIOCGIFRTABLEID, (caddr_t)&ifr) == -1) + rdomain = 0; + else { + rdomain = ifr.ifr_rdomainid; + if (setsockopt(iface->fd, IPPROTO_IP, SO_RDOMAIN, &rdomain, + sizeof(rdomain)) == -1) + fatal("failed to set rdomain"); + } + if (rdomain != xconf->rdomain) + fatalx("interface rdomain mismatch"); + ripe_demote_iface(iface, 0); } |