diff options
author | 2015-09-09 15:51:40 +0000 | |
---|---|---|
committer | 2015-09-09 15:51:40 +0000 | |
commit | 6566eebc89ed536286d71a7f9b5ef53300da2b4d (patch) | |
tree | c081bedaa35b1108e39a04cc196262586df8d6f8 | |
parent | Hide all unnecessary asr / resolver related API with _ prefixes. (diff) | |
download | wireguard-openbsd-6566eebc89ed536286d71a7f9b5ef53300da2b4d.tar.xz wireguard-openbsd-6566eebc89ed536286d71a7f9b5ef53300da2b4d.zip |
Kill icmp6_ifstat_inc() and associated per-ifp storage.
The SIOCGIFSTAT_ICMP6 is no longer supported.
ok dlg@, mikeb@, claudio@
-rw-r--r-- | sys/netinet/icmp6.h | 60 | ||||
-rw-r--r-- | sys/netinet6/icmp6.c | 38 | ||||
-rw-r--r-- | sys/netinet6/in6.c | 14 | ||||
-rw-r--r-- | sys/netinet6/in6_var.h | 3 | ||||
-rw-r--r-- | sys/netinet6/mld6.c | 16 | ||||
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 7 | ||||
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 4 | ||||
-rw-r--r-- | sys/netinet6/raw_ip6.c | 6 |
8 files changed, 12 insertions, 136 deletions
diff --git a/sys/netinet/icmp6.h b/sys/netinet/icmp6.h index f67e2480c62..17f2c2638e9 100644 --- a/sys/netinet/icmp6.h +++ b/sys/netinet/icmp6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.h,v 1.41 2014/08/27 14:04:15 florian Exp $ */ +/* $OpenBSD: icmp6.h,v 1.42 2015/09/09 15:51:40 mpi Exp $ */ /* $KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $ */ /* @@ -610,64 +610,6 @@ struct ip6ctlparam; void icmp6_mtudisc_update(struct ip6ctlparam *, int); void icmp6_mtudisc_callback_register(void (*)(struct sockaddr_in6 *, u_int)); -/* XXX: is this the right place for these macros? */ -#define icmp6_ifstat_inc(ifp, tag) \ -do { \ - if (ifp) \ - ((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat->tag++; \ -} while (0) - -#define icmp6_ifoutstat_inc(ifp, type, code) \ -do { \ - icmp6_ifstat_inc(ifp, ifs6_out_msg); \ - switch(type) { \ - case ICMP6_DST_UNREACH: \ - icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \ - if (code == ICMP6_DST_UNREACH_ADMIN) \ - icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \ - break; \ - case ICMP6_PACKET_TOO_BIG: \ - icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \ - break; \ - case ICMP6_TIME_EXCEEDED: \ - icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \ - break; \ - case ICMP6_PARAM_PROB: \ - icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \ - break; \ - case ICMP6_ECHO_REQUEST: \ - icmp6_ifstat_inc(ifp, ifs6_out_echo); \ - break; \ - case ICMP6_ECHO_REPLY: \ - icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \ - break; \ - case MLD_LISTENER_QUERY: \ - icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \ - break; \ - case MLD_LISTENER_REPORT: \ - icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \ - break; \ - case MLD_LISTENER_DONE: \ - icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \ - break; \ - case ND_ROUTER_SOLICIT: \ - icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \ - break; \ - case ND_ROUTER_ADVERT: \ - icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \ - break; \ - case ND_NEIGHBOR_SOLICIT: \ - icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \ - break; \ - case ND_NEIGHBOR_ADVERT: \ - icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \ - break; \ - case ND_REDIRECT: \ - icmp6_ifstat_inc(ifp, ifs6_out_redirect); \ - break; \ - } \ -} while (0) - extern int icmp6_redirtimeout; /* cache time for redirect routes */ #endif /* _KERNEL */ diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 80f090cf087..ed9775b1b64 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.163 2015/07/28 12:22:07 bluhm Exp $ */ +/* $OpenBSD: icmp6.c,v 1.164 2015/09/09 15:51:40 mpi Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -390,8 +390,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) if (ifp == NULL) goto freeit; - icmp6_ifstat_inc(ifp, ifs6_in_msg); - /* * Locate icmp6 structure in mbuf, and check * that not corrupted and of at least minimum length @@ -400,7 +398,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) ip6 = mtod(m, struct ip6_hdr *); if (icmp6len < sizeof(struct icmp6_hdr)) { icmp6stat.icp6s_tooshort++; - icmp6_ifstat_inc(ifp, ifs6_in_error); goto freeit; } @@ -420,7 +417,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) icmp6->icmp6_type, sum, inet_ntop(AF_INET6, &ip6->ip6_src, src, sizeof(src)))); icmp6stat.icp6s_checksum++; - icmp6_ifstat_inc(ifp, ifs6_in_error); goto freeit; } @@ -453,13 +449,11 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) switch (icmp6->icmp6_type) { case ICMP6_DST_UNREACH: - icmp6_ifstat_inc(ifp, ifs6_in_dstunreach); switch (code) { case ICMP6_DST_UNREACH_NOROUTE: code = PRC_UNREACH_NET; break; case ICMP6_DST_UNREACH_ADMIN: - icmp6_ifstat_inc(ifp, ifs6_in_adminprohib); code = PRC_UNREACH_PROTOCOL; /* is this a good code? */ break; case ICMP6_DST_UNREACH_ADDR: @@ -484,8 +478,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) goto deliver; case ICMP6_PACKET_TOO_BIG: - icmp6_ifstat_inc(ifp, ifs6_in_pkttoobig); - /* MTU is checked in icmp6_mtudisc_update. */ code = PRC_MSGSIZE; @@ -496,7 +488,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) goto deliver; case ICMP6_TIME_EXCEEDED: - icmp6_ifstat_inc(ifp, ifs6_in_timeexceed); switch (code) { case ICMP6_TIME_EXCEED_TRANSIT: code = PRC_TIMXCEED_INTRANS; @@ -510,7 +501,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) goto deliver; case ICMP6_PARAM_PROB: - icmp6_ifstat_inc(ifp, ifs6_in_paramprob); switch (code) { case ICMP6_PARAMPROB_NEXTHEADER: code = PRC_UNREACH_PROTOCOL; @@ -525,7 +515,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) goto deliver; case ICMP6_ECHO_REQUEST: - icmp6_ifstat_inc(ifp, ifs6_in_echo); if (code != 0) goto badcode; /* @@ -611,7 +600,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) break; case ICMP6_ECHO_REPLY: - icmp6_ifstat_inc(ifp, ifs6_in_echoreply); if (code != 0) goto badcode; break; @@ -620,10 +608,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) case MLD_LISTENER_REPORT: if (icmp6len < sizeof(struct mld_hdr)) goto badlen; - if (icmp6->icmp6_type == MLD_LISTENER_QUERY) /* XXX: ugly... */ - icmp6_ifstat_inc(ifp, ifs6_in_mldquery); - else - icmp6_ifstat_inc(ifp, ifs6_in_mldreport); if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* give up local */ mld6_input(m, off); @@ -635,7 +619,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) break; case MLD_LISTENER_DONE: - icmp6_ifstat_inc(ifp, ifs6_in_mlddone); if (icmp6len < sizeof(struct mld_hdr)) /* necessary? */ goto badlen; break; /* nothing to be done in kernel */ @@ -653,7 +636,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) break; case ND_ROUTER_SOLICIT: - icmp6_ifstat_inc(ifp, ifs6_in_routersolicit); if (code != 0) goto badcode; if (icmp6len < sizeof(struct nd_router_solicit)) @@ -669,7 +651,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) break; case ND_ROUTER_ADVERT: - icmp6_ifstat_inc(ifp, ifs6_in_routeradvert); if (code != 0) goto badcode; if (icmp6len < sizeof(struct nd_router_advert)) @@ -685,7 +666,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) break; case ND_NEIGHBOR_SOLICIT: - icmp6_ifstat_inc(ifp, ifs6_in_neighborsolicit); if (code != 0) goto badcode; if (icmp6len < sizeof(struct nd_neighbor_solicit)) @@ -701,7 +681,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) break; case ND_NEIGHBOR_ADVERT: - icmp6_ifstat_inc(ifp, ifs6_in_neighboradvert); if (code != 0) goto badcode; if (icmp6len < sizeof(struct nd_neighbor_advert)) @@ -717,7 +696,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) break; case ND_REDIRECT: - icmp6_ifstat_inc(ifp, ifs6_in_redirect); if (code != 0) goto badcode; if (icmp6len < sizeof(struct nd_redirect)) @@ -1174,7 +1152,6 @@ icmp6_reflect(struct mbuf *m, size_t off) struct in6_addr t, *src = NULL; int plen; int type, code; - struct ifnet *outif = NULL; struct sockaddr_in6 sa6_src, sa6_dst; /* too short to reflect */ @@ -1325,13 +1302,7 @@ icmp6_reflect(struct mbuf *m, size_t off) #if NPF > 0 pf_pkt_addr_changed(m); #endif - if (ip6_output(m, NULL, NULL, IPV6_MINMTU, NULL, &outif, NULL) != 0 && - outif) - icmp6_ifstat_inc(outif, ifs6_out_error); - - if (outif) - icmp6_ifoutstat_inc(outif, type, code); - + ip6_output(m, NULL, NULL, IPV6_MINMTU, NULL, NULL, NULL); return; bad: @@ -1820,11 +1791,8 @@ noredhdropt: m->m_pkthdr.csum_flags |= M_ICMP_CSUM_OUT; /* send the packet to outside... */ - if (ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL) != 0) - icmp6_ifstat_inc(ifp, ifs6_out_error); + ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL); - icmp6_ifstat_inc(ifp, ifs6_out_msg); - icmp6_ifstat_inc(ifp, ifs6_out_redirect); icmp6stat.icp6s_outhist[ND_REDIRECT]++; return; diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 4444dbc35b6..26a037ac6a0 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.170 2015/09/04 13:00:41 mpi Exp $ */ +/* $OpenBSD: in6.c,v 1.171 2015/09/09 15:51:40 mpi Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -397,13 +397,7 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) break; case SIOCGIFSTAT_ICMP6: - if (ifp == NULL) - return EINVAL; - bzero(&ifr->ifr_ifru.ifru_icmp6stat, - sizeof(ifr->ifr_ifru.ifru_icmp6stat)); - ifr->ifr_ifru.ifru_icmp6stat = - *((struct in6_ifextra *)ifp->if_afdata[AF_INET6])->icmp6_ifstat; - break; + return (EOPNOTSUPP); case SIOCGIFALIFETIME_IN6: ifr->ifr_ifru.ifru_lifetime = ia6->ia6_lifetime; @@ -2000,9 +1994,6 @@ in6_domifattach(struct ifnet *ifp) ext->in6_ifstat = malloc(sizeof(*ext->in6_ifstat), M_IFADDR, M_WAITOK | M_ZERO); - ext->icmp6_ifstat = malloc(sizeof(*ext->icmp6_ifstat), M_IFADDR, - M_WAITOK | M_ZERO); - ext->nd_ifinfo = nd6_ifattach(ifp); ext->nprefixes = 0; ext->ndefrouters = 0; @@ -2016,6 +2007,5 @@ in6_domifdetach(struct ifnet *ifp, void *aux) nd6_ifdetach(ext->nd_ifinfo); free(ext->in6_ifstat, M_IFADDR, 0); - free(ext->icmp6_ifstat, M_IFADDR, 0); free(ext, M_IFADDR, 0); } diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 4024271c328..3d6ed9a50cc 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_var.h,v 1.54 2015/09/01 17:21:36 mpi Exp $ */ +/* $OpenBSD: in6_var.h,v 1.55 2015/09/09 15:51:40 mpi Exp $ */ /* $KAME: in6_var.h,v 1.55 2001/02/16 12:49:45 itojun Exp $ */ /* @@ -90,7 +90,6 @@ struct in6_addrlifetime { struct nd_ifinfo; struct in6_ifextra { struct in6_ifstat *in6_ifstat; - struct icmp6_ifstat *icmp6_ifstat; struct nd_ifinfo *nd_ifinfo; void *rs_lhcookie; int nprefixes; diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index d449c31a45f..85263c4b0f5 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mld6.c,v 1.42 2015/06/16 11:09:40 mpi Exp $ */ +/* $OpenBSD: mld6.c,v 1.43 2015/09/09 15:51:40 mpi Exp $ */ /* $KAME: mld6.c,v 1.26 2001/02/16 14:50:35 itojun Exp $ */ /* @@ -455,21 +455,7 @@ mld6_sendpkt(struct in6_multi *in6m, int type, const struct in6_addr *dst) im6o.im6o_loop = (ip6_mrouter != NULL); #endif - /* increment output statictics */ icmp6stat.icp6s_outhist[type]++; - icmp6_ifstat_inc(ifp, ifs6_out_msg); - switch (type) { - case MLD_LISTENER_QUERY: - icmp6_ifstat_inc(ifp, ifs6_out_mldquery); - break; - case MLD_LISTENER_REPORT: - icmp6_ifstat_inc(ifp, ifs6_out_mldreport); - break; - case MLD_LISTENER_DONE: - icmp6_ifstat_inc(ifp, ifs6_out_mlddone); - break; - } - ip6_output(mh, &ip6_opts, NULL, ia6 ? 0 : IPV6_UNSPECSRC, &im6o, NULL, NULL); } diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 0eae5db1250..a7a592eb3b4 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_nbr.c,v 1.92 2015/08/24 15:58:35 mpi Exp $ */ +/* $OpenBSD: nd6_nbr.c,v 1.93 2015/09/09 15:51:40 mpi Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -535,8 +535,6 @@ nd6_ns_output(struct ifnet *ifp, struct in6_addr *daddr6, m->m_pkthdr.csum_flags |= M_ICMP_CSUM_OUT; ip6_output(m, NULL, &ro, dad ? IPV6_UNSPECSRC : 0, &im6o, NULL, NULL); - icmp6_ifstat_inc(ifp, ifs6_out_msg); - icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); icmp6stat.icp6s_outhist[ND_NEIGHBOR_SOLICIT]++; if (ro.ro_rt) { /* we don't cache this route. */ @@ -1062,9 +1060,6 @@ nd6_na_output(struct ifnet *ifp, struct in6_addr *daddr6, m->m_pkthdr.csum_flags |= M_ICMP_CSUM_OUT; ip6_output(m, NULL, &ro, 0, &im6o, NULL, NULL); - - icmp6_ifstat_inc(ifp, ifs6_out_msg); - icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); icmp6stat.icp6s_outhist[ND_NEIGHBOR_ADVERT]++; if (ro.ro_rt) { /* we don't cache this route. */ diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index e1a63a94402..f28c36c0fae 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_rtr.c,v 1.120 2015/08/24 23:28:27 mpi Exp $ */ +/* $OpenBSD: nd6_rtr.c,v 1.121 2015/09/09 15:51:40 mpi Exp $ */ /* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */ /* @@ -274,8 +274,6 @@ nd6_rs_output(struct ifnet* ifp, struct in6_ifaddr *ia6) ip6_output(m, NULL, NULL, 0, &im6o, NULL, NULL); splx(s); - icmp6_ifstat_inc(ifp, ifs6_out_msg); - icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); icmp6stat.icp6s_outhist[ND_ROUTER_SOLICIT]++; } diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index f207919159f..61a7804d72f 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip6.c,v 1.80 2015/09/09 12:50:08 mpi Exp $ */ +/* $OpenBSD: raw_ip6.c,v 1.81 2015/09/09 15:51:40 mpi Exp $ */ /* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */ /* @@ -478,10 +478,8 @@ rip6_output(struct mbuf *m, ...) #endif error = ip6_output(m, optp, &in6p->inp_route6, flags, - in6p->inp_moptions6, &oifp, in6p); + in6p->inp_moptions6, NULL, in6p); if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) { - if (oifp) - icmp6_ifoutstat_inc(oifp, type, code); icmp6stat.icp6s_outhist[type]++; } else rip6stat.rip6s_opackets++; |