From 66dcee729c28defab60dec5356a54f7dc822435e Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Sat, 15 Mar 2014 06:49:32 +0000 Subject: [PATCH] Garbage collect long time obsoleted (or never used) stuff from routing API. --- share/man/man4/route.4 | 2 -- share/man/man9/rtentry.9 | 2 -- sys/net/iso88025.h | 4 +++- sys/net/route.c | 9 --------- sys/net/route.h | 34 +++------------------------------- sys/sys/sockio.h | 4 ++-- usr.bin/netstat/netstat.1 | 11 ----------- usr.bin/netstat/route.c | 7 ------- usr.sbin/ppp/route.c | 19 ++----------------- usr.sbin/route6d/route6d.c | 21 --------------------- 10 files changed, 10 insertions(+), 103 deletions(-) diff --git a/share/man/man4/route.4 b/share/man/man4/route.4 index c2da33a82a2..f20e90dbd75 100644 --- a/share/man/man4/route.4 +++ b/share/man/man4/route.4 @@ -192,8 +192,6 @@ Messages include: #define RTM_REDIRECT 0x6 /* Told to use different route */ #define RTM_MISS 0x7 /* Lookup failed on this address */ #define RTM_LOCK 0x8 /* fix specified metrics */ -#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */ -#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */ #define RTM_RESOLVE 0xb /* request to resolve dst to LL addr - unused */ #define RTM_NEWADDR 0xc /* address being added to iface */ #define RTM_DELADDR 0xd /* address being removed from iface */ diff --git a/share/man/man9/rtentry.9 b/share/man/man9/rtentry.9 index 6afef049aae..65a63e481c4 100644 --- a/share/man/man9/rtentry.9 +++ b/share/man/man9/rtentry.9 @@ -157,8 +157,6 @@ Requests that output sent via this route be discarded. .It Dv RTF_PROTO2 .It Dv RTF_PROTO3 Protocol-specific. -.It Dv RTF_PRCLONING -This flag is obsolete and simply ignored by facility. .It Dv RTF_PINNED Indicates that this route is immutable to a routing protocol. .It Dv RTF_LOCAL diff --git a/sys/net/iso88025.h b/sys/net/iso88025.h index 2faab843d82..11bd6ec49eb 100644 --- a/sys/net/iso88025.h +++ b/sys/net/iso88025.h @@ -162,11 +162,13 @@ struct iso88025_addr { #define ISO88025_BPF_UNSUPPORTED 0 #define ISO88025_BPF_SUPPORTED 1 +#ifdef _KERNEL void iso88025_ifattach (struct ifnet *, const u_int8_t *, int); void iso88025_ifdetach (struct ifnet *, int); int iso88025_ioctl (struct ifnet *, u_long, caddr_t ); int iso88025_output (struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *); void iso88025_input (struct ifnet *, struct mbuf *); +#endif /* _KERNEL */ -#endif +#endif /* !_NET_ISO88025_H_ */ diff --git a/sys/net/route.c b/sys/net/route.c index 92875c759f3..c7211a77807 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1733,15 +1733,6 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum) return (error); } -#ifndef BURN_BRIDGES -/* special one for inet internal use. may not use. */ -int -rtinit_fib(struct ifaddr *ifa, int cmd, int flags) -{ - return (rtinit1(ifa, cmd, flags, RT_ALL_FIBS)); -} -#endif - /* * Set up a routing table entry, normally * for an interface. diff --git a/sys/net/route.h b/sys/net/route.h index a4d2a1f5e84..244eea29c76 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -86,10 +86,6 @@ struct rt_metrics { #define RT_ALL_FIBS -1 /* Announce event for every fib */ extern u_int rt_numfibs; /* number of usable routing tables */ extern u_int rt_add_addr_allfibs; /* Announce interfaces to all fibs */ -/* - * XXX kernel function pointer `rt_output' is visible to applications. - */ -struct mbuf; /* * We distinguish between routes to hosts and routes to networks, @@ -131,20 +127,6 @@ struct rtentry { }; #endif /* _KERNEL || _WANT_RTENTRY */ -/* - * Following structure necessary for 4.3 compatibility; - * We should eventually move it to a compat file. - */ -struct ortentry { - u_long rt_hash; /* to speed lookups */ - struct sockaddr rt_dst; /* key */ - struct sockaddr rt_gateway; /* value */ - short rt_flags; /* up/down?, host/net */ - short rt_refcnt; /* # held references */ - u_long rt_use; /* raw # packets forwarded */ - struct ifnet *rt_ifp; /* the answer: interface to use */ -}; - #define RTF_UP 0x1 /* route usable */ #define RTF_GATEWAY 0x2 /* destination is a gateway */ #define RTF_HOST 0x4 /* host entry (net otherwise) */ @@ -162,12 +144,7 @@ struct ortentry { #define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ #define RTF_PROTO2 0x4000 /* protocol specific routing flag */ #define RTF_PROTO1 0x8000 /* protocol specific routing flag */ - -/* XXX: temporary to stay API/ABI compatible with userland */ -#ifndef _KERNEL -#define RTF_PRCLONING 0x10000 /* unused, for compatibility */ -#endif - +/* 0x10000 unused, was RTF_PRCLONING */ /* 0x20000 unused, was RTF_WASCLONED */ #define RTF_PROTO3 0x40000 /* protocol specific routing flag */ /* 0x80000 unused */ @@ -229,8 +206,8 @@ struct rt_msghdr { #define RTM_REDIRECT 0x6 /* Told to use different route */ #define RTM_MISS 0x7 /* Lookup failed on this address */ #define RTM_LOCK 0x8 /* fix specified metrics */ -#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */ -#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */ + /* 0x9 */ + /* 0xa */ #define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */ #define RTM_NEWADDR 0xc /* address being added to iface */ #define RTM_DELADDR 0xd /* address being removed from iface */ @@ -405,11 +382,6 @@ void rtredirect(struct sockaddr *, struct sockaddr *, int rtrequest(int, struct sockaddr *, struct sockaddr *, struct sockaddr *, int, struct rtentry **); -#ifndef BURN_BRIDGES -/* defaults to "all" FIBs */ -int rtinit_fib(struct ifaddr *, int, int); -#endif - /* XXX MRT NEW VERSIONS THAT USE FIBs * For now the protocol indepedent versions are the same as the AF_INET ones * but this will change.. diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h index a09c11f6b00..3dd68fb5e24 100644 --- a/sys/sys/sockio.h +++ b/sys/sys/sockio.h @@ -44,8 +44,8 @@ #define SIOCSPGRP _IOW('s', 8, int) /* set process group */ #define SIOCGPGRP _IOR('s', 9, int) /* get process group */ -#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */ -#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */ +/* SIOCADDRT _IOW('r', 10, struct ortentry) 4.3BSD */ +/* SIOCDELRT _IOW('r', 11, struct ortentry) 4.3BSD */ #define SIOCGETVIFCNT _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */ #define SIOCGETSGCNT _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */ diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1 index 6f8a03dd459..67095d6ef10 100644 --- a/usr.bin/netstat/netstat.1 +++ b/usr.bin/netstat/netstat.1 @@ -244,14 +244,6 @@ If is also present, show the contents of the internal Patricia tree structures; used for debugging. -If -.Fl a -is also present, -show protocol-cloned routes -(routes generated by an -.Dv RTF_PRCLONING -parent route); -normally these routes are not shown. When .Fl W is also present, @@ -431,8 +423,6 @@ The mapping between letters and flags is: .It Li 3 Ta Dv RTF_PROTO3 Ta "Protocol specific routing flag #3" .It Li B Ta Dv RTF_BLACKHOLE Ta "Just discard pkts (during updates)" .It Li b Ta Dv RTF_BROADCAST Ta "The route represents a broadcast address" -.It Li C Ta Dv RTF_CLONING Ta "Generate new routes on use" -.It Li c Ta Dv RTF_PRCLONING Ta "Protocol-specified generate new routes on use" .It Li D Ta Dv RTF_DYNAMIC Ta "Created dynamically (by redirect)" .It Li G Ta Dv RTF_GATEWAY Ta "Destination requires forwarding by intermediary" .It Li H Ta Dv RTF_HOST Ta "Host entry (net otherwise)" @@ -441,7 +431,6 @@ The mapping between letters and flags is: .It Li R Ta Dv RTF_REJECT Ta "Host or net unreachable" .It Li S Ta Dv RTF_STATIC Ta "Manually added" .It Li U Ta Dv RTF_UP Ta "Route usable" -.It Li W Ta Dv RTF_WASCLONED Ta "Route was generated as a result of cloning" .It Li X Ta Dv RTF_XRESOLVE Ta "External daemon translates proto to link address" .El .Pp diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 78ffdcd411a..3f09459989b 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -90,18 +90,11 @@ struct bits { { RTF_STATIC, 'S' }, { RTF_PROTO1, '1' }, { RTF_PROTO2, '2' }, - { RTF_PRCLONING,'c' }, { RTF_PROTO3, '3' }, { RTF_BLACKHOLE,'B' }, { RTF_BROADCAST,'b' }, #ifdef RTF_LLINFO { RTF_LLINFO, 'L' }, -#endif -#ifdef RTF_WASCLONED - { RTF_WASCLONED,'W' }, -#endif -#ifdef RTF_CLONING - { RTF_CLONING, 'C' }, #endif { 0 , 0 } }; diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c index e7db97e9297..758b40319ec 100644 --- a/usr.sbin/ppp/route.c +++ b/usr.sbin/ppp/route.c @@ -158,26 +158,16 @@ static struct bits { { RTF_MODIFIED, 'M' }, { RTF_DONE, 'd' }, { RTF_XRESOLVE, 'X' }, -#ifdef RTF_CLONING - { RTF_CLONING, 'C' }, -#endif { RTF_STATIC, 'S' }, { RTF_PROTO1, '1' }, { RTF_PROTO2, '2' }, { RTF_BLACKHOLE, 'B' }, - #ifdef RTF_LLINFO { RTF_LLINFO, 'L' }, #endif #ifdef RTF_CLONING { RTF_CLONING, 'C' }, #endif -#ifdef RTF_WASCLONED - { RTF_WASCLONED, 'W' }, -#endif -#ifdef RTF_PRCLONING - { RTF_PRCLONING, 'c' }, -#endif #ifdef RTF_PROTO3 { RTF_PROTO3, '3' }, #endif @@ -187,10 +177,6 @@ static struct bits { { 0, '\0' } }; -#ifndef RTF_WASCLONED -#define RTF_WASCLONED (0) -#endif - static void p_flags(struct prompt *prompt, u_int32_t f, unsigned max) { @@ -434,7 +420,7 @@ route_IfDelete(struct bundle *bundle, int all) * route X was cloned from route Y (and is no longer there 'cos it * may have gone with route Y). */ - if (RTF_WASCLONED == 0 && pass == 0) + if (pass == 0) /* So we can't tell ! */ continue; for (cp = sp; cp < ep; cp += rtm->rtm_msglen) { @@ -461,8 +447,7 @@ route_IfDelete(struct bundle *bundle, int all) sa[RTAX_GATEWAY]->sa_family == AF_INET6 || #endif sa[RTAX_GATEWAY]->sa_family == AF_LINK) { - if ((pass == 0 && (rtm->rtm_flags & RTF_WASCLONED)) || - (pass == 1 && !(rtm->rtm_flags & RTF_WASCLONED))) { + if (pass == 1) { ncprange_setsa(&range, sa[RTAX_DST], sa[RTAX_NETMASK]); rt_Set(bundle, RTM_DELETE, &range, NULL, 0, 0); } else diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 94fb3aec642..f7d27de1d7b 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -1901,10 +1901,6 @@ rtrecv(void) if (!rt_deladdr(ifcp, rta[RTAX_IFA], rta[RTAX_NETMASK])) iface++; break; - case RTM_OLDADD: - case RTM_OLDDEL: - trace(1, "\tnot supported yet, ignored\n"); - break; } } @@ -2467,17 +2463,9 @@ do { \ RTTYPE("REDIRECT", RTM_REDIRECT); RTTYPE("MISS", RTM_MISS); RTTYPE("LOCK", RTM_LOCK); - RTTYPE("OLDADD", RTM_OLDADD); - RTTYPE("OLDDEL", RTM_OLDDEL); RTTYPE("NEWADDR", RTM_NEWADDR); RTTYPE("DELADDR", RTM_DELADDR); RTTYPE("IFINFO", RTM_IFINFO); -#ifdef RTM_OLDADD - RTTYPE("OLDADD", RTM_OLDADD); -#endif -#ifdef RTM_OLDDEL - RTTYPE("OLDDEL", RTM_OLDDEL); -#endif #ifdef RTM_OIFINFO RTTYPE("OIFINFO", RTM_OIFINFO); #endif @@ -2518,17 +2506,8 @@ do { \ #ifdef RTF_MASK RTFLAG("m", RTF_MASK); #endif -#ifdef RTF_CLONING - RTFLAG("C", RTF_CLONING); -#endif #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("X", RTF_XRESOLVE); #ifdef RTF_LLINFO