<div dir="ltr">Crap, please don't apply as this is broken for IPv6. I will rework them and resubmit a new set of patches.<div><br></div><div>- Eric</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 31, 2020 at 12:26 PM Eric Molitor <<a href="mailto:emolitor@molitor.org">emolitor@molitor.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">---<br>
toys/pending/route.c | 17 +++++++----------<br>
1 file changed, 7 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/toys/pending/route.c b/toys/pending/route.c<br>
index 9c95d996..b37d3ecd 100644<br>
--- a/toys/pending/route.c<br>
+++ b/toys/pending/route.c<br>
@@ -290,20 +290,17 @@ static void setroute(sa_family_t family, char **argv)<br>
char *targetip;<br>
int sockfd, arg2_action;<br>
int action = get_action(&argv, arglist1); //verify the arg for add/del.<br>
+ struct nlmsghdr buf[8192 / sizeof(struct nlmsghdr)];<br>
+ struct nlmsghdr *nlMsg;<br>
+ struct rtmsg *rtMsg;<br>
<br>
if (!action || !*argv) help_exit("setroute");<br>
-<br>
arg2_action = get_action(&argv, arglist2); //verify the arg for -net or -host<br>
if (!*argv) help_exit("setroute");<br>
-<br>
targetip = *argv++;<br>
-<br>
- struct nlmsghdr *nlMsg;<br>
- struct rtmsg *rtMsg;<br>
-<br>
sockfd = xsocket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);<br>
- memset(toybuf, 0, sizeof(toybuf));<br>
- nlMsg = (struct nlmsghdr *) toybuf;<br>
+ memset(buf, 0, sizeof(buf));<br>
+ nlMsg = (struct nlmsghdr *) buf;<br>
rtMsg = (struct rtmsg *) NLMSG_DATA(nlMsg);<br>
<br>
nlMsg->nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg));<br>
@@ -350,7 +347,7 @@ static void setroute(sa_family_t family, char **argv)<br>
} else if (!strcmp(*argv, "reject")) {<br>
rtMsg->rtm_type = RTN_UNREACHABLE;<br>
} else {<br>
- if (!argv[1]) help_exit(0);<br>
+ if (!argv[1]) show_help(stdout, 1);<br>
<br>
if (!strcmp(*argv, "metric")) {<br>
unsigned int priority = atolx_range(argv[1], 0, UINT_MAX);<br>
@@ -423,7 +420,7 @@ void route_main(void)<br>
if (!*toys.optargs) {<br>
if (!strcmp(TT.family, "inet")) display_routes(AF_INET);<br>
else if (!strcmp(TT.family, "inet6")) display_routes(AF_INET6);<br>
- else help_exit(0);<br>
+ else show_help(stdout, 1);<br>
} else {<br>
if (!strcmp(TT.family, "inet")) setroute(AF_INET, toys.optargs);<br>
else setroute(AF_INET6, toys.optargs);<br>
-- <br>
2.25.1<br>
<br>
</blockquote></div>