diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-08-03 11:22:16 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-08-03 11:22:16 +0000 |
commit | 4db9c1a02eeb9a2f2cab3f9d37ff1c15ce1b91dd (patch) | |
tree | 886d0b81496ebec1a778d257f7db7e5768c8399e /sys/net/rtsock.c | |
parent | b337bae270d603117da35f981f247b3da7e438c2 (diff) |
introduce route labels, allowing for up to 32 bytes of info to be attached
to a route.
the label is sent over the routing socket wrapped into a new
struct sockaddr_rtlabel, allowing for handling it like any other sockaddr.
struct rtentry only contains a (16 bit) label-ID, with the actual labels
kept outside the routing table.
ID allocator code inspired by my own code for altq and pf tags.
mostly hacked at the c2k4 hackathon, markus ok
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r-- | sys/net/rtsock.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 9280cb1c994..41962950d62 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.41 2004/06/24 22:25:25 henning Exp $ */ +/* $OpenBSD: rtsock.c,v 1.42 2004/08/03 11:22:15 henning Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -180,6 +180,8 @@ route_output(struct mbuf *m, ...) struct ifaddr *ifa = NULL; struct socket *so; struct rawcb *rp = NULL; + struct sockaddr_rtlabel sa_rt; + const char *label; va_list ap; va_start(ap, m); @@ -320,6 +322,18 @@ report: gate = rt->rt_gateway; netmask = rt_mask(rt); genmask = rt->rt_genmask; + + if (rt->rt_labelid) { + bzero(&sa_rt, sizeof(sa_rt)); + sa_rt.sr_len = sizeof(sa_rt); + label = rtlabel_id2name(rt->rt_labelid); + if (label != NULL) + strlcpy(sa_rt.sr_label, label, + sizeof(sa_rt.sr_label)); + info.rti_info[RTAX_LABEL] = + (struct sockaddr *)&sa_rt; + } + ifpaddr = 0; ifaaddr = 0; if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA) && |