diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-05-30 05:07:18 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-05-30 05:07:18 +0000 |
commit | fbe8c0475cadd6e6bc9e5c373f7d944457015f9e (patch) | |
tree | dbcd5ff2f95cb50825b35db3cb089c1c523e286f /sys/netinet6 | |
parent | c7c9a27065006a60c8aa30e8b45663e0cb2cf3a1 (diff) |
improve nd6_setmtu(), to warn too-small MTU on SIOCSIFMTU. sync w/kame
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/nd6.c | 39 | ||||
-rw-r--r-- | sys/netinet6/nd6.h | 4 |
2 files changed, 29 insertions, 14 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 39e6e76ec5e..c72734dd1ea 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.44 2002/05/29 13:57:57 itojun Exp $ */ +/* $OpenBSD: nd6.c,v 1.45 2002/05/30 05:07:17 itojun Exp $ */ /* $KAME: nd6.c,v 1.151 2001/06/19 14:24:41 sumikawa Exp $ */ /* @@ -99,6 +99,7 @@ struct nd_prhead nd_prefix = { 0 }; int nd6_recalc_reachtm_interval = ND6_RECALC_REACHTM_INTERVAL; static struct sockaddr_in6 all1_sa; +static void nd6_setmtu0(struct ifnet *, struct nd_ifinfo *); static void nd6_slowtimo(void *); struct timeout nd6_slowtimo_ch; @@ -147,7 +148,9 @@ nd6_ifattach(ifp) nd->reachable = ND_COMPUTE_RTIME(nd->basereachable); nd->retrans = RETRANS_TIMER; nd->flags = ND6_IFF_PERFORMNUD; - nd6_setmtu(ifp, nd); + + /* XXX: we cannot call nd6_setmtu since ifp is not fully initialized */ + nd6_setmtu0(ifp, nd); return nd; } @@ -159,16 +162,22 @@ nd6_ifdetach(nd) free(nd, M_IP6NDP); } - -/* - * Reset ND level link MTU. This function is called when the physical MTU - * changes, which means we might have to adjust the ND level MTU. - */ + +void +nd6_setmtu(ifp) + struct ifnet *ifp; +{ + nd6_setmtu0(ifp, ND_IFINFO(ifp)); +} + void -nd6_setmtu(ifp, ndi) +nd6_setmtu0(ifp, ndi) struct ifnet *ifp; struct nd_ifinfo *ndi; { + u_int32_t omaxmtu; + + omaxmtu = ndi->maxmtu; switch (ifp->if_type) { case IFT_ARCNET: /* XXX MTU handling needs more work */ @@ -188,10 +197,16 @@ nd6_setmtu(ifp, ndi) break; } - if (ndi->maxmtu < IPV6_MMTU) { - nd6log((LOG_INFO, "nd6_setmtu: " - "link MTU on %s (%lu) is too small for IPv6\n", - ifp->if_xname, (unsigned long)ndi->maxmtu)); + /* + * 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, "nd6_setmtu0: " + "new link MTU on %s (%lu) is too small for IPv6\n", + ifp->if_xname, (unsigned long)ndi->maxmtu); } if (ndi->maxmtu > in6_maxmtu) diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index 1e8218029b3..ce113e1190c 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.h,v 1.18 2002/05/29 09:33:55 itojun Exp $ */ +/* $OpenBSD: nd6.h,v 1.19 2002/05/30 05:07:17 itojun Exp $ */ /* $KAME: nd6.h,v 1.52 2001/02/19 04:40:37 itojun Exp $ */ /* @@ -324,7 +324,7 @@ void nd6_option_init(void *, int, union nd_opts *); struct nd_opt_hdr *nd6_option(union nd_opts *); int nd6_options(union nd_opts *); struct rtentry *nd6_lookup(struct in6_addr *, int, struct ifnet *); -void nd6_setmtu(struct ifnet *, struct nd_ifinfo *); +void nd6_setmtu(struct ifnet *); void nd6_timer(void *); void nd6_purge(struct ifnet *); struct llinfo_nd6 *nd6_free(struct rtentry *); |