diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-05-30 21:58:29 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-05-30 21:58:29 +0000 |
commit | 695e92d9764fb53a4a364bf593837e4218c2abca (patch) | |
tree | 6da61162fdb7605f94a78d37d375e6950878c999 | |
parent | b0748ad9ff94e4072c7e1bd4f8d5834fc0995338 (diff) |
Export the route labels via sysctl interface not only via RTM_GET.
OK henning@ norby@
-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 0d181be85b8..f0fcdf3f9af 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.58 2006/04/22 19:43:07 claudio Exp $ */ +/* $OpenBSD: rtsock.c,v 1.59 2006/05/30 21:58:28 claudio Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -793,6 +793,8 @@ sysctl_dumpentry(struct radix_node *rn, void *v) struct rtentry *rt = (struct rtentry *)rn; int error = 0, size; struct rt_addrinfo info; + struct sockaddr_rtlabel sa_rt; + const char *label; if (w->w_op == NET_RT_FLAGS && !(rt->rt_flags & w->w_arg)) return 0; @@ -807,6 +809,18 @@ sysctl_dumpentry(struct radix_node *rn, void *v) if (rt->rt_ifp->if_flags & IFF_POINTOPOINT) brdaddr = rt->rt_ifa->ifa_dstaddr; } + 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; + } + } + size = rt_msg2(RTM_GET, &info, NULL, w); if (w->w_where && w->w_tmem && w->w_needed <= 0) { struct rt_msghdr *rtm = (struct rt_msghdr *)w->w_tmem; |