diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2018-02-18 23:53:18 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2018-02-18 23:53:18 +0000 |
commit | 42177ee755b9c6b25ad0e0087d4a21a01ce14a86 (patch) | |
tree | 9959b2f1c747fe7cf8cb32a75c6a8bae92c687b3 /sys/net | |
parent | 495b52f53740605bd08f659a3fdb1d73df7dfbdd (diff) |
don't allow configuration of non-ipv4 addresses.
i found out how to do this while reading the freebsd stf(4) driver.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_mobileip.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/net/if_mobileip.c b/sys/net/if_mobileip.c index 24eb6da11bd..dc740714d18 100644 --- a/sys/net/if_mobileip.c +++ b/sys/net/if_mobileip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mobileip.c,v 1.7 2018/02/12 02:55:40 dlg Exp $ */ +/* $OpenBSD: if_mobileip.c,v 1.8 2018/02/18 23:53:17 dlg Exp $ */ /* * Copyright (c) 2016 David Gwynne <dlg@openbsd.org> @@ -355,11 +355,16 @@ mobileip_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct mobileip_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; + struct ifaddr *ifa = (struct ifaddr *)data; int error = 0; switch(cmd) { case SIOCSIFADDR: - /* XXX restrict to AF_INET */ + if (ifa->ifa_addr->sa_family != AF_INET) { + error = EAFNOSUPPORT; + break; + } + ifp->if_flags |= IFF_UP; /* FALLTHROUGH */ case SIOCSIFFLAGS: |