diff --git a/include/utils.h b/include/utils.h index 9151c4f..e8a5467 100644 --- a/include/utils.h +++ b/include/utils.h @@ -25,6 +25,7 @@ extern char * _SL_; extern int max_flush_loops; extern int batch_mode; extern bool do_all; +extern bool require_ifconfig_compat; #ifndef IPPROTO_ESP #define IPPROTO_ESP 50 diff --git a/ip/ip.c b/ip/ip.c index da16b15..26f9910 100644 --- a/ip/ip.c +++ b/ip/ip.c @@ -37,6 +37,7 @@ int force = 0; int max_flush_loops = 10; int batch_mode = 0; bool do_all = false; +bool require_ifconfig_compat = true; struct rtnl_handle rth = { .fd = -1 }; @@ -246,6 +247,7 @@ int main(int argc, char **argv) exit(0); } else if (matches(opt, "-force") == 0) { ++force; + require_ifconfig_compat = false; } else if (matches(opt, "-batch") == 0) { argc--; argv++; diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 99a6ab5..a1fa785 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -1691,7 +1691,7 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv) fprintf(stderr, "Not enough information: \"dev\" argument is required.\n"); return -1; } - if (l && matches(d, l) != 0) { + if (require_ifconfig_compat && l && matches(d, l) != 0) { fprintf(stderr, "\"dev\" (%s) must match \"label\" (%s).\n", d, l); return -1; } diff --git a/man/man8/ip.8 b/man/man8/ip.8 index 016e8c6..3c3512c 100644 --- a/man/man8/ip.8 +++ b/man/man8/ip.8 @@ -54,6 +54,8 @@ First failure will cause termination of ip. Don't terminate ip on errors in batch mode. If there were any errors during execution of the commands, the application return code will be non zero. +This option also allows creation of address labels that may not be backwards compatible with ifconfig. + .TP .BR "\-s" , " \-stats" , " \-statistics" Output more information. If the option