Re: diff: add if group table to snmpd
The snmpd parts are OK with me but I don't think I'm qualified to OK adding the new ioctl myself. On 2018/05/18 11:08, Jan Klemkow wrote: > On Mon, May 14, 2018 at 09:21:13PM +0200, Jan Klemkow wrote: > > On Mon, May 14, 2018 at 06:53:20PM +0100, Stuart Henderson wrote: > > > On 2018/05/14 17:59, Jan Klemkow wrote: > > > > The following diff adds an interface group table to the OpenBSD MIBs and > > > > the OpenSNMPd. The new snmp table helps to keep track of the demote > > > > values of more complex carp setups. To iterate directly through all > > > > interface groups, the diff has to extent ioctl interface by a new > > > > command SIOCGIFGLIST. > > > > > > > > This new interface could also be used to extent ifconfig(8), in a later > > > > diff, to list all interface groups with there demote counter. > > > > > > > > I tested this diff with snmpctl(8) from base and snmpwalk from > > > > net/net-snmp under current amd64. > > > > > This seems a reasonable thing to report on and I didn't spot any code > > > problems yet, one thing with the MIB file though: > > > > > > Index: share/snmp/OPENBSD-CARP-MIB.txt > > > > === > > > > RCS file: /cvs//src/share/snmp/OPENBSD-CARP-MIB.txt,v > > > > retrieving revision 1.3 > > > > diff -u -p -r1.3 OPENBSD-CARP-MIB.txt > > > > --- share/snmp/OPENBSD-CARP-MIB.txt 28 Sep 2012 09:21:48 - > > > > 1.3 > > > > +++ share/snmp/OPENBSD-CARP-MIB.txt 14 May 2018 14:53:02 - > > > > @@ -41,7 +41,7 @@ carpMIBObjects MODULE-IDENTITY > > > > " > > > > DESCRIPTION "The MIB module for gathering information about > > > > Common Address Redundancy Protocol (CARP) interfaces." > > > > -REVISION "20120131Z" > > > > +REVISION "20180514Z" > > > > DESCRIPTION "Add the OPENBSD-CARP-MIB to snmpd." > > > > ::= { openBSD 6 } > > > > > > This section is meant to be a sort of changelog; please add a new > > > REVISION/DESCRIPTION rather than changing the existing one. (Also check > > > that smilint is happy). > > > > Thanks for the hint. I fixed the changelog and some other issues > > pointed by smilint. > > This is the merged version of the diff: > > Thanks, > Jan > > Index: share/snmp/OPENBSD-CARP-MIB.txt > === > RCS file: /cvs//src/share/snmp/OPENBSD-CARP-MIB.txt,v > retrieving revision 1.3 > diff -u -p -r1.3 OPENBSD-CARP-MIB.txt > --- share/snmp/OPENBSD-CARP-MIB.txt 28 Sep 2012 09:21:48 - 1.3 > +++ share/snmp/OPENBSD-CARP-MIB.txt 14 May 2018 18:58:59 - > @@ -32,7 +32,7 @@ IMPORTS > FROM SNMPv2-CONF; > > carpMIBObjects MODULE-IDENTITY > -LAST-UPDATED "20120131Z" > +LAST-UPDATED "20180514Z" > ORGANIZATION "OpenBSD" > CONTACT-INFO " >Author: Joel Knight > @@ -41,6 +41,8 @@ carpMIBObjects MODULE-IDENTITY > " > DESCRIPTION "The MIB module for gathering information about >Common Address Redundancy Protocol (CARP) interfaces." > +REVISION "20180514Z" > +DESCRIPTION "Add the carpGroupTable to OPENBSD-CARP-MIB." > REVISION "20120131Z" > DESCRIPTION "Add the OPENBSD-CARP-MIB to snmpd." > ::= { openBSD 6 } > @@ -174,6 +176,58 @@ carpIfState OBJECT-TYPE > DESCRIPTION > "Indicates the operational state of the CARP interface." > ::= { carpIfEntry 7 } > + > + > +-- carpGroup > + > +carpGroupTable OBJECT-TYPE > + SYNTAX SEQUENCE OF CarpGroupEntry > + MAX-ACCESS not-accessible > + STATUS current > + DESCRIPTION > + "A list of interface groups." > + ::= { carpMIBObjects 4 } > + > +carpGroupEntry OBJECT-TYPE > + SYNTAX CarpGroupEntry > + MAX-ACCESS not-accessible > + STATUS current > + DESCRIPTION > + "An entry containing management information applicable to a > + particular interface group." > + INDEX { carpGroupIndex } > + ::= { carpGroupTable 1 } > + > +CarpGroupEntry ::= > + SEQUENCE { > + carpGroupIndex Integer32, > + carpGroupName OCTET STRING, > + carpGroupDemote Integer32 > + } > + > +carpGroupIndex OBJECT-TYPE > + SYNTAX Integer32 (1..2147483647) > + MAX-ACCESS not-accessible > + STATUS current > + DESCRIPTION > + "The demote value of the interface group." > + ::= { carpGroupEntry 1 } > + > +carpGroupName OBJECT-TYPE > + SYNTAX OCTET STRING > + MAX-ACCESS read-only > + STATUS current > + DESCRIPTION > + "The name of the interface group." > + ::= { carpGroupEntry 2 } > + > +carpGroupDemote OBJECT-TYPE > + SYNTAX Integer32 (1..2147483647) > + MAX-ACCESS read-only > + STATUS current > + DESCRIPTION > + "The demote v
Re: diff: add if group table to snmpd
On Mon, May 14, 2018 at 09:21:13PM +0200, Jan Klemkow wrote: > On Mon, May 14, 2018 at 06:53:20PM +0100, Stuart Henderson wrote: > > On 2018/05/14 17:59, Jan Klemkow wrote: > > > The following diff adds an interface group table to the OpenBSD MIBs and > > > the OpenSNMPd. The new snmp table helps to keep track of the demote > > > values of more complex carp setups. To iterate directly through all > > > interface groups, the diff has to extent ioctl interface by a new > > > command SIOCGIFGLIST. > > > > > > This new interface could also be used to extent ifconfig(8), in a later > > > diff, to list all interface groups with there demote counter. > > > > > > I tested this diff with snmpctl(8) from base and snmpwalk from > > > net/net-snmp under current amd64. > > > This seems a reasonable thing to report on and I didn't spot any code > > problems yet, one thing with the MIB file though: > > > > Index: share/snmp/OPENBSD-CARP-MIB.txt > > > === > > > RCS file: /cvs//src/share/snmp/OPENBSD-CARP-MIB.txt,v > > > retrieving revision 1.3 > > > diff -u -p -r1.3 OPENBSD-CARP-MIB.txt > > > --- share/snmp/OPENBSD-CARP-MIB.txt 28 Sep 2012 09:21:48 - > > > 1.3 > > > +++ share/snmp/OPENBSD-CARP-MIB.txt 14 May 2018 14:53:02 - > > > @@ -41,7 +41,7 @@ carpMIBObjects MODULE-IDENTITY > > > " > > > DESCRIPTION "The MIB module for gathering information about > > >Common Address Redundancy Protocol (CARP) interfaces." > > > -REVISION "20120131Z" > > > +REVISION "20180514Z" > > > DESCRIPTION "Add the OPENBSD-CARP-MIB to snmpd." > > > ::= { openBSD 6 } > > > > This section is meant to be a sort of changelog; please add a new > > REVISION/DESCRIPTION rather than changing the existing one. (Also check > > that smilint is happy). > > Thanks for the hint. I fixed the changelog and some other issues > pointed by smilint. This is the merged version of the diff: Thanks, Jan Index: share/snmp/OPENBSD-CARP-MIB.txt === RCS file: /cvs//src/share/snmp/OPENBSD-CARP-MIB.txt,v retrieving revision 1.3 diff -u -p -r1.3 OPENBSD-CARP-MIB.txt --- share/snmp/OPENBSD-CARP-MIB.txt 28 Sep 2012 09:21:48 - 1.3 +++ share/snmp/OPENBSD-CARP-MIB.txt 14 May 2018 18:58:59 - @@ -32,7 +32,7 @@ IMPORTS FROM SNMPv2-CONF; carpMIBObjects MODULE-IDENTITY -LAST-UPDATED "20120131Z" +LAST-UPDATED "20180514Z" ORGANIZATION "OpenBSD" CONTACT-INFO " Author: Joel Knight @@ -41,6 +41,8 @@ carpMIBObjects MODULE-IDENTITY " DESCRIPTION "The MIB module for gathering information about Common Address Redundancy Protocol (CARP) interfaces." +REVISION "20180514Z" +DESCRIPTION "Add the carpGroupTable to OPENBSD-CARP-MIB." REVISION "20120131Z" DESCRIPTION "Add the OPENBSD-CARP-MIB to snmpd." ::= { openBSD 6 } @@ -174,6 +176,58 @@ carpIfState OBJECT-TYPE DESCRIPTION "Indicates the operational state of the CARP interface." ::= { carpIfEntry 7 } + + +-- carpGroup + +carpGroupTable OBJECT-TYPE + SYNTAX SEQUENCE OF CarpGroupEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of interface groups." + ::= { carpMIBObjects 4 } + +carpGroupEntry OBJECT-TYPE + SYNTAX CarpGroupEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry containing management information applicable to a + particular interface group." + INDEX { carpGroupIndex } + ::= { carpGroupTable 1 } + +CarpGroupEntry ::= + SEQUENCE { + carpGroupIndex Integer32, + carpGroupName OCTET STRING, + carpGroupDemote Integer32 + } + +carpGroupIndex OBJECT-TYPE + SYNTAX Integer32 (1..2147483647) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The demote value of the interface group." + ::= { carpGroupEntry 1 } + +carpGroupName OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The name of the interface group." + ::= { carpGroupEntry 2 } + +carpGroupDemote OBJECT-TYPE + SYNTAX Integer32 (1..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The demote value of the interface group." + ::= { carpGroupEntry 3 } -- carpStats Index: sys/net/if.c === RCS file: /cvs//src/sys/net/if.c,v retrieving revision 1.552 diff -u -p -r1.552 if.c --- sys/net/if.c17 May 2018 11:04:14 -
Re: diff: add if group table to snmpd
Hi Stuart, On Mon, May 14, 2018 at 06:53:20PM +0100, Stuart Henderson wrote: > On 2018/05/14 17:59, Jan Klemkow wrote: > > The following diff adds an interface group table to the OpenBSD MIBs and > > the OpenSNMPd. The new snmp table helps to keep track of the demote > > values of more complex carp setups. To iterate directly through all > > interface groups, the diff has to extent ioctl interface by a new > > command SIOCGIFGLIST. > > > > This new interface could also be used to extent ifconfig(8), in a later > > diff, to list all interface groups with there demote counter. > > > > I tested this diff with snmpctl(8) from base and snmpwalk from > > net/net-snmp under current amd64. > This seems a reasonable thing to report on and I didn't spot any code > problems yet, one thing with the MIB file though: > > Index: share/snmp/OPENBSD-CARP-MIB.txt > > === > > RCS file: /cvs//src/share/snmp/OPENBSD-CARP-MIB.txt,v > > retrieving revision 1.3 > > diff -u -p -r1.3 OPENBSD-CARP-MIB.txt > > --- share/snmp/OPENBSD-CARP-MIB.txt 28 Sep 2012 09:21:48 - 1.3 > > +++ share/snmp/OPENBSD-CARP-MIB.txt 14 May 2018 14:53:02 - > > @@ -41,7 +41,7 @@ carpMIBObjects MODULE-IDENTITY > > " > > DESCRIPTION "The MIB module for gathering information about > > Common Address Redundancy Protocol (CARP) interfaces." > > -REVISION "20120131Z" > > +REVISION "20180514Z" > > DESCRIPTION "Add the OPENBSD-CARP-MIB to snmpd." > > ::= { openBSD 6 } > > This section is meant to be a sort of changelog; please add a new > REVISION/DESCRIPTION rather than changing the existing one. (Also check > that smilint is happy). Thanks for the hint. I fixed the changelog and some other issues pointed by smilint. Thanks, Jan Index: share/snmp/OPENBSD-CARP-MIB.txt === RCS file: /cvs//src/share/snmp/OPENBSD-CARP-MIB.txt,v retrieving revision 1.3 diff -u -p -r1.3 OPENBSD-CARP-MIB.txt --- share/snmp/OPENBSD-CARP-MIB.txt 28 Sep 2012 09:21:48 - 1.3 +++ share/snmp/OPENBSD-CARP-MIB.txt 14 May 2018 18:58:59 - @@ -32,7 +32,7 @@ IMPORTS FROM SNMPv2-CONF; carpMIBObjects MODULE-IDENTITY -LAST-UPDATED "20120131Z" +LAST-UPDATED "20180514Z" ORGANIZATION "OpenBSD" CONTACT-INFO " Author: Joel Knight @@ -41,6 +41,8 @@ carpMIBObjects MODULE-IDENTITY " DESCRIPTION "The MIB module for gathering information about Common Address Redundancy Protocol (CARP) interfaces." +REVISION "20180514Z" +DESCRIPTION "Add the carpGroupTable to OPENBSD-CARP-MIB." REVISION "20120131Z" DESCRIPTION "Add the OPENBSD-CARP-MIB to snmpd." ::= { openBSD 6 } @@ -174,6 +176,58 @@ carpIfState OBJECT-TYPE DESCRIPTION "Indicates the operational state of the CARP interface." ::= { carpIfEntry 7 } + + +-- carpGroup + +carpGroupTable OBJECT-TYPE + SYNTAX SEQUENCE OF CarpGroupEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of interface groups." + ::= { carpMIBObjects 4 } + +carpGroupEntry OBJECT-TYPE + SYNTAX CarpGroupEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry containing management information applicable to a + particular interface group." + INDEX { carpGroupIndex } + ::= { carpGroupTable 1 } + +CarpGroupEntry ::= + SEQUENCE { + carpGroupIndex Integer32, + carpGroupName OCTET STRING, + carpGroupDemote Integer32 + } + +carpGroupIndex OBJECT-TYPE + SYNTAX Integer32 (1..2147483647) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The demote value of the interface group." + ::= { carpGroupEntry 1 } + +carpGroupName OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The name of the interface group." + ::= { carpGroupEntry 2 } + +carpGroupDemote OBJECT-TYPE + SYNTAX Integer32 (1..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The demote value of the interface group." + ::= { carpGroupEntry 3 } -- carpStats Index: sys/net/if.c === RCS file: /cvs//src/sys/net/if.c,v retrieving revision 1.551 diff -u -p -r1.551 if.c --- sys/net/if.c28 Apr 2018 15:44:59 - 1.551 +++ sys/net/if.c9 May 2018 08:16:33 - @@ -145,6 +145,7 @@ int if_getgroup(caddr_t, struct ifnet *) intif_getgroupmembers(caddr_t); intif_getgroupattribs(cadd
Re: diff: add if group table to snmpd
On 2018/05/14 17:59, Jan Klemkow wrote: > Hi, > > The following diff adds an interface group table to the OpenBSD MIBs and > the OpenSNMPd. The new snmp table helps to keep track of the demote > values of more complex carp setups. To iterate directly through all > interface groups, the diff has to extent ioctl interface by a new > command SIOCGIFGLIST. > > This new interface could also be used to extent ifconfig(8), in a later > diff, to list all interface groups with there demote counter. > > I tested this diff with snmpctl(8) from base and snmpwalk from > net/net-snmp under current amd64. > > Bye, > Jan This seems a reasonable thing to report on and I didn't spot any code problems yet, one thing with the MIB file though: > Index: share/snmp/OPENBSD-CARP-MIB.txt > === > RCS file: /cvs//src/share/snmp/OPENBSD-CARP-MIB.txt,v > retrieving revision 1.3 > diff -u -p -r1.3 OPENBSD-CARP-MIB.txt > --- share/snmp/OPENBSD-CARP-MIB.txt 28 Sep 2012 09:21:48 - 1.3 > +++ share/snmp/OPENBSD-CARP-MIB.txt 14 May 2018 14:53:02 - > @@ -32,7 +32,7 @@ IMPORTS > FROM SNMPv2-CONF; > > carpMIBObjects MODULE-IDENTITY > -LAST-UPDATED "20120131Z" > +LAST-UPDATED "20180514Z" > ORGANIZATION "OpenBSD" > CONTACT-INFO " >Author: Joel Knight > @@ -41,7 +41,7 @@ carpMIBObjects MODULE-IDENTITY > " > DESCRIPTION "The MIB module for gathering information about >Common Address Redundancy Protocol (CARP) interfaces." > -REVISION "20120131Z" > +REVISION "20180514Z" > DESCRIPTION "Add the OPENBSD-CARP-MIB to snmpd." > ::= { openBSD 6 } This section is meant to be a sort of changelog; please add a new REVISION/DESCRIPTION rather than changing the existing one. (Also check that smilint is happy). > > @@ -51,6 +51,7 @@ carpMIBObjects MODULE-IDENTITY > carpSysctl OBJECT IDENTIFIER ::= { carpMIBObjects 1 } > carpIf OBJECT IDENTIFIER ::= { carpMIBObjects > 2 } > carpStatsOBJECT IDENTIFIER ::= { carpMIBObjects 3 } > +carpGroupTable OBJECT IDENTIFIER ::= { carpMIBObjects > 4 } > > > -- carpSysctl > @@ -174,6 +175,49 @@ carpIfState OBJECT-TYPE > DESCRIPTION > "Indicates the operational state of the CARP interface." > ::= { carpIfEntry 7 } > + > + > +-- carpGroup > + > +carpGroupTable OBJECT-TYPE > + SYNTAX SEQUENCE OF CarpGroupEntry > + MAX-ACCESS not-accessible > + STATUS current > + DESCRIPTION > + "A list of interface groups." > + ::= { carpMIBObjects 4 } > + > +carpGroupEntry OBJECT-TYPE > + SYNTAX CarpGroupEntry > + MAX-ACCESS not-accessible > + STATUS current > + DESCRIPTION > + "An entry containing management information applicable to a > + particular interface group." > + INDEX { carpGroupIndex } > + ::= { carpGroupTable 1 } > + > +CarpGroupEntry ::= > + SEQUENCE { > + carpGroupName OCTET STRING, > + carpGroupDemote Integer32 > + } > + > +carpGroupName OBJECT-TYPE > + SYNTAX OCTET STRING > + MAX-ACCESS read-only > + STATUS current > + DESCRIPTION > + "The name of the interface group." > + ::= { carpIfEntry 1 } > + > +carpGroupDemote OBJECT-TYPE > + SYNTAX Integer32 (1..2147483647) > + MAX-ACCESS read-only > + STATUS current > + DESCRIPTION > + "The demote value of the interface group." > + ::= { carpIfEntry 2 } > > > -- carpStats > Index: sys/net/if.c > === > RCS file: /cvs//src/sys/net/if.c,v > retrieving revision 1.551 > diff -u -p -r1.551 if.c > --- sys/net/if.c 28 Apr 2018 15:44:59 - 1.551 > +++ sys/net/if.c 9 May 2018 08:16:33 - > @@ -145,6 +145,7 @@ int if_getgroup(caddr_t, struct ifnet *) > int if_getgroupmembers(caddr_t); > int if_getgroupattribs(caddr_t); > int if_setgroupattribs(caddr_t); > +int if_getgrouplist(caddr_t); > > void if_linkstate(struct ifnet *); > void if_linkstate_task(void *); > @@ -1838,6 +1839,7 @@ ifioctl(struct socket *so, u_long cmd, c > case SIOCIFGCLONERS: > case SIOCGIFGMEMB: > case SIOCGIFGATTR: > + case SIOCGIFGLIST: > case SIOCGIFFLAGS: > case SIOCGIFXFLAGS: > case SIOCGIFMETRIC: > @@ -2178,6 +2180,11 @@ ifioctl_get(u_long cmd, caddr_t data) > error = if_getgroupattribs(data); > NET_RUNLOCK(); > return (error); > + case SIOCGIFGLIST: > + NET_RLOCK(); > + error = if_getgrouplist(data); > + NET_RUNLOCK(); > + return (error); > } > > ifp = ifunit(ifr->ifr_name); > @@ -2609,6 +2616,41
diff: add if group table to snmpd
Hi, The following diff adds an interface group table to the OpenBSD MIBs and the OpenSNMPd. The new snmp table helps to keep track of the demote values of more complex carp setups. To iterate directly through all interface groups, the diff has to extent ioctl interface by a new command SIOCGIFGLIST. This new interface could also be used to extent ifconfig(8), in a later diff, to list all interface groups with there demote counter. I tested this diff with snmpctl(8) from base and snmpwalk from net/net-snmp under current amd64. Bye, Jan Index: share/snmp/OPENBSD-CARP-MIB.txt === RCS file: /cvs//src/share/snmp/OPENBSD-CARP-MIB.txt,v retrieving revision 1.3 diff -u -p -r1.3 OPENBSD-CARP-MIB.txt --- share/snmp/OPENBSD-CARP-MIB.txt 28 Sep 2012 09:21:48 - 1.3 +++ share/snmp/OPENBSD-CARP-MIB.txt 14 May 2018 14:53:02 - @@ -32,7 +32,7 @@ IMPORTS FROM SNMPv2-CONF; carpMIBObjects MODULE-IDENTITY -LAST-UPDATED "20120131Z" +LAST-UPDATED "20180514Z" ORGANIZATION "OpenBSD" CONTACT-INFO " Author: Joel Knight @@ -41,7 +41,7 @@ carpMIBObjects MODULE-IDENTITY " DESCRIPTION "The MIB module for gathering information about Common Address Redundancy Protocol (CARP) interfaces." -REVISION "20120131Z" +REVISION "20180514Z" DESCRIPTION "Add the OPENBSD-CARP-MIB to snmpd." ::= { openBSD 6 } @@ -51,6 +51,7 @@ carpMIBObjects MODULE-IDENTITY carpSysctl OBJECT IDENTIFIER ::= { carpMIBObjects 1 } carpIf OBJECT IDENTIFIER ::= { carpMIBObjects 2 } carpStats OBJECT IDENTIFIER ::= { carpMIBObjects 3 } +carpGroupTable OBJECT IDENTIFIER ::= { carpMIBObjects 4 } -- carpSysctl @@ -174,6 +175,49 @@ carpIfState OBJECT-TYPE DESCRIPTION "Indicates the operational state of the CARP interface." ::= { carpIfEntry 7 } + + +-- carpGroup + +carpGroupTable OBJECT-TYPE + SYNTAX SEQUENCE OF CarpGroupEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A list of interface groups." + ::= { carpMIBObjects 4 } + +carpGroupEntry OBJECT-TYPE + SYNTAX CarpGroupEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry containing management information applicable to a + particular interface group." + INDEX { carpGroupIndex } + ::= { carpGroupTable 1 } + +CarpGroupEntry ::= + SEQUENCE { + carpGroupName OCTET STRING, + carpGroupDemote Integer32 + } + +carpGroupName OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The name of the interface group." + ::= { carpIfEntry 1 } + +carpGroupDemote OBJECT-TYPE + SYNTAX Integer32 (1..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The demote value of the interface group." + ::= { carpIfEntry 2 } -- carpStats Index: sys/net/if.c === RCS file: /cvs//src/sys/net/if.c,v retrieving revision 1.551 diff -u -p -r1.551 if.c --- sys/net/if.c28 Apr 2018 15:44:59 - 1.551 +++ sys/net/if.c9 May 2018 08:16:33 - @@ -145,6 +145,7 @@ int if_getgroup(caddr_t, struct ifnet *) intif_getgroupmembers(caddr_t); intif_getgroupattribs(caddr_t); intif_setgroupattribs(caddr_t); +intif_getgrouplist(caddr_t); void if_linkstate(struct ifnet *); void if_linkstate_task(void *); @@ -1838,6 +1839,7 @@ ifioctl(struct socket *so, u_long cmd, c case SIOCIFGCLONERS: case SIOCGIFGMEMB: case SIOCGIFGATTR: + case SIOCGIFGLIST: case SIOCGIFFLAGS: case SIOCGIFXFLAGS: case SIOCGIFMETRIC: @@ -2178,6 +2180,11 @@ ifioctl_get(u_long cmd, caddr_t data) error = if_getgroupattribs(data); NET_RUNLOCK(); return (error); + case SIOCGIFGLIST: + NET_RLOCK(); + error = if_getgrouplist(data); + NET_RUNLOCK(); + return (error); } ifp = ifunit(ifr->ifr_name); @@ -2609,6 +2616,41 @@ if_setgroupattribs(caddr_t data) TAILQ_FOREACH(ifgm, &ifg->ifg_members, ifgm_next) ifgm->ifgm_ifp->if_ioctl(ifgm->ifgm_ifp, SIOCSIFGATTR, data); + + return (0); +} + +/* + * Stores all groups in memory pointed to by data + */ +int +if_getgrouplist(caddr_t data) +{ + struct ifgroupreq *ifgr = (struct ifgroupreq *)data; + struct ifg_group*ifg; + struct ifg_req ifgrq, *ifgp; + int len,