Skip to contentSkip to conversation

: Refuse "ip link add/replace" without device type parameter

IPROUTE Patrick McHardy 1 participant 2 messages Oct 7, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

commit c3ae059edf3316cff1075c2401bdeefa5e262251

Author: Patrick McHardy <[email protected]>
Date:   Tue Oct 7 16:55:21 2008 +0200

[IPROUTE]: Refuse "ip link add/replace" without device type parameter

Fix confusing error message noticed by Martin Josefsson:

# ip link add
RTNETLINK answers: Operation not supported

The reason is missing device type information, refuse this and print a message.

ip/iplink.c +4 -0
index 81122ae..6e9ac71 100644
@@ -336,6 +336,10 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
 			return -1;
 		}
 		linkinfo->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)linkinfo;
+	} else if (flags & NLM_F_CREATE) {
+		fprintf(stderr, "Not enough informatin: \"type\" argument "
+				"is required\n");
+		return -1;
 	}
 
 	if (!(flags & NLM_F_CREATE)) {
#1 lore raw

Fix typo noticed by Phil Oester: information vs. informatin

commit c3ae059edf3316cff1075c2401bdeefa5e262251

Author: Patrick McHardy <[email protected]>
Date:   Tue Oct 7 16:55:21 2008 +0200

[IPROUTE]: Refuse "ip link add/replace" without device type parameter

Fix confusing error message noticed by Martin Josefsson:

# ip link add
RTNETLINK answers: Operation not supported

The reason is missing device type information, refuse this and print a message.

ip/iplink.c +4 -0
index 81122ae..6e9ac71 100644
@@ -336,6 +336,10 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
 			return -1;
 		}
 		linkinfo->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)linkinfo;
+	} else if (flags & NLM_F_CREATE) {
+		fprintf(stderr, "Not enough information: \"type\" argument "
+				"is required\n");
+		return -1;
 	}
 
 	if (!(flags & NLM_F_CREATE)) {