uncruft device.h and subr_autoconf.c a bit
this removes the idea of multiple cfdata tables. code for it was introduced for some reason for some hotplug stuff 17 years ago, if 0'd 14 years ago, and removed 11 years ago. i dont think we need it. ok? Index: sys/device.h === RCS file: /cvs/src/sys/sys/device.h,v retrieving revision 1.45 diff -u -p -r1.45 device.h --- sys/device.h8 Oct 2012 21:47:51 - 1.45 +++ sys/device.h26 Nov 2013 11:06:40 - @@ -163,12 +163,6 @@ struct pdevinit { }; #ifdef _KERNEL -struct cftable { - struct cfdata *tab; - TAILQ_ENTRY(cftable) list; -}; -TAILQ_HEAD(cftable_head, cftable); - extern struct devicelist alldevs; /* list of all devices */ extern int autoconf_verbose; Index: kern/subr_autoconf.c === RCS file: /cvs/src/sys/kern/subr_autoconf.c,v retrieving revision 1.68 diff -u -p -r1.68 subr_autoconf.c --- kern/subr_autoconf.c30 May 2013 16:15:02 - 1.68 +++ kern/subr_autoconf.c26 Nov 2013 11:06:40 - @@ -74,12 +74,6 @@ struct matchinfo { int indirect, pri; }; -struct cftable_head allcftables; - -static struct cftable staticcftable = { - cfdata -}; - #ifndef AUTOCONF_VERBOSE #define AUTOCONF_VERBOSE 0 #endif /* AUTOCONF_VERBOSE */ @@ -119,8 +113,6 @@ config_init(void) { TAILQ_INIT(deferred_config_queue); TAILQ_INIT(alldevs); - TAILQ_INIT(allcftables); - TAILQ_INSERT_TAIL(allcftables, staticcftable, list); } /* @@ -186,7 +178,6 @@ config_search(cfmatch_t fn, struct devic struct cfdata *cf; short *p; struct matchinfo m; - struct cftable *t; m.fn = fn; m.parent = parent; @@ -194,23 +185,23 @@ config_search(cfmatch_t fn, struct devic m.aux = aux; m.indirect = parent parent-dv_cfdata-cf_driver-cd_indirect; m.pri = 0; - TAILQ_FOREACH(t, allcftables, list) { - for (cf = t-tab; cf-cf_driver; cf++) { - /* -* Skip cf if no longer eligible, otherwise scan -* through parents for one matching `parent', -* and try match function. -*/ - if (cf-cf_fstate == FSTATE_FOUND) - continue; - if (cf-cf_fstate == FSTATE_DNOTFOUND || - cf-cf_fstate == FSTATE_DSTAR) - continue; - for (p = cf-cf_parents; *p = 0; p++) - if (parent-dv_cfdata == (t-tab)[*p]) - mapply(m, cf); - } + + for (cf = cfdata; cf-cf_driver; cf++) { + /* +* Skip cf if no longer eligible, otherwise scan +* through parents for one matching `parent', +* and try match function. +*/ + if (cf-cf_fstate == FSTATE_FOUND) + continue; + if (cf-cf_fstate == FSTATE_DNOTFOUND || + cf-cf_fstate == FSTATE_DSTAR) + continue; + for (p = cf-cf_parents; *p = 0; p++) + if (parent-dv_cfdata == cfdata[*p]) + mapply(m, cf); } + if (autoconf_verbose) { if (m.match) { if (m.indirect) @@ -240,29 +231,27 @@ config_scan(cfscan_t fn, struct device * short *p; void *match; int indirect; - struct cftable *t; indirect = parent parent-dv_cfdata-cf_driver-cd_indirect; - TAILQ_FOREACH(t, allcftables, list) { - for (cf = t-tab; cf-cf_driver; cf++) { - /* -* Skip cf if no longer eligible, otherwise scan -* through parents for one matching `parent', -* and try match function. -*/ - if (cf-cf_fstate == FSTATE_FOUND) - continue; - if (cf-cf_fstate == FSTATE_DNOTFOUND || - cf-cf_fstate == FSTATE_DSTAR) - continue; - for (p = cf-cf_parents; *p = 0; p++) - if (parent-dv_cfdata == (t-tab)[*p]) { - match = indirect? - config_make_softc(parent, cf) : - (void *)cf; - (*fn)(parent, match); - } - } + + for (cf = cfdata; cf-cf_driver; cf++) { + /* +* Skip cf if no longer eligible, otherwise scan +* through parents for one matching
rdomain - rtableid confusion
These two functions take a rtableid not a rdomain as an argument, simple renaming to avoid confusion. ok? Index: net/if.c === RCS file: /home/ncvs/src/sys/net/if.c,v retrieving revision 1.277 diff -u -p -r1.277 if.c --- net/if.c19 Nov 2013 09:00:43 - 1.277 +++ net/if.c26 Nov 2013 11:34:35 - @@ -853,18 +853,18 @@ if_congestion_clear(void *arg) */ /*ARGSUSED*/ struct ifaddr * -ifa_ifwithaddr(struct sockaddr *addr, u_int rdomain) +ifa_ifwithaddr(struct sockaddr *addr, u_int rtableid) { struct ifaddr_item *ifai, key; bzero(key, sizeof(key)); key.ifai_addr = addr; - key.ifai_rdomain = rtable_l2(rdomain); + key.ifai_rdomain = rtable_l2(rtableid); ifai = RB_FIND(ifaddr_items, ifaddr_items, key); if (ifai) return (ifai-ifai_ifa); - return (NULL); + return (NULL); } #defineequal(a1, a2) \ Index: netinet/ip_input.c === RCS file: /home/ncvs/src/sys/netinet/ip_input.c,v retrieving revision 1.221 diff -u -p -r1.221 ip_input.c --- netinet/ip_input.c 17 Nov 2013 10:07:32 - 1.221 +++ netinet/ip_input.c 26 Nov 2013 11:34:35 - @@ -725,7 +725,7 @@ in_ouraddr(struct in_addr ina, struct mb } struct in_ifaddr * -in_iawithaddr(struct in_addr ina, u_int rdomain) +in_iawithaddr(struct in_addr ina, u_int rtableid) { struct in_ifaddr*ia; struct sockaddr_in sin; @@ -734,7 +734,7 @@ in_iawithaddr(struct in_addr ina, u_int sin.sin_len = sizeof(sin); sin.sin_family = AF_INET; sin.sin_addr = ina; - ia = ifatoia(ifa_ifwithaddr(sintosa(sin), rdomain)); + ia = ifatoia(ifa_ifwithaddr(sintosa(sin), rtableid)); if (ia == NULL || ina.s_addr == ia-ia_addr.sin_addr.s_addr) return (ia);
No need for INADDR_TO_IFP(), less global IPv4 list usage
Diff below replaces the INADDR_TO_IFP() macro that iterates over the global list of IPv4 by a call to in_iawithaddr() that uses the global tree of addresses. Since these two structures are now always coherent it is safe to replace one by the other and this removes one more usage of the global list. Tested here with ping -I with a multicast address, ok? Index: netinet/ip_output.c === RCS file: /home/ncvs/src/sys/netinet/ip_output.c,v retrieving revision 1.250 diff -u -p -r1.250 ip_output.c --- netinet/ip_output.c 25 Oct 2013 18:44:36 - 1.250 +++ netinet/ip_output.c 26 Nov 2013 11:34:18 - @@ -1702,6 +1702,7 @@ ip_setmoptions(int optname, struct ip_mo u_char loop; int i; struct in_addr addr; + struct in_ifaddr *ia; struct ip_mreq *mreq; struct ifnet *ifp; struct ip_moptions *imo = *imop; @@ -1753,7 +1754,9 @@ ip_setmoptions(int optname, struct ip_mo * IP address. Find the interface and confirm that * it supports multicasting. */ - INADDR_TO_IFP(addr, ifp, rtableid); + ia = in_iawithaddr(addr, rtableid); + if (ia) + ifp = ia-ia_ifp; if (ifp == NULL || (ifp-if_flags IFF_MULTICAST) == 0) { error = EADDRNOTAVAIL; break; @@ -1820,7 +1823,9 @@ ip_setmoptions(int optname, struct ip_mo ifp = ro.ro_rt-rt_ifp; rtfree(ro.ro_rt); } else { - INADDR_TO_IFP(mreq-imr_interface, ifp, rtableid); + ia = in_iawithaddr(mreq-imr_interface, rtableid); + if (ia) + ifp = ia-ia_ifp; } /* * See if we found an interface, and confirm that it @@ -1906,11 +1911,12 @@ ip_setmoptions(int optname, struct ip_mo if (mreq-imr_interface.s_addr == INADDR_ANY) ifp = NULL; else { - INADDR_TO_IFP(mreq-imr_interface, ifp, rtableid); - if (ifp == NULL) { + ia = in_iawithaddr(mreq-imr_interface, rtableid); + if (ia == NULL) { error = EADDRNOTAVAIL; break; } + ifp = ia-ia_ifp; } /* * Find the membership in the membership array. Index: netinet/in_var.h === RCS file: /home/ncvs/src/sys/netinet/in_var.h,v retrieving revision 1.28 diff -u -p -r1.28 in_var.h --- netinet/in_var.h21 Nov 2013 16:34:33 - 1.28 +++ netinet/in_var.h26 Nov 2013 11:34:18 - @@ -82,23 +82,6 @@ TAILQ_HEAD(in_ifaddrhead, in_ifaddr); extern struct in_ifaddrhead in_ifaddr; /* - * Macro for finding the interface (ifnet structure) corresponding to one - * of our IP addresses. - */ -#define INADDR_TO_IFP(addr, ifp, rtableid) \ - /* struct in_addr addr; */ \ - /* struct ifnet *ifp; */\ -do { \ - struct in_ifaddr *ia; \ - \ - TAILQ_FOREACH(ia, in_ifaddr, ia_list) \ - if (ia-ia_ifp-if_rdomain == rtable_l2(rtableid) \ - ia-ia_addr.sin_addr.s_addr == (addr).s_addr) \ -break; \ - (ifp) = (ia == NULL) ? NULL : ia-ia_ifp; \ -} while (/* CONSTCOND */ 0) - -/* * Macro for finding the internet address structure (in_ifaddr) corresponding * to a given interface (ifnet structure). */
Re: rdomain - rtableid confusion
On 26 November 2013 12:38, Martin Pieuchot mpieuc...@nolizard.org wrote: These two functions take a rtableid not a rdomain as an argument, simple renaming to avoid confusion. ok? makes sense to me. OK mikeb
Re: No need for INADDR_TO_IFP(), less global IPv4 list usage
On 26 November 2013 12:44, Martin Pieuchot mpieuc...@nolizard.org wrote: Diff below replaces the INADDR_TO_IFP() macro that iterates over the global list of IPv4 by a call to in_iawithaddr() that uses the global tree of addresses. Since these two structures are now always coherent it is safe to replace one by the other and this removes one more usage of the global list. Tested here with ping -I with a multicast address, ok? sure. OK mikeb
Re: Don't link multicast records to the first address
On 22 November 2013 09:26, Martin Pieuchot mpieuc...@nolizard.org wrote: On 18/11/13(Mon) 11:43, Martin Pieuchot wrote: Diff below changes the way protocol multicast addresses are linked to an interface. Right now they are added to a list attached to the first protocol address of an interface. That makes this address descriptor and its position in the global list special. Plus in the IPv6 case, a special kludge is used to move multicast records from one address to another. So this diff reuse the design of the protocol agnostic struct ifaddr and adds a new list of multicast addresses, struct ifmaddr, to the interface descriptor. It solves the problems described previously and as a bonus properly free the IPv4 multicast records of an interface when it is detached, thus plugging some more leaks. I tested it with a carp setup, I appreciate any multicast related tests. Here's an updated diff after recent header changes. looks better, indeed. OK mikeb Did anybody tested it? Does it break one of your use cases? Comments?
mention dpb in release(8)
Is this OK, or should we remove bits about building packages individually too? Index: share/man/man8/release.8 === RCS file: /cvs/src/share/man/man8/release.8,v retrieving revision 1.66 diff -u -p -u -1 -5 -r1.66 release.8 --- share/man/man8/release.82 Sep 2012 13:47:25 - 1.66 +++ share/man/man8/release.826 Nov 2013 14:36:59 - @@ -338,25 +338,29 @@ The subsystem of contributed applications is described in .Xr ports 7 . For ease of installation ports can be pre-compiled into .Sq packages which can then be installed on multiple machines using .Xr pkg_add 1 . Packages are created by selecting an application to build (we'll call this one CATEGORY/PORT) and then running the following: as root: .Bd -literal -offset indent $ cd /usr/ports/CATEGORY/PORT $ su # make package .Ed .Pp -That's all there is to it. +To build a larger set of packages, +.Xr dpb 1 +has various facilities to manage the build, +either on a single machine or a cluster. .Sh SEE ALSO .Xr cvs 1 , +.Xr dpb 1 , .Xr pkg_add 1 , .Xr ports 7 , .Xr sudo 8 , .Xr sysmerge 8 .Sh HISTORY This document first appeared in .Ox 2.8 .
Re: mention dpb in release(8)
On Tue, Nov 26, 2013 at 02:38:43PM +, Stuart Henderson wrote: Is this OK, or should we remove bits about building packages individually too? I'd rather send people to ports(7) directly... since that explains both single port and bulk building. Index: share/man/man8/release.8 === RCS file: /cvs/src/share/man/man8/release.8,v retrieving revision 1.66 diff -u -p -u -1 -5 -r1.66 release.8 --- share/man/man8/release.8 2 Sep 2012 13:47:25 - 1.66 +++ share/man/man8/release.8 26 Nov 2013 14:36:59 - @@ -338,25 +338,29 @@ The subsystem of contributed applications is described in .Xr ports 7 . For ease of installation ports can be pre-compiled into .Sq packages which can then be installed on multiple machines using .Xr pkg_add 1 . Packages are created by selecting an application to build (we'll call this one CATEGORY/PORT) and then running the following: as root: .Bd -literal -offset indent $ cd /usr/ports/CATEGORY/PORT $ su # make package .Ed .Pp -That's all there is to it. +To build a larger set of packages, +.Xr dpb 1 +has various facilities to manage the build, +either on a single machine or a cluster. .Sh SEE ALSO .Xr cvs 1 , +.Xr dpb 1 , .Xr pkg_add 1 , .Xr ports 7 , .Xr sudo 8 , .Xr sysmerge 8 .Sh HISTORY This document first appeared in .Ox 2.8 .
Re: mention dpb in release(8)
On 2013/11/26 16:28, Marc Espie wrote: On Tue, Nov 26, 2013 at 02:38:43PM +, Stuart Henderson wrote: Is this OK, or should we remove bits about building packages individually too? I'd rather send people to ports(7) directly... since that explains both single port and bulk building. Something like this? Includes a bonus diff for ports(7), the mirror-maker target was removed. Index: man8/release.8 === RCS file: /cvs/src/share/man/man8/release.8,v retrieving revision 1.66 diff -u -p -r1.66 release.8 --- man8/release.8 2 Sep 2012 13:47:25 - 1.66 +++ man8/release.8 26 Nov 2013 15:37:29 - @@ -335,22 +335,11 @@ in your release directory. .Ss 7. Make the third party packages The .Sq ports -subsystem of contributed applications is described in -.Xr ports 7 . -For ease of installation ports can be pre-compiled into +subsystem of contributed applications is capable of producing .Sq packages -which can then be installed on multiple machines using -.Xr pkg_add 1 . -Packages are created by selecting an application to build -(we'll call this one CATEGORY/PORT) and then running the following: -as root: -.Bd -literal -offset indent -$ cd /usr/ports/CATEGORY/PORT -$ su -# make package -.Ed -.Pp -That's all there is to it. +for installation, either individually or in bulk. +This is described in +.Xr ports 7 . .Sh SEE ALSO .Xr cvs 1 , .Xr pkg_add 1 , Index: man7/ports.7 === RCS file: /cvs/src/share/man/man7/ports.7,v retrieving revision 1.96 diff -u -p -r1.96 ports.7 --- man7/ports.711 Nov 2013 21:14:29 - 1.96 +++ man7/ports.726 Nov 2013 15:37:29 - @@ -83,9 +83,6 @@ offers a few useful targets. .It Ar index rebuild the ports complete index, .Pa /usr/ports/INDEX -.It Ar mirror-maker -see -.Xr mirroring-ports 7 , .It Ar pkglocatedb build a .Xr pkg_mklocatedb 1 @@ -740,6 +737,7 @@ List of users and groups created by port .Xr pkg_info 1 , .Xr bsd.port.mk 5 , .Xr port-modules 5 , +.Xr mirroring-ports 7 , .Xr packages 7 .Pp The
Re: mention dpb in release(8)
On Tue, Nov 26, 2013 at 03:38:49PM +, Stuart Henderson wrote: On 2013/11/26 16:28, Marc Espie wrote: On Tue, Nov 26, 2013 at 02:38:43PM +, Stuart Henderson wrote: Is this OK, or should we remove bits about building packages individually too? I'd rather send people to ports(7) directly... since that explains both single port and bulk building. Something like this? Includes a bonus diff for ports(7), the mirror-maker target was removed. Index: man8/release.8 === RCS file: /cvs/src/share/man/man8/release.8,v retrieving revision 1.66 diff -u -p -r1.66 release.8 --- man8/release.82 Sep 2012 13:47:25 - 1.66 +++ man8/release.826 Nov 2013 15:37:29 - @@ -335,22 +335,11 @@ in your release directory. .Ss 7. Make the third party packages The .Sq ports -subsystem of contributed applications is described in -.Xr ports 7 . -For ease of installation ports can be pre-compiled into +subsystem of contributed applications is capable of producing .Sq packages -which can then be installed on multiple machines using -.Xr pkg_add 1 . -Packages are created by selecting an application to build -(we'll call this one CATEGORY/PORT) and then running the following: -as root: -.Bd -literal -offset indent -$ cd /usr/ports/CATEGORY/PORT -$ su -# make package -.Ed -.Pp -That's all there is to it. +for installation, either individually or in bulk. +This is described in +.Xr ports 7 . .Sh SEE ALSO .Xr cvs 1 , .Xr pkg_add 1 , Index: man7/ports.7 === RCS file: /cvs/src/share/man/man7/ports.7,v retrieving revision 1.96 diff -u -p -r1.96 ports.7 --- man7/ports.7 11 Nov 2013 21:14:29 - 1.96 +++ man7/ports.7 26 Nov 2013 15:37:29 - @@ -83,9 +83,6 @@ offers a few useful targets. .It Ar index rebuild the ports complete index, .Pa /usr/ports/INDEX -.It Ar mirror-maker -see -.Xr mirroring-ports 7 , .It Ar pkglocatedb build a .Xr pkg_mklocatedb 1 @@ -740,6 +737,7 @@ List of users and groups created by port .Xr pkg_info 1 , .Xr bsd.port.mk 5 , .Xr port-modules 5 , +.Xr mirroring-ports 7 , .Xr packages 7 .Pp The okay for me.
Re: new queue support for systat(1)
On Thu, Nov 21, 2013 at 12:35:43PM +0200, Arto Jonsson wrote: Hi, the following adds new queue support for systat(1). Both old and new queues are shown in the same display (newqs are shown first). Majority of the code taken from pfctl. For new queues the BW field only shows the target bandwidth (no burst info for example). ping
The OpenBSD Foundation now accepts BitCoin donations...
I'm happy to announce the OpenBSD foundation can now accept donations to assist in funding project activities in BTC. We are using BitPay.com to host our BitCoin donations, which are converted to CAD for use by the project. If you have been interested in making donations in BitCoin, please visit http://www.openbsdfoundation.org/donations.html, and visit the BitCoin donation link at the bottom of the page. Thanks, -Bob
Re: rdomain - rtableid confusion
On Tue, Nov 26, 2013 at 12:38:48PM +0100, Martin Pieuchot wrote: These two functions take a rtableid not a rdomain as an argument, simple renaming to avoid confusion. ok? Yes. OK Index: net/if.c === RCS file: /home/ncvs/src/sys/net/if.c,v retrieving revision 1.277 diff -u -p -r1.277 if.c --- net/if.c 19 Nov 2013 09:00:43 - 1.277 +++ net/if.c 26 Nov 2013 11:34:35 - @@ -853,18 +853,18 @@ if_congestion_clear(void *arg) */ /*ARGSUSED*/ struct ifaddr * -ifa_ifwithaddr(struct sockaddr *addr, u_int rdomain) +ifa_ifwithaddr(struct sockaddr *addr, u_int rtableid) { struct ifaddr_item *ifai, key; bzero(key, sizeof(key)); key.ifai_addr = addr; - key.ifai_rdomain = rtable_l2(rdomain); + key.ifai_rdomain = rtable_l2(rtableid); ifai = RB_FIND(ifaddr_items, ifaddr_items, key); if (ifai) return (ifai-ifai_ifa); - return (NULL); + return (NULL); } #define equal(a1, a2) \ Index: netinet/ip_input.c === RCS file: /home/ncvs/src/sys/netinet/ip_input.c,v retrieving revision 1.221 diff -u -p -r1.221 ip_input.c --- netinet/ip_input.c17 Nov 2013 10:07:32 - 1.221 +++ netinet/ip_input.c26 Nov 2013 11:34:35 - @@ -725,7 +725,7 @@ in_ouraddr(struct in_addr ina, struct mb } struct in_ifaddr * -in_iawithaddr(struct in_addr ina, u_int rdomain) +in_iawithaddr(struct in_addr ina, u_int rtableid) { struct in_ifaddr*ia; struct sockaddr_in sin; @@ -734,7 +734,7 @@ in_iawithaddr(struct in_addr ina, u_int sin.sin_len = sizeof(sin); sin.sin_family = AF_INET; sin.sin_addr = ina; - ia = ifatoia(ifa_ifwithaddr(sintosa(sin), rdomain)); + ia = ifatoia(ifa_ifwithaddr(sintosa(sin), rtableid)); if (ia == NULL || ina.s_addr == ia-ia_addr.sin_addr.s_addr) return (ia); -- :wq Claudio