Re: svn commit: r361790 - head/sbin/ifconfig

2020-06-05 Thread Shawn Webb
On Sat, Jun 06, 2020 at 03:20:57AM +0700, Eugene Grosbein wrote:
> 05.06.2020 4:45, Shawn Webb wrote:
> 
> >> Modified: head/sbin/ifconfig/ifconfig.8
> >> ==
> >> --- head/sbin/ifconfig/ifconfig.8  Thu Jun  4 14:15:39 2020
> >> (r361789)
> >> +++ head/sbin/ifconfig/ifconfig.8  Thu Jun  4 14:44:44 2020
> >> (r361790)
> > 
> > Hey Eugene,
> > 
> > Does the manpage need a date bump?
> 
> It was already bumped that day with previous commit by avg.
> Sorry for late reply.

No worries. I didn't catch the prior date bump. Thanks for the
clarification! :)

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

GPG Key ID:  0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc


signature.asc
Description: PGP signature


Re: svn commit: r361790 - head/sbin/ifconfig

2020-06-05 Thread Eugene Grosbein
05.06.2020 4:45, Shawn Webb wrote:

>> Modified: head/sbin/ifconfig/ifconfig.8
>> ==
>> --- head/sbin/ifconfig/ifconfig.8Thu Jun  4 14:15:39 2020
>> (r361789)
>> +++ head/sbin/ifconfig/ifconfig.8Thu Jun  4 14:44:44 2020
>> (r361790)
> 
> Hey Eugene,
> 
> Does the manpage need a date bump?

It was already bumped that day with previous commit by avg.
Sorry for late reply.


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r361790 - head/sbin/ifconfig

2020-06-04 Thread Shawn Webb
On Thu, Jun 04, 2020 at 02:44:45PM +, Eugene Grosbein wrote:
> Author: eugen
> Date: Thu Jun  4 14:44:44 2020
> New Revision: 361790
> URL: https://svnweb.freebsd.org/changeset/base/361790
> 
> Log:
>   ifconfig(8): make it possible to filter output by interface group.
>   
>   Now options -g/-G allow to select/unselect interfaces by groups
>   in the "ifconfig -a" output just like already existing -d/-u.
>   
>   Examples:
>   
>   to exclude loopback from the list: ifconfig -a -G lo
>   to show vlan interfaces only: ifconfig -a -g vlan
>   to show tap interfaces that are up: ifconfig -aug tap
>   
>   Arguments to -g/-G may be shell patterns and both may be specified.
>   Later options -g/-G override previous ones.
>   
>   MFC after:  2 weeks
>   Relnotes:   yes
>   Differential Revision:  https://reviews.freebsd.org/D25029
> 
> Modified:
>   head/sbin/ifconfig/ifconfig.8
>   head/sbin/ifconfig/ifconfig.c
> 
> Modified: head/sbin/ifconfig/ifconfig.8
> ==
> --- head/sbin/ifconfig/ifconfig.8 Thu Jun  4 14:15:39 2020
> (r361789)
> +++ head/sbin/ifconfig/ifconfig.8 Thu Jun  4 14:44:44 2020
> (r361790)

Hey Eugene,

Does the manpage need a date bump?

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

GPG Key ID:  0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc


signature.asc
Description: PGP signature


svn commit: r361790 - head/sbin/ifconfig

2020-06-04 Thread Eugene Grosbein
Author: eugen
Date: Thu Jun  4 14:44:44 2020
New Revision: 361790
URL: https://svnweb.freebsd.org/changeset/base/361790

Log:
  ifconfig(8): make it possible to filter output by interface group.
  
  Now options -g/-G allow to select/unselect interfaces by groups
  in the "ifconfig -a" output just like already existing -d/-u.
  
  Examples:
  
  to exclude loopback from the list: ifconfig -a -G lo
  to show vlan interfaces only: ifconfig -a -g vlan
  to show tap interfaces that are up: ifconfig -aug tap
  
  Arguments to -g/-G may be shell patterns and both may be specified.
  Later options -g/-G override previous ones.
  
  MFC after:2 weeks
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D25029

