diff options
author | Benoît Ganne <bganne@cisco.com> | 2023-01-27 11:37:59 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@0xa5.net> | 2023-03-06 17:51:10 +0000 |
commit | 258aac905cd20f2a92ad2bd043770cf4ce4afc60 (patch) | |
tree | 0a7c5696a6a9a22aa8302a74233f2fa1f8d0f3d7 /src/plugins/af_xdp/device.c | |
parent | 634873c3ee2e1dcb045c453a4bd0b602447c3e1a (diff) |
af_xdp: fix netns configuration
- clib_open_netns() expects a NULL-terminated C-string
- if no netns was given, we should not try to format it otherwise we'll
get "(nil)" as netns name.
Type: fix
Change-Id: I7b6022f6e8999640d0d2a83b854455b15fa4c134
Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/af_xdp/device.c')
-rw-r--r-- | src/plugins/af_xdp/device.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/af_xdp/device.c b/src/plugins/af_xdp/device.c index 06b86893646..570f34cdc7e 100644 --- a/src/plugins/af_xdp/device.c +++ b/src/plugins/af_xdp/device.c @@ -637,7 +637,8 @@ af_xdp_create_if (vlib_main_t * vm, af_xdp_create_if_args_t * args) ad->linux_ifname = (char *) format (0, "%s", args->linux_ifname); vec_validate (ad->linux_ifname, IFNAMSIZ - 1); /* libbpf expects ifname to be at least IFNAMSIZ */ - ad->netns = (char *) format (0, "%s", args->netns); + if (args->netns) + ad->netns = (char *) format (0, "%s%c", args->netns, 0); ad->linux_ifindex = if_nametoindex (ad->linux_ifname); if (!ad->linux_ifindex) |