diff options
| author | Timo Völker <timo.voelker@fh-muenster.de> | 2026-04-26 09:48:36 +0000 |
|---|---|---|
| committer | Michael Tuexen <tuexen@FreeBSD.org> | 2026-04-26 09:48:36 +0000 |
| commit | 28932dc425e19267313d221c26d10d3638e1cc4b (patch) | |
| tree | 4147d63bc816e96f65a03ad1de981cec398362dd | |
| parent | 1bfd392b9e4dcddef3d80efaa517fafa648cd0b1 (diff) | |
tuntap: add SIOCGIFCAP and SIOCSIFCAP ioctls
Add SIOCGIFCAP ioctl-command for tun/tap character device to be used
by bhyve for offloading in the future.
Add SIOCSIFCAP for symmetry.
Reviewed by: markj, pouria, tuexen
MFC after: 1 week
Event: Wiesbaden Hackathon 2026
Differential Revision: https://reviews.freebsd.org/D51289
| -rw-r--r-- | sys/net/if_tuntap.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c index 3f8a96311725..a1ef2541ffba 100644 --- a/sys/net/if_tuntap.c +++ b/sys/net/if_tuntap.c @@ -1802,6 +1802,23 @@ tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, case FIOGETOWN: *(int *)data = fgetown(&tp->tun_sigio); return (0); + case SIOCGIFCAP: + ifrp = (struct ifreq *)data; + TUN_LOCK(tp); + ifrp->ifr_reqcap = ifp->if_capabilities; + ifrp->ifr_curcap = ifp->if_capenable; + TUN_UNLOCK(tp); + break; + case SIOCSIFCAP: + ifrp = (struct ifreq *)data; + if (ifrp->ifr_reqcap & ~ifp->if_capabilities) + return (EINVAL); + TUN_LOCK(tp); + ifp->if_capenable = ifrp->ifr_reqcap; + tun_caps_changed(ifp); + TUN_UNLOCK(tp); + VLAN_CAPABILITIES(ifp); + break; /* This is deprecated, FIOSETOWN should be used instead. */ case TIOCSPGRP: |
