From: mpi Date: Wed, 13 Jul 2016 08:40:46 +0000 (+0000) Subject: Introduce RTF_MULTICAST and flag corresponding IPv6 routes as such X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b71b7f0a6b7f463d1d08ae748637c9ea828825dc;p=openbsd Introduce RTF_MULTICAST and flag corresponding IPv6 routes as such instead of abusing RTF_CLONING. Fix a leak reporeted by Aaron Riekenberg on misc@, ok sthen@ --- diff --git a/sbin/route/show.c b/sbin/route/show.c index bcede302663..6c9d0b0e7e0 100644 --- a/sbin/route/show.c +++ b/sbin/route/show.c @@ -1,4 +1,4 @@ -/* $OpenBSD: show.c,v 1.103 2015/11/27 16:26:52 benno Exp $ */ +/* $OpenBSD: show.c,v 1.104 2016/07/13 08:40:46 mpi Exp $ */ /* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */ /* @@ -78,8 +78,8 @@ static const struct bits bits[] = { { RTF_DYNAMIC, 'D' }, { RTF_MODIFIED, 'M' }, { RTF_DONE, 'd' }, /* Completed -- for routing messages only */ - { RTF_MASK, 'm' }, /* Mask Present -- for routing messages only */ { RTF_CLONING, 'C' }, + { RTF_MULTICAST,'m' }, { RTF_LLINFO, 'L' }, { RTF_STATIC, 'S' }, { RTF_PROTO1, '1' }, diff --git a/share/man/man4/route.4 b/share/man/man4/route.4 index 7b8e9e4b9a2..f7191b71c38 100644 --- a/share/man/man4/route.4 +++ b/share/man/man4/route.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: route.4,v 1.40 2016/03/23 12:57:53 benno Exp $ +.\" $OpenBSD: route.4,v 1.41 2016/07/13 08:40:46 mpi Exp $ .\" $NetBSD: route.4,v 1.3 1994/11/30 16:22:31 jtc Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)route.4 8.6 (Berkeley) 4/19/94 .\" -.Dd $Mdocdate: March 23 2016 $ +.Dd $Mdocdate: July 13 2016 $ .Dt ROUTE 4 .Os .Sh NAME @@ -358,6 +358,7 @@ Flags include the values: #define RTF_DONE 0x40 /* message confirmed */ #define RTF_MASK 0x80 /* subnet mask present */ #define RTF_CLONING 0x100 /* generate new routes on use */ +#define RTF_MULTICAST 0x200 /* route associated to a mcast addr. */ #define RTF_LLINFO 0x400 /* generated by ARP or NDP */ #define RTF_STATIC 0x800 /* manually added */ #define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ diff --git a/sys/net/route.h b/sys/net/route.h index 7e567cd918e..0e3eaf56107 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.140 2016/07/11 13:06:31 bluhm Exp $ */ +/* $OpenBSD: route.h,v 1.141 2016/07/13 08:40:46 mpi Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -130,7 +130,7 @@ struct rtentry { #define RTF_DONE 0x40 /* message confirmed */ #define RTF_MASK 0x80 /* subnet mask present */ #define RTF_CLONING 0x100 /* generate new routes on use */ -/* 0x200 unused */ +#define RTF_MULTICAST 0x200 /* route associated to a mcast addr. */ #define RTF_LLINFO 0x400 /* generated by ARP or ND */ #define RTF_STATIC 0x800 /* manually added */ #define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index e612402325d..da733631a42 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.217 2016/07/11 09:23:06 mpi Exp $ */ +/* $OpenBSD: if_ether.c,v 1.218 2016/07/13 08:40:46 mpi Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -139,7 +139,7 @@ arp_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt) timeout_add_sec(&arptimer_to, 1); } - if (rt->rt_flags & (RTF_GATEWAY|RTF_BROADCAST)) + if (ISSET(rt->rt_flags, RTF_GATEWAY|RTF_BROADCAST|RTF_MULTICAST)) return; switch (req) { diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 0de02a67d8d..bd0b3155629 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.188 2016/07/05 10:17:14 mpi Exp $ */ +/* $OpenBSD: in6.c,v 1.189 2016/07/13 08:40:46 mpi Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -757,8 +757,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, info.rti_info[RTAX_GATEWAY] = sin6tosa(&ia6->ia_addr); info.rti_info[RTAX_NETMASK] = sin6tosa(&mltmask); info.rti_info[RTAX_IFA] = sin6tosa(&ia6->ia_addr); - /* XXX: we need RTF_CLONING to fake nd6_rtrequest */ - info.rti_flags = RTF_CLONING; + info.rti_flags = RTF_MULTICAST; error = rtrequest(RTM_ADD, &info, RTP_CONNECTED, NULL, ifp->if_rdomain); if (error) @@ -814,7 +813,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, info.rti_info[RTAX_GATEWAY] = sin6tosa(&ia6->ia_addr); info.rti_info[RTAX_NETMASK] = sin6tosa(&mltmask); info.rti_info[RTAX_IFA] = sin6tosa(&ia6->ia_addr); - info.rti_flags = RTF_CLONING; + info.rti_flags = RTF_MULTICAST; error = rtrequest(RTM_ADD, &info, RTP_CONNECTED, NULL, ifp->if_rdomain); if (error) diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index d7d7480dfbb..b523d4a08c8 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.187 2016/07/13 01:51:22 dlg Exp $ */ +/* $OpenBSD: nd6.c,v 1.188 2016/07/13 08:40:46 mpi Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -882,7 +882,7 @@ nd6_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt) dr->installed = 0; } - if ((rt->rt_flags & RTF_GATEWAY) != 0) + if (ISSET(rt->rt_flags, RTF_GATEWAY|RTF_MULTICAST)) return; if (nd6_need_cache(ifp) == 0 && (rt->rt_flags & RTF_HOST) == 0) { diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1 index c2f872d9c35..08607e17095 100644 --- a/usr.bin/netstat/netstat.1 +++ b/usr.bin/netstat/netstat.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: netstat.1,v 1.77 2015/09/11 20:10:26 mpi Exp $ +.\" $OpenBSD: netstat.1,v 1.78 2016/07/13 08:40:46 mpi Exp $ .\" $NetBSD: netstat.1,v 1.11 1995/10/03 21:42:43 thorpej Exp $ .\" .\" Copyright (c) 1983, 1990, 1992, 1993 @@ -30,7 +30,7 @@ .\" .\" from: @(#)netstat.1 8.8 (Berkeley) 4/18/94 .\" -.Dd $Mdocdate: September 11 2015 $ +.Dd $Mdocdate: July 13 2016 $ .Dt NETSTAT 1 .Os .Sh NAME @@ -354,6 +354,7 @@ The mapping between letters and flags is: .It L Ta RTF_LLINFO Ta "Valid protocol to link address translation." .It l Ta RTF_LOCAL Ta "Correspond to a local address." .It M Ta RTF_MODIFIED Ta "Modified dynamically (by redirect)." +.It m Ta RTF_MULTICAST Ta "Correspond to a multicast address." .It P Ta RTF_MPATH Ta "Multipath route." .It R Ta RTF_REJECT Ta "Host or net unreachable." .It S Ta RTF_STATIC Ta "Manually added." diff --git a/usr.bin/netstat/show.c b/usr.bin/netstat/show.c index 9552cdb2169..7c65ee4e202 100644 --- a/usr.bin/netstat/show.c +++ b/usr.bin/netstat/show.c @@ -1,4 +1,4 @@ -/* $OpenBSD: show.c,v 1.49 2015/09/11 20:10:26 mpi Exp $ */ +/* $OpenBSD: show.c,v 1.50 2016/07/13 08:40:46 mpi Exp $ */ /* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */ /* @@ -78,8 +78,8 @@ static const struct bits bits[] = { { RTF_DYNAMIC, 'D' }, { RTF_MODIFIED, 'M' }, { RTF_DONE, 'd' }, /* Completed -- for routing messages only */ - { RTF_MASK, 'm' }, /* Mask Present -- for routing messages only */ { RTF_CLONING, 'C' }, + { RTF_MULTICAST,'m' }, { RTF_LLINFO, 'L' }, { RTF_STATIC, 'S' }, { RTF_PROTO1, '1' }, diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index b61a005cf4c..098f56c3e9c 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route6d.c,v 1.87 2016/07/06 16:38:09 jca Exp $ */ +/* $OpenBSD: route6d.c,v 1.88 2016/07/13 08:40:46 mpi Exp $ */ /* $KAME: route6d.c,v 1.111 2006/10/25 06:38:13 jinmei Exp $ */ /* @@ -2308,45 +2308,16 @@ do { \ RTFLAG("D", RTF_DYNAMIC); RTFLAG("M", RTF_MODIFIED); RTFLAG("d", RTF_DONE); -#ifdef RTF_MASK - RTFLAG("m", RTF_MASK); -#endif + RTFLAG("m", RTF_MULTICAST); RTFLAG("C", RTF_CLONING); -#ifdef RTF_CLONED RTFLAG("c", RTF_CLONED); -#endif -#ifdef RTF_PRCLONING - RTFLAG("c", RTF_PRCLONING); -#endif -#ifdef RTF_WASCLONED - RTFLAG("W", RTF_WASCLONED); -#endif RTFLAG("L", RTF_LLINFO); RTFLAG("S", RTF_STATIC); RTFLAG("B", RTF_BLACKHOLE); -#ifdef RTF_PROTO3 RTFLAG("3", RTF_PROTO3); -#endif RTFLAG("2", RTF_PROTO2); RTFLAG("1", RTF_PROTO1); -#ifdef RTF_BROADCAST RTFLAG("b", RTF_BROADCAST); -#endif -#ifdef RTF_DEFAULT - RTFLAG("d", RTF_DEFAULT); -#endif -#ifdef RTF_ISAROUTER - RTFLAG("r", RTF_ISAROUTER); -#endif -#ifdef RTF_TUNNEL - RTFLAG("T", RTF_TUNNEL); -#endif -#ifdef RTF_AUTH - RTFLAG("A", RTF_AUTH); -#endif -#ifdef RTF_CRYPT - RTFLAG("E", RTF_CRYPT); -#endif #undef RTFLAG return buf; }