summaryrefslogtreecommitdiffstats
path: root/sys/net/if_disc.c
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2014-11-06 13:13:09 +0000
committermelifaro <melifaro@FreeBSD.org>2014-11-06 13:13:09 +0000
commit11af63037f17d7b85036d03dc07687f77171b4b2 (patch)
treee082f90704be30b48e7fe45d4a0f281b5f2aeb38 /sys/net/if_disc.c
parent8f3d66d3767f46a54deb15c978d5ee6c94f40d67 (diff)
downloadFreeBSD-src-11af63037f17d7b85036d03dc07687f77171b4b2.zip
FreeBSD-src-11af63037f17d7b85036d03dc07687f77171b4b2.tar.gz
Make checks for rt_mtu generic:
Some virtual if drivers has (ab)used ifa ifa_rtrequest hook to enforce route MTU to be not bigger that interface MTU. While ifa_rtrequest hooking might be an option in some situation, it is not feasible to do MTU checks there: generic (or per-domain) routing code is perfectly capable of doing this. We currrently have 3 places where MTU is altered: 1) route addition. In this case domain overrides radix _addroute callback (in[6]_addroute) and all necessary checks/fixes are/can be done there. 2) route change (especially, GW change). In this case, there are no explicit per-domain calls, but one can override rte by setting ifa_rtrequest hook to domain handler (inet6 does this). 3) ifconfig ifaceX mtu YYYY In this case, we have no callbacks, but ip[6]_output performes runtime checks and decreases rt_mtu if necessary. Generally, the goals are to be able to handle all MTU changes in control plane, not in runtime part, and properly deal with increased interface MTU. This commit changes the following: * removes hooks setting MTU from drivers side * adds proper per-doman MTU checks for case 1) * adds generic MTU check for case 2) * The latter is done by using new dom_ifmtu callback since if_mtu denotes L3 interface MTU, e.g. maximum trasmitted _packet_ size. However, IPv6 mtu might be different from if_mtu one (e.g. default 1280) for some cases, so we need an abstract way to know maximum MTU size for given interface and domain. * moves rt_setmetrics() before MTU/ifa_rtrequest hooks since it copies user-supplied data which must be checked. * removes RT_LOCK_ASSERT() from other ifa_rtrequest hooks to be able to use this functions on new non-inserted rte. More changes will follow soon. MFC after: 1 month Sponsored by: Yandex LLC
Diffstat (limited to 'sys/net/if_disc.c')
-rw-r--r--sys/net/if_disc.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/sys/net/if_disc.c b/sys/net/if_disc.c
index de36886..b6e1d20 100644
--- a/sys/net/if_disc.c
+++ b/sys/net/if_disc.c
@@ -67,7 +67,6 @@ struct disc_softc {
static int discoutput(struct ifnet *, struct mbuf *,
const struct sockaddr *, struct route *);
-static void discrtrequest(int, struct rtentry *, struct rt_addrinfo *);
static int discioctl(struct ifnet *, u_long, caddr_t);
static int disc_clone_create(struct if_clone *, int, caddr_t);
static void disc_clone_destroy(struct ifnet *);
@@ -198,31 +197,19 @@ discoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
return (0);
}
-/* ARGSUSED */
-static void
-discrtrequest(int cmd, struct rtentry *rt, struct rt_addrinfo *info)
-{
-
- RT_LOCK_ASSERT(rt);
- rt->rt_mtu = DSMTU;
-}
-
/*
* Process an ioctl request.
*/
static int
discioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
- struct ifaddr *ifa;
struct ifreq *ifr = (struct ifreq *)data;
int error = 0;
switch (cmd) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
- ifa = (struct ifaddr *)data;
- if (ifa != 0)
- ifa->ifa_rtrequest = discrtrequest;
+
/*
* Everything else is done at a higher level.
*/
OpenPOWER on IntegriCloud