summaryrefslogtreecommitdiffstats
path: root/net/tap-linux.c
diff options
context:
space:
mode:
authorAndrew Melnychenko2021-05-14 13:48:30 +0200
committerJason Wang2021-06-04 09:25:46 +0200
commit8f364e344c3e71d4cc4e683d21241f6c36d62a5e (patch)
tree5ba18bb9310ff32504c4d5bcb48e4c6e2136c698 /net/tap-linux.c
parentnet/tap: Added TUNSETSTEERINGEBPF code. (diff)
downloadqemu-8f364e344c3e71d4cc4e683d21241f6c36d62a5e.tar.gz
qemu-8f364e344c3e71d4cc4e683d21241f6c36d62a5e.tar.xz
qemu-8f364e344c3e71d4cc4e683d21241f6c36d62a5e.zip
net: Added SetSteeringEBPF method for NetClientState.
For now, that method supported only by Linux TAP. Linux TAP uses TUNSETSTEERINGEBPF ioctl. Signed-off-by: Andrew Melnychenko <andrew@daynix.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'net/tap-linux.c')
-rw-r--r--net/tap-linux.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/tap-linux.c b/net/tap-linux.c
index b0635e9e32..9584769740 100644
--- a/net/tap-linux.c
+++ b/net/tap-linux.c
@@ -316,3 +316,16 @@ int tap_fd_get_ifname(int fd, char *ifname)
pstrcpy(ifname, sizeof(ifr.ifr_name), ifr.ifr_name);
return 0;
}
+
+int tap_fd_set_steering_ebpf(int fd, int prog_fd)
+{
+ if (ioctl(fd, TUNSETSTEERINGEBPF, (void *) &prog_fd) != 0) {
+ error_report("Issue while setting TUNSETSTEERINGEBPF:"
+ " %s with fd: %d, prog_fd: %d",
+ strerror(errno), fd, prog_fd);
+
+ return -1;
+ }
+
+ return 0;
+}