Index: sbin/ifconfig/af_inet.c =================================================================== RCS file: /home/ncvs/src/sbin/ifconfig/af_inet.c,v retrieving revision 1.5.2.2.2.1 diff -u -r1.5.2.2.2.1 af_inet.c --- sbin/ifconfig/af_inet.c 21 Dec 2010 17:09:25 -0000 1.5.2.2.2.1 +++ sbin/ifconfig/af_inet.c 11 Apr 2011 12:03:32 -0000 @@ -79,7 +79,10 @@ sin = (struct sockaddr_in *)ifa->ifa_netmask; if (sin == NULL) sin = &null_sin; - printf("netmask 0x%lx ", (unsigned long)ntohl(sin->sin_addr.s_addr)); + if (dotmask) + printf("netmask %s ", inet_ntoa(sin->sin_addr)); + else + printf("netmask 0x%lx ", (unsigned long)ntohl(sin->sin_addr.s_addr)); if (ifa->ifa_flags & IFF_BROADCAST) { sin = (struct sockaddr_in *)ifa->ifa_broadaddr; Index: sbin/ifconfig/ifconfig.8 =================================================================== RCS file: /home/ncvs/src/sbin/ifconfig/ifconfig.8,v retrieving revision 1.159.2.6.4.1 diff -u -r1.159.2.6.4.1 ifconfig.8 --- sbin/ifconfig/ifconfig.8 21 Dec 2010 17:09:25 -0000 1.159.2.6.4.1 +++ sbin/ifconfig/ifconfig.8 11 Apr 2011 12:03:32 -0000 @@ -40,6 +40,7 @@ .Op Fl k .Op Fl m .Op Fl n +.Op Fl t .Ar interface .Op Cm create .Op Ar address_family @@ -56,6 +57,7 @@ .Op Fl L .Op Fl d .Op Fl m +.Op Fl t .Op Fl u .Op Fl v .Op Ar address_family @@ -69,6 +71,7 @@ .Op Fl d .Op Fl k .Op Fl m +.Op Fl t .Op Fl u .Op Fl v .Op Fl C @@ -2400,6 +2403,9 @@ .Fl L flag is supplied, address lifetime is displayed for IPv6 addresses, as time offset string. +The +.Fl t +flag makes IPv4 netmasks being displayed in dotted decimal notation. .Pp Optionally, the .Fl a Index: sbin/ifconfig/ifconfig.c =================================================================== RCS file: /home/ncvs/src/sbin/ifconfig/ifconfig.c,v retrieving revision 1.146.2.5.4.1 diff -u -r1.146.2.5.4.1 ifconfig.c --- sbin/ifconfig/ifconfig.c 21 Dec 2010 17:09:25 -0000 1.146.2.5.4.1 +++ sbin/ifconfig/ifconfig.c 11 Apr 2011 12:03:32 -0000 @@ -90,6 +90,7 @@ int clearaddr; int newaddr = 1; int verbose; +int dotmask; int noload; int supmedia = 0; @@ -132,9 +133,9 @@ "usage: ifconfig %sinterface address_family [address [dest_address]]\n" " [parameters]\n" " ifconfig interface create\n" - " ifconfig -a %s[-d] [-m] [-u] [-v] [address_family]\n" + " ifconfig -a %s[-d] [-m] [-t] [-u] [-v] [address_family]\n" " ifconfig -l [-d] [-u] [address_family]\n" - " ifconfig %s[-d] [-m] [-u] [-v]\n", + " ifconfig %s[-d] [-m] [-t] [-u] [-v]\n", options, options, options); exit(1); } @@ -156,7 +157,7 @@ all = downonly = uponly = namesonly = noload = verbose = 0; /* Parse leading line options */ - strlcpy(options, "adklmnuv", sizeof(options)); + strlcpy(options, "adklmntuv", sizeof(options)); for (p = opts; p != NULL; p = p->next) strlcat(options, p->opt, sizeof(options)); while ((c = getopt(argc, argv, options)) != -1) { @@ -179,6 +180,9 @@ case 'n': /* suppress module loading */ noload++; break; + case 't': /* show IPv4 netmask in dotted decimal notation */ + dotmask++; + break; case 'u': /* restrict scan to "up" interfaces */ uponly++; break; @@ -199,8 +203,8 @@ argc -= optind; argv += optind; - /* -l cannot be used with -a or -m */ - if (namesonly && (all || supmedia)) + /* -l cannot be used with -a, -m or -t */ + if (namesonly && (all || supmedia || dotmask)) usage(); /* nonsense.. */ Index: sbin/ifconfig/ifconfig.h =================================================================== RCS file: /home/ncvs/src/sbin/ifconfig/ifconfig.h,v retrieving revision 1.24.2.1.6.1 diff -u -r1.24.2.1.6.1 ifconfig.h --- sbin/ifconfig/ifconfig.h 21 Dec 2010 17:09:25 -0000 1.24.2.1.6.1 +++ sbin/ifconfig/ifconfig.h 11 Apr 2011 12:03:33 -0000 @@ -132,6 +132,7 @@ extern int printkeys; extern int newaddr; extern int verbose; +extern int dotmask; void setifcap(const char *, int value, int s, const struct afswtch *);