Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142038013
D54724.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D54724.diff
View Options
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -2627,9 +2627,14 @@
EVENTHANDLER_PRI_ANY);
uint32_t
-in6_ifmtu(struct ifnet *ifp)
+in6_ifmtu(const struct ifnet *ifp)
{
- return (IN6_LINKMTU(ifp));
+ struct nd_ifinfo *ndi = ND_IFINFO(ifp);
+
+ return (
+ (ndi->linkmtu > 0 && ndi->linkmtu < ifp->if_mtu) ? ndi->linkmtu :
+ ((ndi->maxmtu > 0 && ndi->maxmtu < ifp->if_mtu) ? ndi->maxmtu :
+ ifp->if_mtu));
}
/*
diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c
--- a/sys/netinet6/in6_rmx.c
+++ b/sys/netinet6/in6_rmx.c
@@ -114,10 +114,8 @@
* inherit interface MTU if not set or
* check if MTU is too large.
*/
- if (nh->nh_mtu == 0) {
- nh->nh_mtu = IN6_LINKMTU(nh->nh_ifp);
- } else if (nh->nh_mtu > IN6_LINKMTU(nh->nh_ifp))
- nh->nh_mtu = IN6_LINKMTU(nh->nh_ifp);
+ if (nh->nh_mtu == 0 || nh->nh_mtu > in6_ifmtu(nh->nh_ifp))
+ nh->nh_mtu = in6_ifmtu(nh->nh_ifp);
/* Set nexthop type */
if (nhop_get_type(nh) == 0) {
diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -861,7 +861,7 @@
void in6_purgeifaddr(struct in6_ifaddr *);
int in6if_do_dad(struct ifnet *);
void in6_savemkludge(struct in6_ifaddr *);
-uint32_t in6_ifmtu(struct ifnet *);
+uint32_t in6_ifmtu(const struct ifnet *);
struct rib_head *in6_inithead(uint32_t fibnum);
void in6_detachhead(struct rib_head *rh);
int in6_if2idlen(struct ifnet *);
diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c
--- a/sys/netinet6/ip6_forward.c
+++ b/sys/netinet6/ip6_forward.c
@@ -384,11 +384,11 @@
pass:
/* See if the size was changed by the packet filter. */
/* TODO: change to nh->nh_mtu */
- if (m->m_pkthdr.len > IN6_LINKMTU(nh->nh_ifp)) {
+ if (m->m_pkthdr.len > in6_ifmtu(nh->nh_ifp)) {
in6_ifstat_inc(nh->nh_ifp, ifs6_in_toobig);
if (mcopy)
icmp6_error(mcopy, ICMP6_PACKET_TOO_BIG, 0,
- IN6_LINKMTU(nh->nh_ifp));
+ in6_ifmtu(nh->nh_ifp));
goto bad;
}
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -1582,7 +1582,7 @@
* 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);
+ linkmtu = in6_ifmtu(ifp);
if (mb_copy->m_pkthdr.len <= linkmtu || linkmtu < IPV6_MMTU) {
struct sockaddr_in6 dst6;
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1146,7 +1146,7 @@
dontfrag = 1;
else
dontfrag = 0;
- if (dontfrag && tlen > IN6_LINKMTU(ifp) && !tso) { /* Case 2-b. */
+ if (dontfrag && tlen > in6_ifmtu(ifp) && !tso) { /* Case 2-b. */
/*
* If the DONTFRAG option is specified, we cannot send the
* packet when the data length is larger than the MTU of the
@@ -1560,7 +1560,7 @@
}
if (mtu == 0)
- mtu = IN6_LINKMTU(ifp);
+ mtu = in6_ifmtu(ifp);
*mtup = mtu;
}
diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h
--- a/sys/netinet6/nd6.h
+++ b/sys/netinet6/nd6.h
@@ -83,11 +83,6 @@
#ifdef _KERNEL
#define ND_IFINFO(ifp) ((if_getinet6(ifp))->nd_ifinfo)
-#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))
#endif
struct in6_nbrinfo {
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1662,7 +1662,7 @@
/* 0 means 'unspecified' */
if (ND.linkmtu != 0) {
if (ND.linkmtu < IPV6_MMTU ||
- ND.linkmtu > IN6_LINKMTU(ifp)) {
+ ND.linkmtu > in6_ifmtu(ifp)) {
error = EINVAL;
break;
}
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -11708,9 +11708,9 @@
* it here, before we do any NAT.
*/
if (af == AF_INET6 && dir == PF_OUT && pflags & PFIL_FWD &&
- IN6_LINKMTU(ifp) < pf_max_frag_size(*m0)) {
+ in6_ifmtu(ifp) < pf_max_frag_size(*m0)) {
PF_RULES_RUNLOCK();
- icmp6_error(*m0, ICMP6_PACKET_TOO_BIG, 0, IN6_LINKMTU(ifp));
+ icmp6_error(*m0, ICMP6_PACKET_TOO_BIG, 0, in6_ifmtu(ifp));
*m0 = NULL;
return (PF_DROP);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 16, 7:08 AM (11 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27659087
Default Alt Text
D54724.diff (4 KB)
Attached To
Mode
D54724: netinet6: use in6_ifmtu() instead of IN6_LINKMTU() macro
Attached
Detach File
Event Timeline
Log In to Comment