From f73105ab42795422f131fb711712e3c860df982f Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 15 Oct 2015 21:01:16 +0200 Subject: ss: return -1 if an unrecognized option was given When getopt_long encounters an option which has not been registered, it returns '?'. React upon that and call usage() instead of help() so ss returns with a non-zero exit status. Signed-off-by: Phil Sutter --- misc/ss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/ss.c b/misc/ss.c index eca4aa3..a9ae85e 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -3770,8 +3770,8 @@ int main(int argc, char *argv[]) exit(1); break; case 'h': - case '?': help(); + case '?': default: usage(); } -- cgit v1.2.3 From ccaf6eb5cc1020c7fe8997b8cadf9a12cf92302a Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 15 Oct 2015 22:32:17 +0200 Subject: ip-rule: neither prohibit nor reject or unreachable flags exist This has been inconsistent since the beginning of Git and seems to be merely a documentation leftover, therefore just remove it from help output and man page. Signed-off-by: Phil Sutter --- ip/iprule.c | 1 - man/man8/ip-rule.8 | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ip/iprule.c b/ip/iprule.c index 714278a..2fa9ade 100644 --- a/ip/iprule.c +++ b/ip/iprule.c @@ -36,7 +36,6 @@ static void usage(void) fprintf(stderr, "SELECTOR := [ not ] [ from PREFIX ] [ to PREFIX ] [ tos TOS ] [ fwmark FWMARK[/MASK] ]\n"); fprintf(stderr, " [ iif STRING ] [ oif STRING ] [ pref NUMBER ]\n"); fprintf(stderr, "ACTION := [ table TABLE_ID ]\n"); - fprintf(stderr, " [ prohibit | reject | unreachable ]\n"); fprintf(stderr, " [ realms [SRCREALM/]DSTREALM ]\n"); fprintf(stderr, " [ goto NUMBER ]\n"); fprintf(stderr, " SUPPRESSOR\n"); diff --git a/man/man8/ip-rule.8 b/man/man8/ip-rule.8 index dd925be..6245d8c 100644 --- a/man/man8/ip-rule.8 +++ b/man/man8/ip-rule.8 @@ -41,7 +41,7 @@ ip-rule \- routing policy database management .IR TABLE_ID " ] [ " .B nat .IR ADDRESS " ] [ " -.BR prohibit " | " reject " | " unreachable " ] [ " realms +.B realms .RI "[" SRCREALM "/]" DSTREALM " ]" .I SUPPRESSOR -- cgit v1.2.3 From 4d45bf3bafa6960720193dbf57042a3b43b73868 Mon Sep 17 00:00:00 2001 From: Wilson Kok Date: Thu, 15 Oct 2015 14:53:17 -0700 Subject: bridge: add calls to fflush in fdb and mdb print functions This patch adds fflush in fdb and mdb print functions Signed-off-by: Wilson Kok Signed-off-by: Roopa Prabhu --- bridge/fdb.c | 2 ++ bridge/mdb.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/bridge/fdb.c b/bridge/fdb.c index bd7e4f9..5ea50ab 100644 --- a/bridge/fdb.c +++ b/bridge/fdb.c @@ -163,6 +163,8 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) fprintf(fp, "offload "); fprintf(fp, "%s\n", state_n2a(r->ndm_state)); + fflush(fp); + return 0; } diff --git a/bridge/mdb.c b/bridge/mdb.c index b14bd01..24c4903 100644 --- a/bridge/mdb.c +++ b/bridge/mdb.c @@ -135,6 +135,8 @@ int print_mdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) } } + fflush(fp); + return 0; } -- cgit v1.2.3 From 8b21cef12943cab841ba9adabb8ce2360b04c65e Mon Sep 17 00:00:00 2001 From: Roopa Prabhu Date: Thu, 15 Oct 2015 15:23:50 -0700 Subject: ip route get: change exit to return to support batch commands replace exit with return -2 on rtnl_talk failure Signed-off-by: Roopa Prabhu --- ip/iproute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ip/iproute.c b/ip/iproute.c index da25548..b137f55 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -1643,7 +1643,7 @@ static int iproute_get(int argc, char **argv) req.r.rtm_family = AF_INET; if (rtnl_talk(&rth, &req.n, &req.n, sizeof(req)) < 0) - exit(2); + return -2; if (connected && !from_ok) { struct rtmsg *r = NLMSG_DATA(&req.n); -- cgit v1.2.3