svn commit: r239354 - head/sys/x86/x86
Author: jhb Date: Fri Aug 17 14:14:25 2012 New Revision: 239354 URL: http://svn.freebsd.org/changeset/base/239354 Log: Allow static DMA allocations that allow for enough segments to do page-sized segments for the entire allocation to use kmem_alloc_attr() to allocate KVM rather than using kmem_alloc_contig(). This avoids requiring a single physically contiguous chunk in this case. Submitted by: Peter Jeremy (original version) MFC after:1 month Modified: head/sys/x86/x86/busdma_machdep.c Modified: head/sys/x86/x86/busdma_machdep.c == --- head/sys/x86/x86/busdma_machdep.c Fri Aug 17 05:51:46 2012 (r239353) +++ head/sys/x86/x86/busdma_machdep.c Fri Aug 17 14:14:25 2012 (r239354) @@ -533,13 +533,14 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem) && attr == VM_MEMATTR_DEFAULT) { *vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags); + } else if (dmat->nsegments >= btoc(dmat->maxsize) && + dmat->alignment <= PAGE_SIZE && + (dmat->boundary == 0 || dmat->boundary >= dmat->lowaddr)) { + /* Page-based multi-segment allocations allowed */ + *vaddr = (void *)kmem_alloc_attr(kernel_map, dmat->maxsize, + mflags, 0ul, dmat->lowaddr, attr); + *mapp = &contig_dmamap; } else { - /* -* XXX Use Contigmalloc until it is merged into this facility -* and handles multi-seg allocations. Nobody is doing -* multi-seg allocations yet though. -* XXX Certain AGP hardware does. -*/ *vaddr = (void *)kmem_alloc_contig(kernel_map, dmat->maxsize, mflags, 0ul, dmat->lowaddr, dmat->alignment ? dmat->alignment : 1ul, dmat->boundary, attr); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r239334 - head/sys/netinet
On Thursday, August 16, 2012 6:33:12 pm Randall Stewart wrote: > > On Aug 16, 2012, at 3:34 PM, John Baldwin wrote: > > > On Thursday, August 16, 2012 1:55:17 pm Randall Stewart wrote: > >> Author: rrs > >> Date: Thu Aug 16 17:55:16 2012 > >> New Revision: 239334 > >> URL: http://svn.freebsd.org/changeset/base/239334 > >> > >> Log: > >> Its never a good idea to double free the same > >> address. > >> > >> MFC after:1 week (after the other commits ahead of this gets > >> MFC'd) > >> > >> Modified: > >> head/sys/netinet/in.c > >> > >> Modified: head/sys/netinet/in.c > >> > > == > >> --- head/sys/netinet/in.c Thu Aug 16 17:27:11 2012(r239333) > >> +++ head/sys/netinet/in.c Thu Aug 16 17:55:16 2012(r239334) > >> @@ -573,7 +573,7 @@ in_control(struct socket *so, u_long cmd > >>} > >>TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); > >>IF_ADDR_WUNLOCK(ifp); > >> - ifa_free(&ia->ia_ifa); /* if_addrhead */ > >> +/*ifa_free(&ia->ia_ifa); - Double free?? */ /* if_addrhead > >> */ > > > > This isn't a double free. This is dropping a reference count. In this > > case > > as the comment suggests, it is removing the reference held by the per- > > interface if_addrhead list that it was just removed from two lines above. > > Later in the function when ifa_free() is invoked: > > > > LIST_REMOVE(ia, ia_hash); > > IN_IFADDR_WUNLOCK(); > > ... > > ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ > > > > It is dropping the reference held by the in_ifaddrhead list which the ifa > > was removed from by the above LIST_REMOVE(). Are you seeing a panic or > > refcount underflow or some such? > > > > No panic, I wish I were so lucky, I had a lockup/fault at: > > in_gif.c line 410 (this is 9 stable) > --- > IN_IFADDR_RLOCK(); > TAILQ_FOREACH(ia4, &V_in_ifaddrhead, ia_link) { > if ((ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST) == 0) > <--fault in kernel HERE > continue; > if (ip->ip_src.s_addr == ia4->ia_broadaddr.sin_addr.s_addr) { > IN_IFADDR_RUNLOCK(); > return 0; > } > } > IN_IFADDR_RUNLOCK(); > > > I went through and made sure first that every reference using V_in_ifaddrhead > was properly locking, and they were. The only thing I could find is this. From > the instructions I could see in the assembly the ia4->ia_ifa.ifa_ifp was > NULL. And > thus caused a deref of a NULL pointer. I don't think what you found is a bug. It is clearly dropping two different references, so I think your fix isn't correct. I suspect there is an extra ifa_free() in some other path that you are tripping over. You can clearly see the two references added when an ifa is added to V_in_ifaddrhead: ifa_ref(ifa); /* if_addrhead */ IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); IF_ADDR_WUNLOCK(ifp); ifa_ref(ifa); /* in_ifaddrhead */ IN_IFADDR_WLOCK(); TAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link); IN_IFADDR_WUNLOCK(); If you can get a crashdump (not sure it sounds like you are able), I would add KTR traces of all callers to ifa_free() (logging the reference count value and pointer) and possibly adding an explicit panic for the reference count in ifa_free underflowing or overflowing and then look back in history for what ifa_free() calls were made. -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r239353 - head/sys/netinet
On Friday, August 17, 2012 1:51:46 am Randall Stewart wrote: > Author: rrs > Date: Fri Aug 17 05:51:46 2012 > New Revision: 239353 > URL: http://svn.freebsd.org/changeset/base/239353 > > Log: > Ok jhb, lets move the ifa_free() down to the bottom to > assure that *all* tables and such are removed before > we start to free. This won't protect the Hash in ip_input.c > but in theory should protect any other uses that *do* use locks. Eh, this is just a nop unless there is a reference counting bug. Only the last reference would free the memory if the reference count is correct, so this is just adding obfuscation by moving the ifa_free() away from the associated TAILQ_REMOVE(). -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r239356 - head/sbin/dhclient
Author: jhb Date: Fri Aug 17 15:53:43 2012 New Revision: 239356 URL: http://svn.freebsd.org/changeset/base/239356 Log: Fix dhclient to properly exit and teardown the configured lease when link is lost. devd will start a new dhclient instance when link is restored. PR: bin/166656 Submitted by: Peter Jeremy (mostly) Reviewed by: brooks (earlier version from Peter) MFC after:1 month Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Fri Aug 17 14:22:56 2012 (r239355) +++ head/sbin/dhclient/dhclient.c Fri Aug 17 15:53:43 2012 (r239356) @@ -278,6 +278,11 @@ routehandler(struct protocol *p) ifi->name); goto die; } + if (!interface_link_status(ifi->name)) { + warning("Interface %s is down, dhclient exiting", + ifi->name); + goto die; + } break; case RTM_IFANNOUNCE: ifan = (struct if_announcemsghdr *)rtm; @@ -316,6 +321,8 @@ routehandler(struct protocol *p) die: script_init("FAIL", NULL); + if (ifi->client->active) + script_write_params("old_", ifi->client->active); if (ifi->client->alias) script_write_params("alias_", ifi->client->alias); script_go(); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r239357 - in head/sys: net netipsec
Author: jhb Date: Fri Aug 17 16:01:24 2012 New Revision: 239357 URL: http://svn.freebsd.org/changeset/base/239357 Log: Unexpand a couple of TAILQ_FOREACH()s. Modified: head/sys/net/if_stf.c head/sys/netipsec/key.c Modified: head/sys/net/if_stf.c == --- head/sys/net/if_stf.c Fri Aug 17 15:53:43 2012(r239356) +++ head/sys/net/if_stf.c Fri Aug 17 16:01:24 2012(r239357) @@ -618,10 +618,7 @@ stf_checkaddr4(sc, in, inifp) * reject packets with broadcast */ IN_IFADDR_RLOCK(); - for (ia4 = TAILQ_FIRST(&V_in_ifaddrhead); -ia4; -ia4 = TAILQ_NEXT(ia4, ia_link)) - { + TAILQ_FOREACH(ia4, &V_in_ifaddrhead, ia_link) { if ((ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST) == 0) continue; if (in->s_addr == ia4->ia_broadaddr.sin_addr.s_addr) { Modified: head/sys/netipsec/key.c == --- head/sys/netipsec/key.c Fri Aug 17 15:53:43 2012(r239356) +++ head/sys/netipsec/key.c Fri Aug 17 16:01:24 2012(r239357) @@ -3921,8 +3921,7 @@ key_ismyaddr(sa) case AF_INET: sin = (struct sockaddr_in *)sa; IN_IFADDR_RLOCK(); - for (ia = V_in_ifaddrhead.tqh_first; ia; -ia = ia->ia_link.tqe_next) + TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (sin->sin_family == ia->ia_addr.sin_family && sin->sin_len == ia->ia_addr.sin_len && ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r239358 - in head/sys/dev/usb: . wlan
Author: hselasky Date: Fri Aug 17 16:27:11 2012 New Revision: 239358 URL: http://svn.freebsd.org/changeset/base/239358 Log: Add new USB device ID. PR: usb/170688 MFC after:1 week Modified: head/sys/dev/usb/usbdevs head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/usbdevs == --- head/sys/dev/usb/usbdevsFri Aug 17 16:01:24 2012(r239357) +++ head/sys/dev/usb/usbdevsFri Aug 17 16:27:11 2012(r239358) @@ -1118,6 +1118,7 @@ product ASUS A730W0x4202 ASUS MyPal A7 product ASUS P535 0x420f ASUS P535 PDA productASUS GMSC 0x422f ASUS Generic Mass Storage product ASUS RT25700x1706 RT2500USB Wireless Adapter +product ASUS USB_N53 0x179d ASUS Black Diamond Dual Band USB-N53 /* ATen products */ product ATEN UC12840x2001 Parallel printer Modified: head/sys/dev/usb/wlan/if_run.c == --- head/sys/dev/usb/wlan/if_run.c Fri Aug 17 16:01:24 2012 (r239357) +++ head/sys/dev/usb/wlan/if_run.c Fri Aug 17 16:27:11 2012 (r239358) @@ -136,6 +136,7 @@ static const STRUCT_USB_HOST_ID run_devs RUN_DEV(ASUS, RT2870_5), RUN_DEV(ASUS, USBN13), RUN_DEV(ASUS, RT3070_1), +RUN_DEV(ASUS, USB_N53), RUN_DEV(ASUS2, USBN11), RUN_DEV(AZUREWAVE, RT2870_1), RUN_DEV(AZUREWAVE, RT2870_2), ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r239356 - head/sbin/dhclient
On Fri, 2012-08-17 at 15:53 +, John Baldwin wrote: > Author: jhb > Date: Fri Aug 17 15:53:43 2012 > New Revision: 239356 > URL: http://svn.freebsd.org/changeset/base/239356 > > Log: > Fix dhclient to properly exit and teardown the configured lease when > link is lost. devd will start a new dhclient instance when link is > restored. > > PR: bin/166656 > Submitted by: Peter Jeremy (mostly) > Reviewed by:brooks (earlier version from Peter) > MFC after: 1 month > > Modified: > head/sbin/dhclient/dhclient.c > > Modified: head/sbin/dhclient/dhclient.c > == > --- head/sbin/dhclient/dhclient.c Fri Aug 17 14:22:56 2012 > (r239355) > +++ head/sbin/dhclient/dhclient.c Fri Aug 17 15:53:43 2012 > (r239356) > @@ -278,6 +278,11 @@ routehandler(struct protocol *p) > ifi->name); > goto die; > } > + if (!interface_link_status(ifi->name)) { > + warning("Interface %s is down, dhclient exiting", > + ifi->name); > + goto die; > + } > break; > case RTM_IFANNOUNCE: > ifan = (struct if_announcemsghdr *)rtm; > @@ -316,6 +321,8 @@ routehandler(struct protocol *p) > > die: > script_init("FAIL", NULL); > + if (ifi->client->active) > + script_write_params("old_", ifi->client->active); > if (ifi->client->alias) > script_write_params("alias_", ifi->client->alias); > script_go(); I think the attached patch should give the same result without needing to create/destroy a socket to check the link status every time a routing info message arrives. I've actually had this patch in my head for several years, I just hadn't gotten around to submitting it yet. -- Ian diff -r 6cb112d8486e sbin/dhclient/dhclient.c --- a/sbin/dhclient/dhclient.c Mon Aug 13 15:06:09 2012 -0600 +++ b/sbin/dhclient/dhclient.c Fri Aug 17 10:48:02 2012 -0600 @@ -273,7 +273,7 @@ routehandler(struct protocol *p) ifm = (struct if_msghdr *)rtm; if (ifm->ifm_index != ifi->index) break; - if ((rtm->rtm_flags & RTF_UP) == 0) { + if (ifm->ifm_data.ifi_link_state != LINK_STATE_UP) { warning("Interface %s is down, dhclient exiting", ifi->name); goto die; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r239356 - head/sbin/dhclient
On Friday, August 17, 2012 1:02:14 pm Ian Lepore wrote: > On Fri, 2012-08-17 at 15:53 +, John Baldwin wrote: > > Author: jhb > > Date: Fri Aug 17 15:53:43 2012 > > New Revision: 239356 > > URL: http://svn.freebsd.org/changeset/base/239356 > > > > Log: > > Fix dhclient to properly exit and teardown the configured lease when > > link is lost. devd will start a new dhclient instance when link is > > restored. > > > > PR: bin/166656 > > Submitted by: Peter Jeremy (mostly) > > Reviewed by: brooks (earlier version from Peter) > > MFC after:1 month > > > > Modified: > > head/sbin/dhclient/dhclient.c > > > > Modified: head/sbin/dhclient/dhclient.c > > == > > --- head/sbin/dhclient/dhclient.c Fri Aug 17 14:22:56 2012 > > (r239355) > > +++ head/sbin/dhclient/dhclient.c Fri Aug 17 15:53:43 2012 > > (r239356) > > @@ -278,6 +278,11 @@ routehandler(struct protocol *p) > > ifi->name); > > goto die; > > } > > + if (!interface_link_status(ifi->name)) { > > + warning("Interface %s is down, dhclient exiting", > > + ifi->name); > > + goto die; > > + } > > break; > > case RTM_IFANNOUNCE: > > ifan = (struct if_announcemsghdr *)rtm; > > @@ -316,6 +321,8 @@ routehandler(struct protocol *p) > > > > die: > > script_init("FAIL", NULL); > > + if (ifi->client->active) > > + script_write_params("old_", ifi->client->active); > > if (ifi->client->alias) > > script_write_params("alias_", ifi->client->alias); > > script_go(); > > I think the attached patch should give the same result without needing > to create/destroy a socket to check the link status every time a routing > info message arrives. I've actually had this patch in my head for > several years, I just hadn't gotten around to submitting it yet. Hmm, OpenBSD does check that, but they also seem to verify it via SIOCGMEDIA as well. Do we think this is as reliable? In the kernel we only seem to honor this if the NIC explicitly supports the capability: #define RT_LINK_IS_UP(ifp) (!((ifp)->if_capabilities & IFCAP_LINKSTATE) \ || (ifp)->if_link_state == LINK_STATE_UP) Also, I don't think routing info messages are all that common of an event are they? -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r239359 - in head: sys/fs/ext2fs sys/ufs/ufs usr.sbin/makefs/ffs
Author: mjg Date: Fri Aug 17 17:45:27 2012 New Revision: 239359 URL: http://svn.freebsd.org/changeset/base/239359 Log: Remove unused member of struct indir (in_exists) from UFS and EXT2 code. Reviewed by: mckusick Approved by: trasz (mentor) MFC after:1 week Modified: head/sys/fs/ext2fs/ext2_bmap.c head/sys/fs/ext2fs/inode.h head/sys/ufs/ufs/inode.h head/sys/ufs/ufs/ufs_bmap.c head/usr.sbin/makefs/ffs/ffs_extern.h head/usr.sbin/makefs/ffs/ufs_bmap.c Modified: head/sys/fs/ext2fs/ext2_bmap.c == --- head/sys/fs/ext2fs/ext2_bmap.c Fri Aug 17 16:27:11 2012 (r239358) +++ head/sys/fs/ext2fs/ext2_bmap.c Fri Aug 17 17:45:27 2012 (r239359) @@ -183,7 +183,6 @@ ext2_bmaparray(vp, bn, bnp, runp, runb) if (bp) bqrelse(bp); - ap->in_exists = 1; bp = getblk(vp, metalbn, bsize, 0, 0, 0); if ((bp->b_flags & B_CACHE) == 0) { #ifdef DIAGNOSTIC @@ -310,7 +309,6 @@ ext2_getlbns(vp, bn, ap, nump) */ ap->in_lbn = metalbn; ap->in_off = off = NIADDR - i; - ap->in_exists = 0; ap++; for (++numlevels; i <= NIADDR; i++) { /* If searching for a meta-data block, quit when found. */ @@ -322,7 +320,6 @@ ext2_getlbns(vp, bn, ap, nump) ++numlevels; ap->in_lbn = metalbn; ap->in_off = off; - ap->in_exists = 0; ++ap; metalbn -= -1 + off * blockcnt; Modified: head/sys/fs/ext2fs/inode.h == --- head/sys/fs/ext2fs/inode.h Fri Aug 17 16:27:11 2012(r239358) +++ head/sys/fs/ext2fs/inode.h Fri Aug 17 17:45:27 2012(r239359) @@ -151,7 +151,6 @@ struct inode { struct indir { int32_t in_lbn; /* Logical block number. */ int in_off; /* Offset in buffer. */ - int in_exists; /* Flag if the block exists. */ }; /* Convert between inode pointers and vnode pointers. */ Modified: head/sys/ufs/ufs/inode.h == --- head/sys/ufs/ufs/inode.hFri Aug 17 16:27:11 2012(r239358) +++ head/sys/ufs/ufs/inode.hFri Aug 17 17:45:27 2012(r239359) @@ -167,7 +167,6 @@ struct inode { struct indir { ufs2_daddr_t in_lbn;/* Logical block number. */ int in_off; /* Offset in buffer. */ - int in_exists; /* Flag if the block exists. */ }; /* Convert between inode pointers and vnode pointers. */ Modified: head/sys/ufs/ufs/ufs_bmap.c == --- head/sys/ufs/ufs/ufs_bmap.c Fri Aug 17 16:27:11 2012(r239358) +++ head/sys/ufs/ufs/ufs_bmap.c Fri Aug 17 17:45:27 2012(r239359) @@ -212,7 +212,6 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, ru if (bp) bqrelse(bp); - ap->in_exists = 1; bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0, 0); if ((bp->b_flags & B_CACHE) == 0) { #ifdef INVARIANTS @@ -357,7 +356,6 @@ ufs_getlbns(vp, bn, ap, nump) */ ap->in_lbn = metalbn; ap->in_off = off = NIADDR - i; - ap->in_exists = 0; ap++; for (++numlevels; i <= NIADDR; i++) { /* If searching for a meta-data block, quit when found. */ @@ -370,7 +368,6 @@ ufs_getlbns(vp, bn, ap, nump) ++numlevels; ap->in_lbn = metalbn; ap->in_off = off; - ap->in_exists = 0; ++ap; metalbn -= -1 + off * blockcnt; Modified: head/usr.sbin/makefs/ffs/ffs_extern.h == --- head/usr.sbin/makefs/ffs/ffs_extern.h Fri Aug 17 16:27:11 2012 (r239358) +++ head/usr.sbin/makefs/ffs/ffs_extern.h Fri Aug 17 17:45:27 2012 (r239359) @@ -44,7 +44,6 @@ struct inode; struct indir { daddr_t in_lbn; /* Logical block number. */ int in_off; /* Offset in buffer. */ - int in_exists; /* Flag if the block exists. */ }; /* ffs.c */ Modified: head/usr.sbin/makefs/ffs/ufs_bmap.c == --- head/usr.sbin/makefs/ffs/ufs_bmap.c Fri Aug 17 16:27:11 2012 (r239358) +++ head/usr.sbin/makefs/ffs/ufs_bmap.c Fri Aug 17 17:45:27 2012 (r239359) @@ -117,7 +117,6 @@ ufs_getlbns(struct inode *ip, daddr_t bn */ ap->in_lbn = metalbn; ap->in_off = off = NIADDR - i; - ap->in_exists = 0; ap++; for (++numlevels; i <= NIADDR; i++) {
Re: svn commit: r239356 - head/sbin/dhclient
On Fri, 2012-08-17 at 13:31 -0400, John Baldwin wrote: > On Friday, August 17, 2012 1:02:14 pm Ian Lepore wrote: > > On Fri, 2012-08-17 at 15:53 +, John Baldwin wrote: > > > Author: jhb > > > Date: Fri Aug 17 15:53:43 2012 > > > New Revision: 239356 > > > URL: http://svn.freebsd.org/changeset/base/239356 > > > > > > Log: > > > Fix dhclient to properly exit and teardown the configured lease when > > > link is lost. devd will start a new dhclient instance when link is > > > restored. > > > > > > PR: bin/166656 > > > Submitted by: Peter Jeremy (mostly) > > > Reviewed by:brooks (earlier version from Peter) > > > MFC after: 1 month > > > > > > Modified: > > > head/sbin/dhclient/dhclient.c > > > > > > Modified: head/sbin/dhclient/dhclient.c > > > == > > > --- head/sbin/dhclient/dhclient.c Fri Aug 17 14:22:56 2012 > > > (r239355) > > > +++ head/sbin/dhclient/dhclient.c Fri Aug 17 15:53:43 2012 > > > (r239356) > > > @@ -278,6 +278,11 @@ routehandler(struct protocol *p) > > > ifi->name); > > > goto die; > > > } > > > + if (!interface_link_status(ifi->name)) { > > > + warning("Interface %s is down, dhclient exiting", > > > + ifi->name); > > > + goto die; > > > + } > > > break; > > > case RTM_IFANNOUNCE: > > > ifan = (struct if_announcemsghdr *)rtm; > > > @@ -316,6 +321,8 @@ routehandler(struct protocol *p) > > > > > > die: > > > script_init("FAIL", NULL); > > > + if (ifi->client->active) > > > + script_write_params("old_", ifi->client->active); > > > if (ifi->client->alias) > > > script_write_params("alias_", ifi->client->alias); > > > script_go(); > > > > I think the attached patch should give the same result without needing > > to create/destroy a socket to check the link status every time a routing > > info message arrives. I've actually had this patch in my head for > > several years, I just hadn't gotten around to submitting it yet. > > Hmm, OpenBSD does check that, but they also seem to verify it via SIOCGMEDIA > as well. Do we think this is as reliable? In the kernel we only seem to > honor this if the NIC explicitly supports the capability: > > #define RT_LINK_IS_UP(ifp)(!((ifp)->if_capabilities & IFCAP_LINKSTATE) \ >|| (ifp)->if_link_state == LINK_STATE_UP) > > Also, I don't think routing info messages are all that common of an event are > they? > I actually don't know how common routing info messages are; the ways I use freebsd don't include a lot of heavy network usage. The IFCAP_LINKSTATE question is interesting. The #define comment for it says "the runtime link state is dynamic." The RT_LINK_IS_UP() macro is interesting too, in that it appears to assume that the link must be up if it isn't dynamic. I think that means the more-correct way than I posted would be a test such as if (!RT_LINK_IS_UP(&ifm->ifm_data)) It looks like IFCAP_LINKSTATE is added to if_capabilities by miibus_attach() and a few specific NIC drivers (presumably ones that don't use standard MII attachements to their PHYs). I would hope all that adds up to the concept that any network driver in control of links that can come and go will either automatically do the right thing by using the miibus code, or by using its own equivelent code when mii isn't appropriate, or the driver is buggy. Hopefully there aren't any in the last category. :) -- Ian ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r239360 - in head: contrib/diff/src gnu/usr.bin/diff
Author: obrien Date: Fri Aug 17 18:20:38 2012 New Revision: 239360 URL: http://svn.freebsd.org/changeset/base/239360 Log: Catch up with the subversion conversion and apply these build-time patches. Deleted: head/gnu/usr.bin/diff/context.c.diff head/gnu/usr.bin/diff/diff.c.diff Modified: head/contrib/diff/src/context.c head/contrib/diff/src/diff.c head/gnu/usr.bin/diff/Makefile Modified: head/contrib/diff/src/context.c == --- head/contrib/diff/src/context.c Fri Aug 17 17:45:27 2012 (r239359) +++ head/contrib/diff/src/context.c Fri Aug 17 18:20:38 2012 (r239360) @@ -29,7 +29,7 @@ # define TIMESPEC_NS(timespec) 0 #endif -size_t nstrftime (char *, size_t, char const *, struct tm const *, int, int); +size_t nstrftime (char *, size_t, char const *, struct tm const *, int, long); static char const *find_function (char const * const *, lin); static struct change *find_hunk (struct change *); @@ -57,12 +57,12 @@ print_context_label (char const *mark, char buf[MAX (INT_STRLEN_BOUND (int) + 32, INT_STRLEN_BOUND (time_t) + 11)]; struct tm const *tm = localtime (&inf->stat.st_mtime); - int nsec = TIMESPEC_NS (inf->stat.st_mtim); + long nsec = TIMESPEC_NS (inf->stat.st_mtim); if (! (tm && nstrftime (buf, sizeof buf, time_format, tm, 0, nsec))) { - long int sec = inf->stat.st_mtime; + time_t sec = inf->stat.st_mtime; verify (info_preserved, sizeof inf->stat.st_mtime <= sizeof sec); - sprintf (buf, "%ld.%.9d", sec, nsec); + sprintf (buf, "%jd.%.9d", (intmax_t)sec, nsec); } fprintf (outfile, "%s %s\t%s\n", mark, inf->name, buf); } Modified: head/contrib/diff/src/diff.c == --- head/contrib/diff/src/diff.cFri Aug 17 17:45:27 2012 (r239359) +++ head/contrib/diff/src/diff.cFri Aug 17 18:20:38 2012 (r239360) @@ -137,7 +137,7 @@ exclude_options (void) } static char const shortopts[] = -"0123456789abBcC:dD:eEfF:hHiI:lL:nNpPqrsS:tTuU:vwW:x:X:y"; +"0123456789abBcC:dD:eEfF:hHiI:lL:nNopPqrsS:tTuU:vwW:x:X:y"; /* Values for long options that do not have single-letter equivalents. */ enum @@ -265,14 +265,15 @@ main (int argc, char **argv) initialize_main (&argc, &argv); program_name = argv[0]; setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); c_stack_action (0); function_regexp_list.buf = &function_regexp; ignore_regexp_list.buf = &ignore_regexp; - re_set_syntax (RE_SYNTAX_GREP | RE_NO_POSIX_BACKTRACKING); + re_set_syntax (RE_SYNTAX_GREP); excluded = new_exclude (); + prepend_default_options (getenv ("DIFF_OPTIONS"), &argc, &argv); + /* Decode the options. */ while ((c = getopt_long (argc, argv, shortopts, longopts, 0)) != -1) @@ -428,6 +429,11 @@ main (int argc, char **argv) new_file = true; break; + case 'o': + /* Output in the old tradition style. */ + specify_style (OUTPUT_NORMAL); + break; + case 'p': show_c_function = true; add_regexp (&function_regexp_list, "^[[:alpha:]$_]"); @@ -983,8 +989,6 @@ specify_style (enum output_style style) { if (output_style != style) { - if (output_style != OUTPUT_UNSPECIFIED) - try_help ("conflicting output style options", 0); output_style = style; } } Modified: head/gnu/usr.bin/diff/Makefile == --- head/gnu/usr.bin/diff/Makefile Fri Aug 17 17:45:27 2012 (r239359) +++ head/gnu/usr.bin/diff/Makefile Fri Aug 17 18:20:38 2012 (r239360) @@ -27,10 +27,4 @@ SUBDIR+=doc DPADD= ${LIBGNUREGEX} LDADD= -lgnuregex -.for f in diff.c context.c -${f}: ${DIFFSRC}/${f} ${.CURDIR}/${f}.diff - patch -s -o ${.TARGET} < ${.CURDIR}/${f}.diff ${DIFFSRC}/${f} -CLEANFILES+= ${f} -.endfor - .include ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r239356 - head/sbin/dhclient
On Fri, Aug 17, 2012 at 03:53:43PM +, John Baldwin wrote: > Author: jhb > Date: Fri Aug 17 15:53:43 2012 > New Revision: 239356 > URL: http://svn.freebsd.org/changeset/base/239356 > > Log: > Fix dhclient to properly exit and teardown the configured lease when > link is lost. devd will start a new dhclient instance when link is > restored. Is it any chance to teach dhclient IPv6 addresses in very basic parser level, f.e. to replace nameserver it sniffs from router? Currently dhcp-options(5) understands IPv4 addresses only and produce error on 'supersede' IPv6 address. -- http://ache.vniz.net/ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r239361 - head/sys/mips/mips
Author: alc Date: Fri Aug 17 20:15:01 2012 New Revision: 239361 URL: http://svn.freebsd.org/changeset/base/239361 Log: Eliminate another vestige of page coloring. Modified: head/sys/mips/mips/uma_machdep.c Modified: head/sys/mips/mips/uma_machdep.c == --- head/sys/mips/mips/uma_machdep.cFri Aug 17 18:20:38 2012 (r239360) +++ head/sys/mips/mips/uma_machdep.cFri Aug 17 20:15:01 2012 (r239361) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); void * uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { - static vm_pindex_t color; vm_paddr_t pa; vm_page_t m; int pflags; @@ -56,7 +55,7 @@ uma_small_alloc(uma_zone_t zone, int byt pflags = VM_ALLOC_SYSTEM; for (;;) { - m = pmap_alloc_direct_page(color++, pflags); + m = pmap_alloc_direct_page(0, pflags); if (m == NULL) { if (wait & M_NOWAIT) return (NULL); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r239356 - head/sbin/dhclient
On Friday, August 17, 2012 2:09:54 pm Ian Lepore wrote: > On Fri, 2012-08-17 at 13:31 -0400, John Baldwin wrote: > > On Friday, August 17, 2012 1:02:14 pm Ian Lepore wrote: > > > On Fri, 2012-08-17 at 15:53 +, John Baldwin wrote: > > > > Author: jhb > > > > Date: Fri Aug 17 15:53:43 2012 > > > > New Revision: 239356 > > > > URL: http://svn.freebsd.org/changeset/base/239356 > > > > > > > > Log: > > > > Fix dhclient to properly exit and teardown the configured lease when > > > > link is lost. devd will start a new dhclient instance when link is > > > > restored. > > > > > > > > PR: bin/166656 > > > > Submitted by: Peter Jeremy (mostly) > > > > Reviewed by: brooks (earlier version from Peter) > > > > MFC after:1 month > > > > > > > > Modified: > > > > head/sbin/dhclient/dhclient.c > > > > > > > > Modified: head/sbin/dhclient/dhclient.c > > > > == > > > > --- head/sbin/dhclient/dhclient.c Fri Aug 17 14:22:56 2012 > > > > (r239355) > > > > +++ head/sbin/dhclient/dhclient.c Fri Aug 17 15:53:43 2012 > > > > (r239356) > > > > @@ -278,6 +278,11 @@ routehandler(struct protocol *p) > > > > ifi->name); > > > > goto die; > > > > } > > > > + if (!interface_link_status(ifi->name)) { > > > > + warning("Interface %s is down, dhclient > > > > exiting", > > > > + ifi->name); > > > > + goto die; > > > > + } > > > > break; > > > > case RTM_IFANNOUNCE: > > > > ifan = (struct if_announcemsghdr *)rtm; > > > > @@ -316,6 +321,8 @@ routehandler(struct protocol *p) > > > > > > > > die: > > > > script_init("FAIL", NULL); > > > > + if (ifi->client->active) > > > > + script_write_params("old_", ifi->client->active); > > > > if (ifi->client->alias) > > > > script_write_params("alias_", ifi->client->alias); > > > > script_go(); > > > > > > I think the attached patch should give the same result without needing > > > to create/destroy a socket to check the link status every time a routing > > > info message arrives. I've actually had this patch in my head for > > > several years, I just hadn't gotten around to submitting it yet. > > > > Hmm, OpenBSD does check that, but they also seem to verify it via SIOCGMEDIA > > as well. Do we think this is as reliable? In the kernel we only seem to > > honor this if the NIC explicitly supports the capability: > > > > #define RT_LINK_IS_UP(ifp) (!((ifp)->if_capabilities & IFCAP_LINKSTATE) \ > > || (ifp)->if_link_state == LINK_STATE_UP) > > > > Also, I don't think routing info messages are all that common of an event > > are they? > > > > I actually don't know how common routing info messages are; the ways I > use freebsd don't include a lot of heavy network usage. They appear to be rare: Finding symbol: rt_ifmsg Database directory: /home/jhb/work/freebsd/svn/head/sys/ --- *** net/route.h: [363] void rt_ifmsg(struct ifnet *); *** dev/usb/usb_pf.c: usbpf_clone_create[202]rt_ifmsg(ifp); *** net/if.c: if_unroute[1841] rt_ifmsg(ifp); if_route[1863] rt_ifmsg(ifp); do_link_state_change[1903] rt_ifmsg(ifp); ifhwioctl[2293]rt_ifmsg(ifp); if_setflag[2678] rt_ifmsg(ifp); *** net/rtsock.c: rt_ifmsg[1256] rt_ifmsg(struct ifnet *ifp) So, adding or removing routes, link state changes, changing the MTU, and changing an interface flag (e.g. ifconfig down). These all seem to be fairly rare to me, and generally require running ifconfig or route, etc. > The IFCAP_LINKSTATE question is interesting. The #define comment for it > says "the runtime link state is dynamic." The RT_LINK_IS_UP() macro is > interesting too, in that it appears to assume that the link must be up > if it isn't dynamic. I think that means the more-correct way than I > posted would be a test such as > > if (!RT_LINK_IS_UP(&ifm->ifm_data)) > > It looks like IFCAP_LINKSTATE is added to if_capabilities by > miibus_attach() and a few specific NIC drivers (presumably ones that > don't use standard MII attachements to their PHYs). > > I would hope all that adds up to the concept that any network driver in > control of links that can come and go will either automatically do the > right thing by using the miibus code, or by using its own equivelent > code when mii isn't appropriate, or the driver is buggy. Hopefully > there aren't any in the last category. :) I think pseudo-interfaces complicate things somewhat, but many of those (vlan(4), bridge(4), etc.) appear to do something sane I think. It's not clear to me that
Re: svn commit: r239356 - head/sbin/dhclient
On Friday, August 17, 2012 2:25:12 pm Andrey Chernov wrote: > On Fri, Aug 17, 2012 at 03:53:43PM +, John Baldwin wrote: > > Author: jhb > > Date: Fri Aug 17 15:53:43 2012 > > New Revision: 239356 > > URL: http://svn.freebsd.org/changeset/base/239356 > > > > Log: > > Fix dhclient to properly exit and teardown the configured lease when > > link is lost. devd will start a new dhclient instance when link is > > restored. > > Is it any chance to teach dhclient IPv6 addresses in very basic parser > level, f.e. to replace nameserver it sniffs from router? Currently > dhcp-options(5) understands IPv4 addresses only and produce error on > 'supersede' IPv6 address. I think the RFC defines those to be IPv4, yes? Presumably DHCPv6 adds new option types that support IPv6 addresses? -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r239362 - in head/sys/arm: at91 conf econa lpc mv s3c2xx0 sa11x0 ti xscale xscale/i80321 xscale/i8134x xscale/ixp425 xscale/pxa
Author: andrew Date: Sat Aug 18 05:48:19 2012 New Revision: 239362 URL: http://svn.freebsd.org/changeset/base/239362 Log: Set machine correctly on ARM. This allows universe to use the correct world when building each kernel. Reviewed by: imp Added: head/sys/arm/xscale/std.xscale-be (contents, props changed) Modified: head/sys/arm/at91/std.at91 head/sys/arm/at91/std.at91sam9 head/sys/arm/at91/std.at91sam9g45 head/sys/arm/at91/std.atmel head/sys/arm/conf/DEFAULTS head/sys/arm/econa/std.econa head/sys/arm/lpc/std.lpc head/sys/arm/mv/std-pj4b.mv head/sys/arm/mv/std.mv head/sys/arm/s3c2xx0/std.s3c2410 head/sys/arm/sa11x0/std.sa11x0 head/sys/arm/ti/std.ti head/sys/arm/xscale/i80321/std.i80219 head/sys/arm/xscale/i80321/std.i80321 head/sys/arm/xscale/i8134x/std.i81342 head/sys/arm/xscale/ixp425/std.ixp425 head/sys/arm/xscale/ixp425/std.ixp435 head/sys/arm/xscale/pxa/std.pxa head/sys/arm/xscale/std.xscale Modified: head/sys/arm/at91/std.at91 == --- head/sys/arm/at91/std.at91 Fri Aug 17 20:15:01 2012(r239361) +++ head/sys/arm/at91/std.at91 Sat Aug 18 05:48:19 2012(r239362) @@ -2,6 +2,7 @@ files "../at91/files.at91" cpuCPU_ARM9 +machinearm makeoptionsCONF_CFLAGS=-mcpu=arm9 optionsPHYSADDR=0x2000 optionsNO_EVENTTIMERS Modified: head/sys/arm/at91/std.at91sam9 == --- head/sys/arm/at91/std.at91sam9 Fri Aug 17 20:15:01 2012 (r239361) +++ head/sys/arm/at91/std.at91sam9 Sat Aug 18 05:48:19 2012 (r239362) @@ -2,6 +2,7 @@ files "../at91/files.at91" cpuCPU_ARM9 +machinearm makeoptionsCONF_CFLAGS=-mcpu=arm9 optionsPHYSADDR=0x2000 optionsNO_EVENTTIMERS Modified: head/sys/arm/at91/std.at91sam9g45 == --- head/sys/arm/at91/std.at91sam9g45 Fri Aug 17 20:15:01 2012 (r239361) +++ head/sys/arm/at91/std.at91sam9g45 Sat Aug 18 05:48:19 2012 (r239362) @@ -7,6 +7,7 @@ files "../at91/files.at91" cpuCPU_ARM9 +machinearm makeoptionsCONF_CFLAGS=-mcpu=arm9 optionsPHYSADDR=0x7000 optionsNO_EVENTTIMERS Modified: head/sys/arm/at91/std.atmel == --- head/sys/arm/at91/std.atmel Fri Aug 17 20:15:01 2012(r239361) +++ head/sys/arm/at91/std.atmel Sat Aug 18 05:48:19 2012(r239362) @@ -1,10 +1,6 @@ # $FreeBSD$ -files "../at91/files.at91" -cpuCPU_ARM9 -makeoptionsCONF_CFLAGS=-mcpu=arm9 -optionsPHYSADDR=0x2000 -optionsNO_EVENTTIMERS +include"../at91/std.at91sam9" # Supported SoCs for the at91 platform device at91rm9200 Modified: head/sys/arm/conf/DEFAULTS == --- head/sys/arm/conf/DEFAULTS Fri Aug 17 20:15:01 2012(r239361) +++ head/sys/arm/conf/DEFAULTS Sat Aug 18 05:48:19 2012(r239362) @@ -3,8 +3,6 @@ # # $FreeBSD$ -machinearm - device mem optionsGEOM_PART_BSD Modified: head/sys/arm/econa/std.econa == --- head/sys/arm/econa/std.econaFri Aug 17 20:15:01 2012 (r239361) +++ head/sys/arm/econa/std.econaSat Aug 18 05:48:19 2012 (r239362) @@ -2,6 +2,7 @@ files "../econa/files.econa" cpuCPU_FA526 +machinearm makeoptionsCONF_CFLAGS=-march=armv4 optionsPHYSADDR=0x makeoptionsKERNPHYSADDR=0x0100 Modified: head/sys/arm/lpc/std.lpc == --- head/sys/arm/lpc/std.lpcFri Aug 17 20:15:01 2012(r239361) +++ head/sys/arm/lpc/std.lpcSat Aug 18 05:48:19 2012(r239362) @@ -5,6 +5,7 @@ files "../lpc/files.lpc" cpuCPU_ARM9 +machinearm makeoptionsCONF_CFLAGS="-march=armv5te" optionsPHYSADDR=0x8000 optionsSTARTUP_PAGETABLE_ADDR=0x8000 Modified: head/sys/arm/mv/std-pj4b.mv == --- head/sys/arm/mv/std-pj4b.mv Fri Aug 17 20:15:01 2012(r239361) +++ head/sys/arm/mv/std-pj4b.mv Sat Aug 18 05:48:19 2012(r239362) @@ -2,5 +2,6 @@ files "../mv/files.mv" cpuCPU_MV_PJ4B +machinearm armv6 optionsVM_MAXUSER_ADDRESS="(KERNBASE-(1024*1024*1024))" Modified: head/sys/arm/mv/std.mv == --- head/sys/arm/mv/std.mv
svn commit: r239363 - head/sys/arm/conf
Author: andrew Date: Sat Aug 18 05:52:17 2012 New Revision: 239363 URL: http://svn.freebsd.org/changeset/base/239363 Log: Remove machine from the LN2410SBC config, it is set by std.s3c2410 Modified: head/sys/arm/conf/LN2410SBC Modified: head/sys/arm/conf/LN2410SBC == --- head/sys/arm/conf/LN2410SBC Sat Aug 18 05:48:19 2012(r239362) +++ head/sys/arm/conf/LN2410SBC Sat Aug 18 05:52:17 2012(r239363) @@ -17,7 +17,6 @@ # # $FreeBSD$ -machinearm ident LN2410SBC include"../s3c2xx0/std.ln2410sbc" ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"