diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-11-17 09:09:09 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-11-17 09:13:49 +0100 |
commit | 2cffe0c44e62b9e063fa30ce07431753494c53c2 (patch) | |
tree | 4f9977485780402f699ddeb95e76ea6654b684fb /vlan.c | |
parent | 76d2d41b7355e02f95fbfa79affbd232fb090595 (diff) | |
download | netifd-2cffe0c44e62b9e063fa30ce07431753494c53c2.tar.gz |
treewide: correctly apply IFNAMSIZ limit
The `IFNAMSIZ` macro defines the required buffer size to hold a Linux
interface name including the terminating zero byte while netifd currently
uses an `IFNAMSIZ + 1` limit for interface name buffers.
This causes netifd to use overlong names (16 instead of 15 bytes) in
netlink communication with the kernel, leading to netlink failure replies
due to policy violations.
Fix this issue by applying the correct length, that is `IFNAMSIZ` directly,
to the corresponding buffers.
Ref: https://github.com/openwrt/openwrt/issues/11259
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'vlan.c')
-rw-r--r-- | vlan.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -128,7 +128,7 @@ static int vlan_set_device_state(struct device *dev, bool up) static void vlan_dev_cb(struct device_user *dep, enum device_event ev) { - char name[IFNAMSIZ + 1]; + char name[IFNAMSIZ]; struct vlan_device *vldev; vldev = container_of(dep, struct vlan_device, dep); @@ -175,7 +175,7 @@ static struct device *get_vlan_device(struct device *dev, char *id_str, bool cre }; struct vlan_device *vldev; struct device_user *dep; - char name[IFNAMSIZ + 1]; + char name[IFNAMSIZ]; char *err = NULL; int id, *alias_id; |