Add ability to set link state with ip
Exposes existing netlink operations to modify link state of devices.
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index aea1a81..9306a37 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -131,6 +131,16 @@
fprintf(f, "state %s ", oper_states[state]);
}
+int get_operstate(const char *name)
+{
+ int i;
+
+ for (i = 0; i < sizeof(oper_states)/sizeof(oper_states[0]); i++)
+ if (strcasecmp(name, oper_states[i]) == 0)
+ return i;
+ return -1;
+}
+
static void print_queuelen(FILE *f, struct rtattr *tb[IFLA_MAX + 1])
{
int qlen;