Handle netdev group for veth peer too
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/2 Initialize arguments to iplink_parse() by default
Be consistent when dealing with arguments passed to iplink_parse() by initializing to default values.
This fixes crash when ip-link(8) invoced with command:
ip link add dev veth1a type veth peer
--- ip/iplink.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
ip/iplink.c +3 -6
@@ -299,6 +299,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,int numtxqueues =-1 ;int numrxqueues =-1 ; + *name = *type = *link = *dev =NULL ; *group =-1 ; ret = argc;
@@ -498,15 +499,11 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,static int iplink_modify (int cmd,unsigned int flags,int argc,char **argv) { -int len; -char *dev =NULL ; -char *name =NULL ; -char *link =NULL ; -char *type =NULL ; +char *name, *type, *link, *dev;int group;struct link_util *lu =NULL ;struct iplink_req req; -int ret; +int len, ret;memset (&req,0 ,sizeof (req));
Signature · 1 line
1.7.10.4
Re: [PATCH 1/2] Initialize arguments to iplink_parse() by default
Quoted 8 lines
Be consistent when dealing with arguments passed to
iplink_parse()by initializing to default values.This fixes crash when ip-link(8) invoced with command:
ip link add dev veth1a type veth peer
Signed-off-by Sergey Popovich <[email protected]>
Rather than modifying iplink_parse, I just fixed in veth code where the bug was being caused.
PATCH 2/2 Handle netdev group for veth peer too
In reply to a message not in the archiveCurrently ip-link(8) parses, but ignores "group" argument to peer interface on veth creation.
Insert IFLA_GROUP attribute for peer interface when present.
--- ip/link_veth.c | 3 +++ 1 file changed, 3 insertions(+)
ip/link_veth.c +3 -0
@@ -53,6 +53,9 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,addattr_l (hdr,1024 ,IFLA_IFNAME , name, len); } +if (group !=-1 ) +addattr32 (hdr,1024 ,IFLA_GROUP , group); + data->rta_len = (void *)NLMSG_TAIL (hdr) - (void *)data;return argc -1 - err; }
Signature · 1 line
1.7.10.4