summaryrefslogtreecommitdiff
path: root/sys/netinet6
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/icmp6.c4
-rw-r--r--sys/netinet6/ip6_forward.c14
-rw-r--r--sys/netinet6/ip6_mroute.c7
-rw-r--r--sys/netinet6/ip6_output.c34
-rw-r--r--sys/netinet6/nd6.c32
-rw-r--r--sys/netinet6/nd6.h11
-rw-r--r--sys/netinet6/nd6_rtr.c39
7 files changed, 19 insertions, 122 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 4f7034cbb84..d87678240fa 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.174 2015/10/22 15:37:47 bluhm Exp $ */
+/* $OpenBSD: icmp6.c,v 1.175 2015/10/28 12:14:25 florian Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -1022,7 +1022,7 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated)
if (rt && (rt->rt_flags & RTF_HOST) &&
!(rt->rt_rmx.rmx_locks & RTV_MTU) &&
(rt->rt_rmx.rmx_mtu > mtu || rt->rt_rmx.rmx_mtu == 0)) {
- if (mtu < IN6_LINKMTU(rt->rt_ifp)) {
+ if (mtu < rt->rt_ifp->if_mtu) {
icmp6stat.icp6s_pmtuchg++;
rt->rt_rmx.rmx_mtu = mtu;
}
diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c
index d6a74dc2b01..6fc2bb250cc 100644
--- a/sys/netinet6/ip6_forward.c
+++ b/sys/netinet6/ip6_forward.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_forward.c,v 1.84 2015/10/25 15:01:59 mpi Exp $ */
+/* $OpenBSD: ip6_forward.c,v 1.85 2015/10/28 12:14:25 florian Exp $ */
/* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */
/*
@@ -426,14 +426,10 @@ reroute:
in6_proto_cksum_out(m, rt->rt_ifp);
/* Check the size after pf_test to give pf a chance to refragment. */
- if (m->m_pkthdr.len > IN6_LINKMTU(rt->rt_ifp)) {
- if (mcopy) {
- u_long mtu;
-
- mtu = IN6_LINKMTU(rt->rt_ifp);
-
- icmp6_error(mcopy, ICMP6_PACKET_TOO_BIG, 0, mtu);
- }
+ if (m->m_pkthdr.len > rt->rt_ifp->if_mtu) {
+ if (mcopy)
+ icmp6_error(mcopy, ICMP6_PACKET_TOO_BIG, 0,
+ rt->rt_ifp->if_mtu);
m_freem(m);
goto freert;
}
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 0474319fc53..22be5890e39 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -1512,7 +1512,6 @@ phyint_send6(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m)
static struct route_in6 ro;
struct in6_multi *in6m;
struct sockaddr_in6 *dst6;
- u_long linkmtu;
/*
* Make a new reference to the packet; make sure that
@@ -1572,8 +1571,7 @@ phyint_send6(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m)
* Put the packet into the sending queue of the outgoing interface
* if it would fit in the MTU of the interface.
*/
- linkmtu = IN6_LINKMTU(ifp);
- if (mb_copy->m_pkthdr.len <= linkmtu || linkmtu < IPV6_MMTU) {
+ if (mb_copy->m_pkthdr.len <= ifp->if_mtu || ifp->if_mtu < IPV6_MMTU) {
dst6->sin6_len = sizeof(struct sockaddr_in6);
dst6->sin6_family = AF_INET6;
dst6->sin6_addr = ip6->ip6_dst;
@@ -1590,7 +1588,8 @@ phyint_send6(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m)
#endif
} else {
if (ip6_mcast_pmtu)
- icmp6_error(mb_copy, ICMP6_PACKET_TOO_BIG, 0, linkmtu);
+ icmp6_error(mb_copy, ICMP6_PACKET_TOO_BIG, 0,
+ ifp->if_mtu);
else {
#ifdef MRT6DEBUG
char src[INET6_ADDRSTRLEN], dst[INET6_ADDRSTRLEN];
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index 2fa1c68a4cd..eeac95d66a4 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_output.c,v 1.192 2015/10/25 14:43:06 florian Exp $ */
+/* $OpenBSD: ip6_output.c,v 1.193 2015/10/28 12:14:25 florian Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -772,26 +772,7 @@ reroute:
error = EMSGSIZE;
goto bad;
}
- if (dontfrag && tlen > IN6_LINKMTU(ifp)) { /* case 2-b */
- /*
- * Even if the DONTFRAG option is specified, we cannot send the
- * packet when the data length is larger than the MTU of the
- * outgoing interface.
- * Notify the error by sending IPV6_PATHMTU ancillary data as
- * well as returning an error code (the latter is not described
- * in the API spec.)
- */
-#if 0
- u_int32_t mtu32;
- struct ip6ctlparam ip6cp;
-
- mtu32 = (u_int32_t)mtu;
- bzero(&ip6cp, sizeof(ip6cp));
- ip6cp.ip6c_cmdarg = (void *)&mtu32;
- pfctlinput2(PRC_MSGSIZE, sin6tosa(&ro_pmtu->ro_dst),
- (void *)&ip6cp);
-#endif
-
+ if (dontfrag && tlen > ifp->if_mtu) { /* case 2-b */
error = EMSGSIZE;
goto bad;
}
@@ -1161,14 +1142,11 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro,
}
}
if (ro_pmtu->ro_rt) {
- u_int32_t ifmtu;
-
if (ifp == NULL)
ifp = ro_pmtu->ro_rt->rt_ifp;
- ifmtu = IN6_LINKMTU(ifp);
mtu = ro_pmtu->ro_rt->rt_rmx.rmx_mtu;
if (mtu == 0)
- mtu = ifmtu;
+ mtu = ifp->if_mtu;
else if (mtu < IPV6_MMTU) {
/*
* RFC2460 section 5, last paragraph:
@@ -1180,7 +1158,7 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro,
*/
alwaysfrag = 1;
mtu = IPV6_MMTU;
- } else if (mtu > ifmtu) {
+ } else if (mtu > ifp->if_mtu) {
/*
* The MTU on the route is larger than the MTU on
* the interface! This shouldn't happen, unless the
@@ -1189,12 +1167,12 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro,
* route to match the interface MTU (as long as the
* field isn't locked).
*/
- mtu = ifmtu;
+ mtu = ifp->if_mtu;
if (!(ro_pmtu->ro_rt->rt_rmx.rmx_locks & RTV_MTU))
ro_pmtu->ro_rt->rt_rmx.rmx_mtu = mtu;
}
} else if (ifp) {
- mtu = IN6_LINKMTU(ifp);
+ mtu = ifp->if_mtu;
} else
error = EHOSTUNREACH; /* XXX */
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index c065406742d..3507a125503 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.163 2015/10/27 10:52:18 mpi Exp $ */
+/* $OpenBSD: nd6.c,v 1.164 2015/10/28 12:14:25 florian Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -90,7 +90,6 @@ struct nd_prhead nd_prefix = { 0 };
int nd6_recalc_reachtm_interval = ND6_RECALC_REACHTM_INTERVAL;
-void nd6_setmtu0(struct ifnet *, struct nd_ifinfo *);
void nd6_slowtimo(void *);
struct llinfo_nd6 *nd6_free(struct rtentry *, int);
void nd6_llinfo_timer(void *);
@@ -153,9 +152,6 @@ nd6_ifattach(struct ifnet *ifp)
/* per-interface IFXF_AUTOCONF6 needs to be set too to accept RAs */
nd->flags = (ND6_IFF_PERFORMNUD | ND6_IFF_ACCEPT_RTADV);
- /* XXX: we cannot call nd6_setmtu since ifp is not fully initialized */
- nd6_setmtu0(ifp, nd);
-
return nd;
}
@@ -167,32 +163,6 @@ nd6_ifdetach(struct nd_ifinfo *nd)
}
void
-nd6_setmtu(struct ifnet *ifp)
-{
- nd6_setmtu0(ifp, ND_IFINFO(ifp));
-}
-
-void
-nd6_setmtu0(struct ifnet *ifp, struct nd_ifinfo *ndi)
-{
- u_int32_t omaxmtu;
-
- omaxmtu = ndi->maxmtu;
- ndi->maxmtu = ifp->if_mtu;
-
- /*
- * Decreasing the interface MTU under IPV6 minimum MTU may cause
- * undesirable situation. We thus notify the operator of the change
- * explicitly. The check for omaxmtu is necessary to restrict the
- * log to the case of changing the MTU, not initializing it.
- */
- if (omaxmtu >= IPV6_MMTU && ndi->maxmtu < IPV6_MMTU) {
- log(LOG_NOTICE, "%s: link MTU on %s (%lu) too small for IPv6\n",
- __func__, ifp->if_xname, (unsigned long)ndi->maxmtu);
- }
-}
-
-void
nd6_option_init(void *opt, int icmp6len, union nd_opts *ndopts)
{
bzero(ndopts, sizeof(*ndopts));
diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h
index 03ad2db22af..6ecd4dcb24d 100644
--- a/sys/netinet6/nd6.h
+++ b/sys/netinet6/nd6.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.h,v 1.51 2015/10/25 11:58:11 mpi Exp $ */
+/* $OpenBSD: nd6.h,v 1.52 2015/10/28 12:14:25 florian Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
@@ -49,8 +49,6 @@
#define ND6_LLINFO_PROBE 4
struct nd_ifinfo {
- u_int32_t linkmtu; /* LinkMTU */
- u_int32_t maxmtu; /* Upper bound of LinkMTU */
u_int32_t basereachable; /* BaseReachableTime */
u_int32_t reachable; /* Reachable Time */
u_int32_t retrans; /* Retrans Timer */
@@ -136,13 +134,6 @@ struct in6_ndifreq {
#define RS_LHCOOKIE(ifp) \
((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->rs_lhcookie
-#define IN6_LINKMTU(ifp) \
- ((ND_IFINFO(ifp)->linkmtu && ND_IFINFO(ifp)->linkmtu < (ifp)->if_mtu) \
- ? ND_IFINFO(ifp)->linkmtu \
- : ((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < (ifp)->if_mtu) \
- ? ND_IFINFO(ifp)->maxmtu : (ifp)->if_mtu))
-
-
struct llinfo_nd6 {
struct llinfo_nd6 *ln_next;
struct llinfo_nd6 *ln_prev;
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index d13f7a01526..e5533a513e7 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_rtr.c,v 1.129 2015/10/25 21:32:16 florian Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.130 2015/10/28 12:14:25 florian Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
@@ -529,43 +529,6 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
}
/*
- * MTU
- */
- if (ndopts.nd_opts_mtu && ndopts.nd_opts_mtu->nd_opt_mtu_len == 1) {
- u_long mtu;
- u_long maxmtu;
-
- mtu = ntohl(ndopts.nd_opts_mtu->nd_opt_mtu_mtu);
-
- /* lower bound */
- if (mtu < IPV6_MMTU) {
- nd6log((LOG_INFO, "nd6_ra_input: bogus mtu option "
- "mtu=%lu sent from %s, ignoring\n",
- mtu,
- inet_ntop(AF_INET6, &ip6->ip6_src,
- src, sizeof(src))));
- goto skip;
- }
-
- /* upper bound */
- maxmtu = (ndi->maxmtu && ndi->maxmtu < ifp->if_mtu)
- ? ndi->maxmtu : ifp->if_mtu;
- if (mtu <= maxmtu) {
- ndi->linkmtu = mtu;
- } else {
- nd6log((LOG_INFO, "nd6_ra_input: bogus mtu "
- "mtu=%lu sent from %s; "
- "exceeds maxmtu %lu, ignoring\n",
- mtu,
- inet_ntop(AF_INET6, &ip6->ip6_src,
- src, sizeof(src)),
- maxmtu));
- }
- }
-
- skip:
-
- /*
* Source link layer address
*/
{