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>
This commit is contained in:
Andrew Melnychenko 2021-05-14 14:48:30 +03:00 committed by Jason Wang
parent 78258debe0
commit 8f364e344c
7 changed files with 40 additions and 0 deletions

View file

@ -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;
}