Macos fixes for route functions

This commit is contained in:
pokamest 2021-05-27 15:01:15 -07:00
parent 6c74f30d79
commit 34b97bdc24
2 changed files with 36 additions and 59 deletions

View file

@ -316,6 +316,7 @@ mainRouteIface(argc, argv)
break;
/* NOTREACHED */
}
close(s);
fflush(stdout);
return 0;
//usage(*argv);
@ -859,17 +860,17 @@ newroute(argc, argv)
if (*cmd == 'g')
return;
oerrno = errno;
(void) printf("%s %s %s", cmd, ishost? "host" : "net", dest);
if (*gateway) {
(void) printf(": gateway %s", gateway);
if (attempts > 1 && ret == 0 && af == AF_INET)
(void) printf(" (%s)", inet_ntoa(so_gate.sin.sin_addr));
}
if (ret == 0)
(void) printf("\n");
else {
(void)printf(": %s\n", route_strerror(oerrno));
}
// (void) printf("%s %s %s", cmd, ishost? "host" : "net", dest);
// if (*gateway) {
// (void) printf(": gateway %s", gateway);
// if (attempts > 1 && ret == 0 && af == AF_INET)
// (void) printf(" (%s)", inet_ntoa(so_gate.sin.sin_addr));
// }
// if (ret == 0)
// (void) printf("\n");
// else {
// (void)printf(": %s\n", route_strerror(oerrno));
// }
}
static void
@ -1252,7 +1253,6 @@ rtmsg(cmd, flags)
#define NEXTADDR(w, u) \
if (rtm_addrs & (w)) {\
l = ROUNDUP(u.sa.sa_len); bcopy((char *)&(u), cp, l); cp += l;\
if (verbose) sodump(&(u),"u");\
}
errno = 0;
@ -1603,24 +1603,6 @@ keyword(cp)
return kt->kt_i;
}
void
sodump(su, which)
register sup su;
char *which;
{
switch (su->sa.sa_family) {
case AF_LINK:
(void) printf("%s: link %s; ",
which, link_ntoa(&su->sdl));
break;
case AF_INET:
(void) printf("%s: inet %s; ",
which, inet_ntoa(su->sin.sin_addr));
break;
}
(void) fflush(stdout);
}
/* States*/
#define VIRGIN 0
#define GOTONE 1