svn commit: r253236 - stable/9/sbin/route
Hiroki Sato
hrs at FreeBSD.org
Fri Jul 12 01:27:12 UTC 2013
Author: hrs
Date: Fri Jul 12 01:27:11 2013
New Revision: 253236
URL: http://svnweb.freebsd.org/changeset/base/253236
Log:
MFC 245168:
Fix -iface and -interface modifiers.
Modified:
stable/9/sbin/route/route.c
Directory Properties:
stable/9/sbin/route/ (props changed)
Modified: stable/9/sbin/route/route.c
==============================================================================
--- stable/9/sbin/route/route.c Fri Jul 12 01:25:24 2013 (r253235)
+++ stable/9/sbin/route/route.c Fri Jul 12 01:27:11 2013 (r253236)
@@ -94,7 +94,7 @@ typedef union sockunion *sup;
int pid, rtm_addrs;
int s;
int forcehost, forcenet, doflush, nflag, af, qflag, tflag;
-int iflag, verbose, aflen = sizeof (struct sockaddr_in);
+int verbose, aflen = sizeof (struct sockaddr_in);
int locking, lockrest, debugonly;
struct rt_metrics rt_metrics;
u_long rtm_inits;
@@ -107,7 +107,7 @@ static char *atalk_ntoa(struct at_addr);
static void bprintf(FILE *, int, u_char *);
static void flushroutes(int argc, char *argv[]);
static int flushroutes_fib(int);
-static int getaddr(int, char *, struct hostent **);
+static int getaddr(int, char *, struct hostent **, int);
static int keyword(const char *);
static void inet_makenetandmask(u_long, struct sockaddr_in *, u_long);
#ifdef INET6
@@ -879,34 +879,34 @@ newroute(int argc, char **argv)
case K_IFA:
if (!--argc)
usage(NULL);
- (void) getaddr(RTA_IFA, *++argv, 0);
+ getaddr(RTA_IFA, *++argv, 0, nrflags);
break;
case K_IFP:
if (!--argc)
usage(NULL);
- (void) getaddr(RTA_IFP, *++argv, 0);
+ getaddr(RTA_IFP, *++argv, 0, nrflags);
break;
case K_GENMASK:
if (!--argc)
usage(NULL);
- (void) getaddr(RTA_GENMASK, *++argv, 0);
+ getaddr(RTA_GENMASK, *++argv, 0, nrflags);
break;
case K_GATEWAY:
if (!--argc)
usage(NULL);
- (void) getaddr(RTA_GATEWAY, *++argv, 0);
+ getaddr(RTA_GATEWAY, *++argv, 0, nrflags);
break;
case K_DST:
if (!--argc)
usage(NULL);
- if (getaddr(RTA_DST, *++argv, &hp))
+ if (getaddr(RTA_DST, *++argv, &hp, nrflags))
nrflags |= F_ISHOST;
dest = *argv;
break;
case K_NETMASK:
if (!--argc)
usage(NULL);
- (void) getaddr(RTA_NETMASK, *++argv, 0);
+ getaddr(RTA_NETMASK, *++argv, 0, nrflags);
/* FALLTHROUGH */
case K_NET:
nrflags |= F_FORCENET;
@@ -941,13 +941,13 @@ newroute(int argc, char **argv)
} else {
if ((rtm_addrs & RTA_DST) == 0) {
dest = *argv;
- if (getaddr(RTA_DST, *argv, &hp))
+ if (getaddr(RTA_DST, *argv, &hp, nrflags))
nrflags |= F_ISHOST;
} else if ((rtm_addrs & RTA_GATEWAY) == 0) {
gateway = *argv;
- (void) getaddr(RTA_GATEWAY, *argv, &hp);
+ getaddr(RTA_GATEWAY, *argv, &hp, nrflags);
} else {
- (void) getaddr(RTA_NETMASK, *argv, 0);
+ getaddr(RTA_NETMASK, *argv, 0, nrflags);
nrflags |= F_FORCENET;
}
}
@@ -1166,7 +1166,7 @@ inet6_makenetandmask(struct sockaddr_in6
* returning 1 if a host address, 0 if a network address.
*/
static int
-getaddr(int which, char *str, struct hostent **hpp)
+getaddr(int which, char *str, struct hostent **hpp, int nrflags)
{
sup su;
struct hostent *hp;
@@ -1187,7 +1187,7 @@ getaddr(int which, char *str, struct hos
break;
case RTA_GATEWAY:
su = &so_gate;
- if (iflag) {
+ if (nrflags & F_INTERFACE) {
struct ifaddrs *ifap, *ifa;
struct sockaddr_dl *sdl = NULL;
@@ -1247,7 +1247,7 @@ getaddr(int which, char *str, struct hos
#if 0
bzero(su, sizeof(*su)); /* for readability */
#endif
- getaddr(RTA_NETMASK, str, 0);
+ getaddr(RTA_NETMASK, str, 0, nrflags);
break;
#if 0
case RTA_NETMASK:
More information about the svn-src-stable-9
mailing list