die and ifp->if_mtu is the one true mtu.
Suggested by and OK mpi@
-/* $OpenBSD: if.c,v 1.399 2015/10/27 10:52:17 mpi Exp $ */
+/* $OpenBSD: if.c,v 1.400 2015/10/28 12:14:25 florian Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
break;
case SIOCSIFMTU:
- {
-#ifdef INET6
- int oldmtu = ifp->if_mtu;
-#endif
-
if ((error = suser(p, 0)) != 0)
return (error);
if (ifp->if_ioctl == NULL)
return (EOPNOTSUPP);
error = (*ifp->if_ioctl)(ifp, cmd, data);
-
- /*
- * If the link MTU changed, do network layer specific procedure.
- */
-#ifdef INET6
- if (ifp->if_mtu != oldmtu)
- nd6_setmtu(ifp);
-#endif
break;
- }
case SIOCSIFPHYADDR:
case SIOCDIFPHYADDR:
-/* $OpenBSD: tcp_input.c,v 1.306 2015/10/24 16:08:48 mpi Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.307 2015/10/28 12:14:25 florian Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
* for IPv6, path MTU discovery is always turned on,
* or the node must use packet size <= 1280.
*/
- mss = IN6_LINKMTU(ifp) - iphlen - sizeof(struct tcphdr);
+ mss = ifp->if_mtu - iphlen - sizeof(struct tcphdr);
}
#endif /* INET6 */
/* Calculate the value that we offer in TCPOPT_MAXSEG */
if (offer != -1) {
-#ifndef INET6
mssopt = ifp->if_mtu - iphlen - sizeof(struct tcphdr);
-#else
- if (tp->pf == AF_INET6)
- mssopt = IN6_LINKMTU(ifp) - iphlen -
- sizeof(struct tcphdr);
- else
- mssopt = ifp->if_mtu - iphlen - sizeof(struct tcphdr);
-#endif
-
mssopt = max(tcp_mssdflt, mssopt);
}
#ifdef INET6
case AF_INET6:
if (ifp != NULL)
- mss = IN6_LINKMTU(ifp);
+ mss = ifp->if_mtu;
iphlen = sizeof(struct ip6_hdr);
break;
#endif
-/* $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 $ */
/*
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;
}
-/* $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 $ */
/*
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;
}
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
* 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;
#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];
-/* $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 $ */
/*
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;
}
}
}
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:
*/
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
* 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 */
-/* $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 $ */
/*
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 *);
/* 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;
}
free(nd, M_IP6NDP, 0);
}
-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)
{
-/* $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 $ */
/*
#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 */
#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;
-/* $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 $ */
/*
}
}
- /*
- * 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
*/
-/* $OpenBSD: ndp.c,v 1.66 2015/10/25 11:44:30 deraadt Exp $ */
+/* $OpenBSD: ndp.c,v 1.67 2015/10/28 12:14:25 florian Exp $ */
/* $KAME: ndp.c,v 1.101 2002/07/17 08:46:33 itojun Exp $ */
/*
/* NOTREACHED */
}
- printf("linkmtu=%d", ND.linkmtu);
- printf(", basereachable=%ds%dms",
+ printf("basereachable=%ds%dms",
ND.basereachable / 1000, ND.basereachable % 1000);
printf(", reachable=%ds", ND.reachable);
printf(", retrans=%ds%dms", ND.retrans / 1000, ND.retrans % 1000);