diff options
author | David Ahern <dsahern@kernel.org> | 2022-12-02 08:59:28 -0700 |
---|---|---|
committer | David Ahern <dsahern@kernel.org> | 2022-12-02 08:59:28 -0700 |
commit | 8a1cc48311595e1b8e252774c7fd3b4dc8e61dfd (patch) | |
tree | cf247127a115b4f2c663bd5ac88ecdda999a5458 /ip | |
parent | fee4a56f01913c686efb040b2bac32c97de13b7c (diff) | |
parent | d4b01c0f4187e5c7c902223d96f845b8d21ce03c (diff) | |
download | iproute2-8a1cc48311595e1b8e252774c7fd3b4dc8e61dfd.tar.gz |
Merge branch 'main' into next
Signed-off-by: David Ahern <dsahern@kernel.org>
Diffstat (limited to 'ip')
-rw-r--r-- | ip/ipaddress.c | 10 | ||||
-rw-r--r-- | ip/iplink.c | 2 | ||||
-rw-r--r-- | ip/ipmroute.c | 12 | ||||
-rw-r--r-- | ip/ipnexthop.c | 10 | ||||
-rw-r--r-- | ip/iproute.c | 10 | ||||
-rw-r--r-- | ip/iprule.c | 10 | ||||
-rw-r--r-- | ip/xfrm_state.c | 11 |
7 files changed, 34 insertions, 31 deletions
diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 456545bb..5e833482 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -2422,6 +2422,7 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv) __u32 preferred_lft = INFINITY_LIFE_TIME; __u32 valid_lft = INFINITY_LIFE_TIME; unsigned int ifa_flags = 0; + int ret; while (argc > 0) { if (strcmp(*argv, "peer") == 0 || @@ -2604,9 +2605,14 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv) } if (echo_request) - return rtnl_echo_talk(&rth, &req.n, json, print_addrinfo); + ret = rtnl_echo_talk(&rth, &req.n, json, print_addrinfo); + else + ret = rtnl_talk(&rth, &req.n, NULL); - return rtnl_talk(&rth, &req.n, NULL); + if (ret) + return -2; + + return 0; } int do_ipaddr(int argc, char **argv) diff --git a/ip/iplink.c b/ip/iplink.c index 92ce6c47..301a535e 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -1129,7 +1129,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv) ret = rtnl_talk(&rth, &req.n, NULL); if (ret) - return ret; + return -2; /* remove device from cache; next use can refresh with new data */ ll_drop_by_index(req.i.ifi_index); diff --git a/ip/ipmroute.c b/ip/ipmroute.c index 981baf2a..32019c94 100644 --- a/ip/ipmroute.c +++ b/ip/ipmroute.c @@ -39,9 +39,6 @@ static void usage(void) "Usage: ip mroute show [ [ to ] PREFIX ] [ from PREFIX ] [ iif DEVICE ]\n" " [ table TABLE_ID ]\n" "TABLE_ID := [ local | main | default | all | NUMBER ]\n" -#if 0 - "Usage: ip mroute [ add | del ] DESTINATION from SOURCE [ iif DEVICE ] [ oif DEVICE ]\n" -#endif ); exit(-1); } @@ -322,14 +319,7 @@ int do_multiroute(int argc, char **argv) { if (argc < 1) return mroute_list(0, NULL); -#if 0 - if (matches(*argv, "add") == 0) - return mroute_modify(RTM_NEWADDR, argc-1, argv+1); - if (matches(*argv, "delete") == 0) - return mroute_modify(RTM_DELADDR, argc-1, argv+1); - if (matches(*argv, "get") == 0) - return mroute_get(argc-1, argv+1); -#endif + if (matches(*argv, "list") == 0 || matches(*argv, "show") == 0 || matches(*argv, "lst") == 0) return mroute_list(argc-1, argv+1); diff --git a/ip/ipnexthop.c b/ip/ipnexthop.c index c87e847f..9f16b809 100644 --- a/ip/ipnexthop.c +++ b/ip/ipnexthop.c @@ -920,6 +920,7 @@ static int ipnh_modify(int cmd, unsigned int flags, int argc, char **argv) .nhm.nh_family = preferred_family, }; __u32 nh_flags = 0; + int ret; while (argc > 0) { if (!strcmp(*argv, "id")) { @@ -1000,9 +1001,14 @@ static int ipnh_modify(int cmd, unsigned int flags, int argc, char **argv) req.nhm.nh_flags = nh_flags; if (echo_request) - return rtnl_echo_talk(&rth, &req.n, json, print_nexthop_nocache); + ret = rtnl_echo_talk(&rth, &req.n, json, print_nexthop_nocache); + else + ret = rtnl_talk(&rth, &req.n, NULL); + + if (ret) + return -2; - return rtnl_talk(&rth, &req.n, NULL); + return 0; } static int ipnh_get_id(__u32 id) diff --git a/ip/iproute.c b/ip/iproute.c index b4b9d1b2..f34289e8 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -1134,6 +1134,7 @@ static int iproute_modify(int cmd, unsigned int flags, int argc, char **argv) int raw = 0; int type_ok = 0; __u32 nhid = 0; + int ret; if (cmd != RTM_DELROUTE) { req.r.rtm_protocol = RTPROT_BOOT; @@ -1588,9 +1589,14 @@ static int iproute_modify(int cmd, unsigned int flags, int argc, char **argv) req.r.rtm_type = RTN_UNICAST; if (echo_request) - return rtnl_echo_talk(&rth, &req.n, json, print_route); + ret = rtnl_echo_talk(&rth, &req.n, json, print_route); + else + ret = rtnl_talk(&rth, &req.n, NULL); + + if (ret) + return -2; - return rtnl_talk(&rth, &req.n, NULL); + return 0; } static int iproute_flush_cache(void) diff --git a/ip/iprule.c b/ip/iprule.c index 8f750425..8e5a2287 100644 --- a/ip/iprule.c +++ b/ip/iprule.c @@ -787,6 +787,7 @@ static int iprule_modify(int cmd, int argc, char **argv) .frh.family = preferred_family, .frh.action = FR_ACT_UNSPEC, }; + int ret; if (cmd == RTM_NEWRULE) { if (argc == 0) { @@ -1017,9 +1018,14 @@ static int iprule_modify(int cmd, int argc, char **argv) req.frh.table = RT_TABLE_MAIN; if (echo_request) - return rtnl_echo_talk(&rth, &req.n, json, print_rule); + ret = rtnl_echo_talk(&rth, &req.n, json, print_rule); + else + ret = rtnl_talk(&rth, &req.n, NULL); + + if (ret) + return -2; - return rtnl_talk(&rth, &req.n, NULL); + return 0; } int do_iprule(int argc, char **argv) diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c index 6fee7efd..b2294d9f 100644 --- a/ip/xfrm_state.c +++ b/ip/xfrm_state.c @@ -124,11 +124,6 @@ static int xfrm_algo_parse(struct xfrm_algo *alg, enum xfrm_attr_type_t type, int len; int slen = strlen(key); -#if 0 - /* XXX: verifying both name and key is required! */ - fprintf(stderr, "warning: ALGO-NAME/ALGO-KEYMAT values will be sent to the kernel promiscuously! (verifying them isn't implemented yet)\n"); -#endif - strlcpy(alg->alg_name, name, sizeof(alg->alg_name)); if (slen > 2 && strncmp(key, "0x", 2) == 0) { @@ -791,12 +786,6 @@ static int xfrm_state_allocspi(int argc, char **argv) .n.nlmsg_flags = NLM_F_REQUEST, .n.nlmsg_type = XFRM_MSG_ALLOCSPI, .xspi.info.family = preferred_family, -#if 0 - .xspi.lft.soft_byte_limit = XFRM_INF, - .xspi.lft.hard_byte_limit = XFRM_INF, - .xspi.lft.soft_packet_limit = XFRM_INF, - .xspi.lft.hard_packet_limit = XFRM_INF, -#endif }; char *idp = NULL; char *minp = NULL; |