Modified:
  head/sbin/ifconfig/ifconfig.8
  head/sbin/ifconfig/ifconfig.c

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Thu Jun  4 14:15:39 2020
(r361789)
+++ head/sbin/ifconfig/ifconfig.8   Thu Jun  4 14:44:44 2020
(r361790)
@@ -56,6 +56,7 @@
 .Fl a
 .Op Fl L
 .Op Fl d
+.Op Fl [gG] Ar groupname
 .Op Fl m
 .Op Fl u
 .Op Fl v
@@ -2910,9 +2911,26 @@ This flag instructs
 to display information about all interfaces in the system.
 The
 .Fl d
-flag limits this to interfaces that are down, and
+flag limits this to interfaces that are down,
 .Fl u
-limits this to interfaces that are up.
+limits this to interfaces that are up,
+limits this to interfaces that are up,
+.Fl g
+limits this to members of the specified group of interfaces, and
+.Fl G
+excludes members of the specified group from the list.
+Both
+.Fl g
+and
+.Fl G
+flags may be specified to apply both conditions.
+Only one option
+.Fl g
+should be specified as later override previous ones
+(same for
+.Fl G ) .
+.Sy groupname
+may contain shell patterns in which case it should be quoted.
 When no arguments are given,
 .Fl a
 is implied.
@@ -3036,6 +3054,9 @@ Display available wireless networks using
 .Pp
 Display inet and inet6 address subnet masks in CIDR notation
 .Dl # ifconfig -f inet:cidr,inet6:cidr
+.Pp
+Display interfaces that are up with the exception of loopback
+.Dl # ifconfig -a -u -G lo
 .Sh DIAGNOSTICS
 Messages indicating the specified interface does not exist, the
 requested address is unknown, or the user is not privileged and

Modified: head/sbin/ifconfig/ifconfig.c
==
--- head/sbin/ifconfig/ifconfig.c   Thu Jun  4 14:15:39 2020
(r361789)
+++ head/sbin/ifconfig/ifconfig.c   Thu Jun  4 14:44:44 2020
(r361790)
@@ -63,6 +63,7 @@ static const char rcsid[] =
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -105,6 +106,8 @@ int exit_code = 0;
 /* Formatter Strings */
 char   *f_inet, *f_inet6, *f_ether, *f_addr;
 
+static bool group_member(const char *ifname, const char *match,
+   const char *nomatch);
 static int ifconfig(int argc, char *const *argv, int iscreate,
const struct afswtch *afp);
 static void status(const struct afswtch *afp, const struct sockaddr_dl *sdl,
@@ -402,13 +405,14 @@ main(int argc, char *argv[])
char options[1024], *cp, *envformat, *namecp = NULL;
struct ifa_queue q = TAILQ_HEAD_INITIALIZER(q);
struct ifa_order_elt *cur, *tmp;
-   const char *ifname;
+   const char *ifname, *matchgroup, *nogroup;
struct option *p;
size_t iflen;
int flags;
 
all = downonly = uponly = namesonly = noload = verbose = 0;
f_inet = f_inet6 = f_ether = f_addr = NULL;
+   matchgroup = nogroup = NULL;
 
envformat = getenv("IFCONFIG_FORMAT");
if (envformat != NULL)
@@ -421,7 +425,7 @@ main(int argc, char *argv[])
atexit(printifnamemaybe);
 
/* Parse leading line options */
-   strlcpy(options, "f:adklmnuv", sizeof(options));
+   strlcpy(options, "G:adf:klmnuv", sizeof(options));
for (p = opts; p != NULL; p = p->next)
strlcat(options, p->opt, sizeof(options));
while ((c = getopt(argc, argv, options)) != -1) {
@@ -437,6 +441,11 @@ main(int argc, char *argv[])
usage();
setformat(optarg);
break;
+   case 'G':
+   if (optarg == NULL || all == 0)
+   usage();
+   nogroup = optarg;
+   break;
case 'k':
printkeys++;
break;
@@ -455,6 +464,14 @@ main(int argc, char *argv[])
case 'v':
verbose++;
break;
+   case 'g':
+   if (all) {
+   if (optarg == NULL)
+   usage();
+