set art_walk up for an mpsafe world
this tweaks art_walk in preparation for a world where the table may be updated on another cpu. at the moment we're relying on the big lock to serialise updates, so this adds big lock calls in the right place. jmatthew@ has a diff to serialise changes with a mutex, so those kernel lock calls can be replaced with the mutex ones. the idea is that art walk will traverse the tables under the lock. that allows us to bump the refcount on tables, which means they'll still be there when we unwined after descending into them. it gives up the lock when it calls the per route callback. this is so the callback can decide to update the table while looking at it. that route reference is done via the srp api. ok? Index: art.c === RCS file: /cvs/src/sys/net/art.c,v retrieving revision 1.19 diff -u -p -r1.19 art.c --- art.c 14 Jun 2016 04:42:02 - 1.19 +++ art.c 14 Jun 2016 12:36:25 - @@ -78,10 +78,13 @@ struct art_node *art_table_insert(struc int, struct art_node *); struct art_node*art_table_delete(struct art_root *, struct art_table *, int, struct art_node *); -voidart_table_ref(struct art_root *, struct art_table *); +struct art_table *art_table_ref(struct art_root *, struct art_table *); int art_table_free(struct art_root *, struct art_table *); int art_table_walk(struct art_root *, struct art_table *, int (*f)(struct art_node *, void *), void *); +int art_walk_apply(struct art_root *, +struct art_node *, struct art_node *, +int (*f)(struct art_node *, void *), void *); voidart_table_gc(void *); voidart_gc(void *); @@ -565,10 +568,11 @@ art_table_delete(struct art_root *ar, st return (an); } -void +struct art_table * art_table_ref(struct art_root *ar, struct art_table *at) { at->at_refcnt++; + return (at); } static inline int @@ -604,42 +608,44 @@ art_table_free(struct art_root *ar, stru int art_walk(struct art_root *ar, int (*f)(struct art_node *, void *), void *arg) { + struct srp_ref sr; struct art_table*at; struct art_node *node; - int error; - - KERNEL_ASSERT_LOCKED(); + int error = 0; + KERNEL_LOCK(); at = srp_get_locked(>ar_root); - if (at == NULL) - return (0); + if (at != NULL) { + art_table_ref(ar, at); - /* -* The default route should be processed here because the root -* table does not have a parent. -*/ - node = srp_get_locked(>at_default); - if (node != NULL) { - error = (*f)(node, arg); - if (error) - return (error); + /* +* The default route should be processed here because the root +* table does not have a parent. +*/ + node = srp_enter(, >at_default); + error = art_walk_apply(ar, node, NULL, f, arg); + srp_leave(); + + if (error == 0) + error = art_table_walk(ar, at, f, arg); + + art_table_free(ar, at); } + KERNEL_UNLOCK(); - return (art_table_walk(ar, at, f, arg)); + return (error); } int art_table_walk(struct art_root *ar, struct art_table *at, int (*f)(struct art_node *, void *), void *arg) { - struct art_node *next, *an = NULL; - struct art_node *node; + struct srp_ref sr; + struct art_node *node, *next; + struct art_table*nat; int i, j, error = 0; uint32_t maxfringe = (at->at_minfringe << 1); - /* Prevent this table to be freed while we're manipulating it. */ - art_table_ref(ar, at); - /* * Iterate non-fringe nodes in ``natural'' order. */ @@ -651,12 +657,13 @@ art_table_walk(struct art_root *ar, stru */ for (i = max(j, 2); i < at->at_minfringe; i <<= 1) { next = srp_get_locked(>at_heap[i >> 1].node); - an = srp_get_locked(>at_heap[i].node); - if ((an != NULL) && (an != next)) { - error = (*f)(an, arg); - if (error) - goto out; - } + + node = srp_enter(, >at_heap[i].node); + error = art_walk_apply(ar, node, next, f, arg); + srp_leave(); + + if (error != 0) +
Re: MBIM Patch (Round 3)
On Tue, Jun 14, 2016 at 11:56:14PM +0100, Stuart Henderson wrote: > As far as I can make out, the FCC auth is to enable the radio rather > than anything else, the command has to be sent over (qmi-over-)MBIM. > I haven't had time to get a linux install to see how it behaves there > but I would assume that it could easily look like an rfkill until > that command is sent. Hopefully that's the problem. > The patch I sent (I think it may have been offlist) is highly unlikely > to work as-is, it looked like the device needs to be reset as well > after sending the command.. Ah. That explains why I couldn't find the patch. I'm happy to test at some point. Thanks again. Bryan
Re: MBIM Patch (Round 3)
On Tue, Jun 14, 2016 at 11:17:56PM +0200, Gerhard Roth wrote: > Well, the device still refuses to turn on the radio and without it, > there's no chance to register with the provider. > > That you see more information now is just due to the fact, that the > state machine now continues beyond the "turn radio on" step. > > You might try the FCC auth patch, but I'm not very confident about > it in your situation. Your device already speaks MBIM, so why should > we need to enable it. > > I haven't got the slightest clue, why it refuses to turn on the radio. > It might be related to the type of SIM card. But honestly, I don't know. I tried to apply your most recently posted public patch again on a clean tree and ran into some problems with patching. As soon as I figure out what changed between your patch and -current src I will try again with a Verizon Wireless SIM card. It does seem that different device firmware is specific to specific carriers in some cases but it's not that clear. If I can rule out the SIM card causing problems it is at least one step further along. Thanks again! I hope that umb(4) can make it into OpenBSD soon! Bryan
Re: MBIM Patch (Round 3)
On 10.06.2016 14:41, Bryan Vyhmeister wrote: On Fri, Jun 10, 2016 at 09:43:36AM +0200, Gerhard Roth wrote: Hmm, I don't see the missing break. It is still stuck in the same state trying to turn on the radio and always getting non-confirmative resonses. If the break before "case UMB_S_RADIO:" is missing, I would expect to see a debug printf "umb0: init: checking SIM state ...". Could you please check once again? From a previous email you said to comment out the break after "case UMB_S_RADIO" which did not have any effect. Commenting out the break after "case UMB_S_OPEN" as I believe you are saying above did have an effect. case UMB_S_OPEN: DPRINTF("%s: init: turning radio on ...\n", DEVNAM(sc)); umb_radio(sc, 1); // break; case UMB_S_RADIO: DPRINTF("%s: init: checking SIM state ...\n", DEVNAM(sc)); umb_cmd(sc, MBIM_CID_SUBSCRIBER_READY_STATUS, MBIM_CMDOP_QRY, NULL, 0); break; case UMB_S_SIMREADY: DPRINTF("%s: init: attaching ...\n", DEVNAM(sc)); umb_packet_service(sc, 1); break; The error code is rather generic and gives us no help to determine why exactly the device refuses to turn on the radio. But it reports that the hw-state is on, which means we can at least exclude any rfkill switch ;) So why does the firmware refuse to turn it on? Could still be a problem of the PIN-less SIM card you're using. With the break commented out above I now see this output from ifconfig umb0 (sensitive info with XXX): umb0: flags=8811mtu 1500 index 5 priority 0 roaming disabled registration not registered state SIM is ready cell-class none SIM initialized PIN valid (3 attempts left) subscriber-id ICC-id XX device EM7455 IMEI 014582000 firmware SWI9X30C_02.08. phone# ++XX APN broadband status: down I have not seen the first ten digits of the SIM card's phone number, the subscriber-id, or the ICC-id in ifconfig output before so that seems promising. Could this be something like needing the FCC auth? The debug output follows. Thank you! Well, the device still refuses to turn on the radio and without it, there's no chance to register with the provider. That you see more information now is just due to the fact, that the state machine now continues beyond the "turn radio on" step. You might try the FCC auth patch, but I'm not very confident about it in your situation. Your device already speaks MBIM, so why should we need to enable it. I haven't got the slightest clue, why it refuses to turn on the radio. It might be related to the type of SIM card. But honestly, I don't know. Bryan OpenBSD 6.0-beta (GENERIC.MP) #1: Fri Jun 10 04:25:48 PDT 2016 r...@x.brycv.com:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 17024274432 (16235MB) avail mem = 16503758848 (15739MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.8 @ 0xb7c01000 (66 entries) bios0: vendor LENOVO version "R02ET44W (1.17 )" date 01/25/2016 bios0: LENOVO 20F6CTO1WW acpi0 at bios0: rev 2 acpi0: sleep states S0 S3 S4 S5 acpi0: tables DSDT FACP UEFI SSDT SSDT ECDT HPET APIC MCFG SSDT SSDT DBGP DBG2 BOOT BATB SSDT SSDT MSDM DMAR ASF! FPDT UEFI acpi0: wakeup devices LID_(S4) SLPB(S3) IGBE(S4) PXSX(S4) PXSX(S4) PXSX(S4) PXSX(S4) EXP8(S4) PXSX(S4) XHCI(S3) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpiec0 at acpi0 acpihpet0 at acpi0: 2399 Hz acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz, 2485.32 MHz cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,SGX,BMI1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,SENSOR,ARAT cpu0: 256KB 64b/line 8-way L2 cache cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges cpu0: apic clock running at 24MHz cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4.1.1.1, IBE cpu1 at mainbus0: apid 2 (application processor) cpu1: Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz, 2494.21 MHz cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,SGX,BMI1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,SENSOR,ARAT cpu1: 256KB 64b/line 8-way L2 cache cpu1:
Re: Not enough inodes on /usr for ports/xenocara
On Tue, Jun 14, 2016 at 06:14:05PM +0200, Jeremie Courreges-Anglas wrote: > Marc Peterswrites: > > > Hi, > > > > i just did an installation of a HP DL360 Gen9 to test UEFI installations > > with 5.9. I just accepted most of the defaults and did this for the > > disklabels, too. I wanted to checkout the sources to do release builds, > > but the autolayout didn't create enough inodes to do so: > > > > [snip] > > Quickfix: newfs -O 2. FFS2 allocates inodes lazily. I do not believe that. Lazy allocation does not change the max. -Otto
Re: Not enough inodes on /usr for ports/xenocara
On Tue, Jun 14, 2016 at 03:41:11PM +0200, Marc Peters wrote: > Hi, > > i just did an installation of a HP DL360 Gen9 to test UEFI installations > with 5.9. I just accepted most of the defaults and did this for the > disklabels, too. I wanted to checkout the sources to do release builds, > but the autolayout didn't create enough inodes to do so: > > [snip] > U xenocara/xserver/composite/Makefile.am > U xenocara/xserver/composite/Makefile.in > U xenocara/xserver/composite/compalloc.c > U xenocara/xserver/composite/compext.c > U xenocara/xserver/composite/compinit.c > U xenocara/xserver/composite/compint.h > U xenocara/xserver/composite/compositeext.h > U xenocara/xserver/composite/compoverlay.c > U xenocara/xserver/composite/compwindow.c > > /usr: create/symlink failed, no inodes free > cvs [checkout aborted]: cannot open > xenocara/xserver/config/CVS/Repository: No space left on device > > The layout is: > > /usr # df -ikl > Filesystem 1K-blocks Used Avail Capacity iused ifree %iused > Mounted on > /dev/sd0a 1028878 53078924358 5%1767 154135 1% / > /dev/sd0l 202395708 4 192275920 0% 1 12794877 0% > /home > /dev/sd0d 412539010 3919112 0% 6 545656 0% > /tmp > /dev/sd0f 2061054 157808437991881% 285822 0 100% > /usr > /dev/sd0g 102887821466076277622%9218 146684 6% > /usr/X11R6 > /dev/sd0h10318462 26502 9776038 0%1820 1323362 0% > /usr/local > /dev/sd0k 2061054 2 1958000 0% 1 285821 0% > /usr/obj > /dev/sd0j 2061054805962 115204041% 110019 17580338% > /usr/src > /dev/sd0e36618012 5154 34781958 0% 186 4676932 0% > /var > > The disk is a 300G SAS: > /usr # dmesg | grep sd0 > sd0 at scsibus1 targ 0 lun 0:SCSI3 0/direct > fixed > sd0: 286070MB, 512 bytes/sector, 585871964 sectors > root on sd0a (bd36a419525ca0cb.a) swap on sd0b dump on sd0b > > Maybe the caclculation of the autolayout can be adjusted to provide > enough inodes to checkout the sources and build the system. If you want to use a machine to build ports, you'll be needing much more space anyway. Adding a separate /usr/ports is the way to go in that case. -Otto > > > Marc > > dmesg: > OpenBSD 5.9 (GENERIC.MP) #1888: Fri Feb 26 01:20:19 MST 2016 > dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP > real mem = 34208731136 (32623MB) > avail mem = 33167773696 (31631MB) > mpath0 at root > scsibus0 at mpath0: 256 targets > mainbus0 at root > bios0 at mainbus0: SMBIOS rev. 2.8 @ 0x788cc000 (216 entries) > bios0: vendor HP version "P89" date 08/26/2014 > bios0: HP ProLiant DL360 Gen9 > acpi0 at bios0: rev 2 > acpi0: sleep states S0 S5 > acpi0: tables DSDT FACP UEFI MCEJ SSDT HEST BERT ERST EINJ HPET PMCT > WDDT APIC MCFG SLIT SRAT SPMI RASF SPCR MSCT BDAT PCCT DMAR SSDT SSDT > SSDT BGRT > acpi0: wakeup devices PEX4(S4) BR05(S4) BR03(S4) BR07(S4) BR11(S4) > BR13(S4) BR15(S4) BR17(S4) > acpitimer0 at acpi0: 3579545 Hz, 24 bits > acpihpet0 at acpi0: 14318179 Hz > acpimadt0 at acpi0 addr 0xfee0: PC-AT compat > cpu0 at mainbus0: apid 0 (boot processor) > cpu0: Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz, 2397.53 MHz > cpu0: > FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,PQM,SENSOR,ARAT > cpu0: 256KB 64b/line 8-way L2 cache > cpu0: smt 0, core 0, package 0 > mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges > cpu0: apic clock running at 99MHz > cpu0: mwait min=64, max=64, C-substates=0.2.1.2, IBE > cpu1 at mainbus0: apid 2 (application processor) > cpu1: Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz, 2397.23 MHz > cpu1: > FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,PQM,SENSOR,ARAT > cpu1: 256KB 64b/line 8-way L2 cache > cpu1: failed to identify > cpu1: smt 0, core 1, package 0 > cpu2 at mainbus0: apid 4 (application processor) > cpu2: Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz, 2397.23 MHz > cpu2: >
Re: Not enough inodes on /usr for ports/xenocara
On Tue, Jun 14, 2016 at 06:14:05PM +0200, Jeremie Courreges-Anglas wrote: > Marc Peterswrites: > > > Hi, > > > > i just did an installation of a HP DL360 Gen9 to test UEFI installations > > with 5.9. I just accepted most of the defaults and did this for the > > disklabels, too. I wanted to checkout the sources to do release builds, > > but the autolayout didn't create enough inodes to do so: > > > > [snip] > > Quickfix: newfs -O 2. FFS2 allocates inodes lazily. > > -- > jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE A 2G partition: [otto@mini:14]$ sudo newfs sd0h /dev/rsd0h: 2050.9MB in 4200256 sectors of 512 bytes 11 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each [otto@mini:15]$ sudo newfs -O2 sd0h /dev/rsd0h: 2050.9MB in 4200256 sectors of 512 bytes 11 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each No significant difference, Creating the fs with a higher inode density is a way to get more inodes (but a separate /usr/ports is better): [otto@mini:19]$ sudo newfs -i 4096 sd0h /dev/rsd0h: 2050.9MB in 4200256 sectors of 512 bytes 13 cylinder groups of 168.72MB, 10798 blocks, 43264 inodes each
Re: Not enough inodes on /usr for ports/xenocara
Amit Kulkarniwrites: > On Tue, Jun 14, 2016 at 8:41 AM, Marc Peters wrote: > >> Hi, >> >> i just did an installation of a HP DL360 Gen9 to test UEFI installations >> with 5.9. I just accepted most of the defaults and did this for the >> disklabels, too. I wanted to checkout the sources to do release builds, >> but the autolayout didn't create enough inodes to do so: >> >> [snip] >> U xenocara/xserver/composite/Makefile.am >> U xenocara/xserver/composite/Makefile.in >> U xenocara/xserver/composite/compalloc.c >> U xenocara/xserver/composite/compext.c >> U xenocara/xserver/composite/compinit.c >> U xenocara/xserver/composite/compint.h >> U xenocara/xserver/composite/compositeext.h >> U xenocara/xserver/composite/compoverlay.c >> U xenocara/xserver/composite/compwindow.c >> >> /usr: create/symlink failed, no inodes free >> cvs [checkout aborted]: cannot open >> xenocara/xserver/config/CVS/Repository: No space left on device >> >> The layout is: >> >> /usr # df -ikl >> Filesystem 1K-blocks Used Avail Capacity iused ifree %iused >> Mounted on >> /dev/sd0a 1028878 53078924358 5%1767 154135 1% / >> /dev/sd0l 202395708 4 192275920 0% 1 12794877 0% >> /home >> /dev/sd0d 412539010 3919112 0% 6 545656 0% >> /tmp >> /dev/sd0f 2061054 157808437991881% 285822 0 100% >> /usr >> /dev/sd0g 102887821466076277622%9218 146684 6% >> /usr/X11R6 >> /dev/sd0h10318462 26502 9776038 0%1820 1323362 0% >> /usr/local >> /dev/sd0k 2061054 2 1958000 0% 1 285821 0% >> /usr/obj >> /dev/sd0j 2061054805962 115204041% 110019 17580338% >> /usr/src >> /dev/sd0e36618012 5154 34781958 0% 186 4676932 0% >> /var >> >> > /usr/{src/obj} is usually allocated 2 GB, you have the same 2 GB allocated > for /usr (df -h might be friendlier to see and confirm). I usually mount > /usr/ports with 100 GB (thinking of splitting it some more), /usr/xenocara > with 1-2 GB, Yup, /dev/sd1l 982M633M300M68%/usr/xenocara > and /usr/xobj with 1-2 GB. An alternative: XOBJDIR = /usr/obj/xobj in mk.conf(5) > If this is a newly installed machine and you don't want to fiddle with it, > you can symlink /usr/xenocara to /home/marc/. But I would re-install with > the correct layout. It usually takes a few tries to get it right for your > workflow. > > Good luck! -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
Re: IP_SENDSRCADDR [2/2] : add cmsg support
Martin Pieuchotwrites: > On 14/06/16(Tue) 13:49, Jeremie Courreges-Anglas wrote: >> Vincent Gross writes: >> > On Mon, 13 Jun 2016 19:57:15 +0200 >> > Jeremie Courreges-Anglas wrote: >> >> Vincent Gross writes: >> >> > Le Mon, 13 Jun 2016 07:35:16 +0200, >> >> > j...@wxcvbn.org (Jeremie Courreges-Anglas) a écrit : >> >> >> j...@wxcvbn.org (Jeremie Courreges-Anglas) writes: >> >> >> >> >> >> > cc'ing sthen since he also has interest in IP_SENDSRCADDR >> >> >> > >> >> >> > Jeremie Courreges-Anglas writes: >> >> >> > >> >> >> >> Vincent Gross writes: >> >> >> >> >> >> >> >>> This diff adds support for IP_SENDSRCADDR cmsg on UDP sockets. >> >> >> >>> As for udp6_output(), we check that the source address+port is >> >> >> >>> available only if inp_laddr != * >> >> >> >> >> >> >> >> Your last IP_SENDSRCADDR diff didn't have that check, I think >> >> >> >> it is harmful. If the socket is not bound then there is >> >> >> >> effectively no check performed by in_pcbaddrisavail(), thus I >> >> >> >> can use any random address. Other than this additional bypass >> >> >> >> check, your diff looks good to me. >> >> >> >> >> >> > [...] >> >> >> >> >> >> >> >> I haven't checked yet whether udp6_output is also affected. If >> >> >> >> you folks already know that it isn't, please let me know. >> >> >> >> >> >> The answer is "no", a few tests can't trigger the same problem. >> >> >> IIUC in6_selectsrc is responsible for rejection of non-local >> >> >> systems. Maybe we should take the same approach in netinet/, and >> >> >> extend in_selectsrc()? >> >> >> >> >> >> -- >> >> > >> >> > While validating source address inside selection functions is the >> >> > right direction, I don't think it would be a good thing to extend >> >> > further in_selectsrc() prototype. >> >> >> >> I find it nice to have all the source address selection in one place. >> >> Or do you have another refactoring in mind? >> >> >> > >> > Uh, turns out I was operating on obsolete data. I would actually be >> > easy to shrink in_selectsrc() prototype to >> > (int)(struct in_addr **, struct sockaddr_in *, struct in_pcb *). >> > But this looks like a layering violation to me ... What do you think ? >> >> I wouldn't mind adding an extra argument and staying closer to >> in6_selectsrc. > > Can we get the feature in first then see how we refactor things later? Agreed. > I really don't think that extending in_selectsrc() is a good thing. > in6_selectsrc() is a bad example and IMHO this function should be > revisited. Having a function taking 7 arguments with 4 optional > ones makes it very difficult to understand what's happening. Your call. :) -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
Re: Fix return value of OF_getprop() when name has a '@' in it
> Date: Tue, 14 Jun 2016 14:33:14 +0100 (BST) > From: Tom Cosgrove> > >>> Tom Cosgrove 12-Jun-16 22:05 >>> > > > > In OF_getprop(), if the "name" property doesn't exist it is synthesised > > from the unit name. If that synthesised property has an "@" in it, we > > truncate the name just before the "@", but we currently continue to return > > the full length of the unit name. > > > > This diff returns the length of the truncated name. > > > > Thanks > > > > Tom > > Updated diff following the recent commit to fdt.c > > Ensures that OF_getprop() returns the same length value that > OF_getproplen() did when it's called on a node name with '@' in it > > (Also implemented slightly differently this time, keeping a single 'return' > and instead re-calculating 'len'.) > > Thanks Thanks Tom, had to get that other diff out of the way before testing this. It's committed now. > Index: sys/dev/ofw/fdt.c > === > RCS file: /home/OpenBSD/cvs/src/sys/dev/ofw/fdt.c,v > retrieving revision 1.13 > diff -u -p -r1.13 fdt.c > --- sys/dev/ofw/fdt.c 14 Jun 2016 10:03:51 - 1.13 > +++ sys/dev/ofw/fdt.c 14 Jun 2016 13:29:39 - > @@ -782,8 +782,10 @@ OF_getprop(int handle, char *prop, void > if (data) { > len = strlcpy(buf, data, buflen); > data = strchr(buf, '@'); > - if (data) > + if (data) { > *data = 0; > + len = data - (char *)buf; > + } > return len + 1; > } > } > >
Re: Not enough inodes on /usr for ports/xenocara
On Tue, Jun 14, 2016 at 8:41 AM, Marc Peterswrote: > Hi, > > i just did an installation of a HP DL360 Gen9 to test UEFI installations > with 5.9. I just accepted most of the defaults and did this for the > disklabels, too. I wanted to checkout the sources to do release builds, > but the autolayout didn't create enough inodes to do so: > > [snip] > U xenocara/xserver/composite/Makefile.am > U xenocara/xserver/composite/Makefile.in > U xenocara/xserver/composite/compalloc.c > U xenocara/xserver/composite/compext.c > U xenocara/xserver/composite/compinit.c > U xenocara/xserver/composite/compint.h > U xenocara/xserver/composite/compositeext.h > U xenocara/xserver/composite/compoverlay.c > U xenocara/xserver/composite/compwindow.c > > /usr: create/symlink failed, no inodes free > cvs [checkout aborted]: cannot open > xenocara/xserver/config/CVS/Repository: No space left on device > > The layout is: > > /usr # df -ikl > Filesystem 1K-blocks Used Avail Capacity iused ifree %iused > Mounted on > /dev/sd0a 1028878 53078924358 5%1767 154135 1% / > /dev/sd0l 202395708 4 192275920 0% 1 12794877 0% > /home > /dev/sd0d 412539010 3919112 0% 6 545656 0% > /tmp > /dev/sd0f 2061054 157808437991881% 285822 0 100% > /usr > /dev/sd0g 102887821466076277622%9218 146684 6% > /usr/X11R6 > /dev/sd0h10318462 26502 9776038 0%1820 1323362 0% > /usr/local > /dev/sd0k 2061054 2 1958000 0% 1 285821 0% > /usr/obj > /dev/sd0j 2061054805962 115204041% 110019 17580338% > /usr/src > /dev/sd0e36618012 5154 34781958 0% 186 4676932 0% > /var > > /usr/{src/obj} is usually allocated 2 GB, you have the same 2 GB allocated for /usr (df -h might be friendlier to see and confirm). I usually mount /usr/ports with 100 GB (thinking of splitting it some more), /usr/xenocara with 1-2 GB, and /usr/xobj with 1-2 GB. If this is a newly installed machine and you don't want to fiddle with it, you can symlink /usr/xenocara to /home/marc/. But I would re-install with the correct layout. It usually takes a few tries to get it right for your workflow. Good luck!
Re: (u)ral remove ralink url
On 2016/06/14 14:54, Martijn van Duren wrote: > Hello tech@, > > It appears that http://www.ralinktech.com isn't available anymore. > OK to remove? > > martijn@ It's MediaTek now.
Re: Fix return value of OF_getprop() when name has a '@' in it
>>> Tom Cosgrove 12-Jun-16 22:05 >>> > > In OF_getprop(), if the "name" property doesn't exist it is synthesised > from the unit name. If that synthesised property has an "@" in it, we > truncate the name just before the "@", but we currently continue to return > the full length of the unit name. > > This diff returns the length of the truncated name. > > Thanks > > Tom Updated diff following the recent commit to fdt.c Ensures that OF_getprop() returns the same length value that OF_getproplen() did when it's called on a node name with '@' in it (Also implemented slightly differently this time, keeping a single 'return' and instead re-calculating 'len'.) Thanks Tom Index: sys/dev/ofw/fdt.c === RCS file: /home/OpenBSD/cvs/src/sys/dev/ofw/fdt.c,v retrieving revision 1.13 diff -u -p -r1.13 fdt.c --- sys/dev/ofw/fdt.c 14 Jun 2016 10:03:51 - 1.13 +++ sys/dev/ofw/fdt.c 14 Jun 2016 13:29:39 - @@ -782,8 +782,10 @@ OF_getprop(int handle, char *prop, void if (data) { len = strlcpy(buf, data, buflen); data = strchr(buf, '@'); - if (data) + if (data) { *data = 0; + len = data - (char *)buf; + } return len + 1; } }
Not enough inodes on /usr for ports/xenocara
Hi, i just did an installation of a HP DL360 Gen9 to test UEFI installations with 5.9. I just accepted most of the defaults and did this for the disklabels, too. I wanted to checkout the sources to do release builds, but the autolayout didn't create enough inodes to do so: [snip] U xenocara/xserver/composite/Makefile.am U xenocara/xserver/composite/Makefile.in U xenocara/xserver/composite/compalloc.c U xenocara/xserver/composite/compext.c U xenocara/xserver/composite/compinit.c U xenocara/xserver/composite/compint.h U xenocara/xserver/composite/compositeext.h U xenocara/xserver/composite/compoverlay.c U xenocara/xserver/composite/compwindow.c /usr: create/symlink failed, no inodes free cvs [checkout aborted]: cannot open xenocara/xserver/config/CVS/Repository: No space left on device The layout is: /usr # df -ikl Filesystem 1K-blocks Used Avail Capacity iused ifree %iused Mounted on /dev/sd0a 1028878 53078924358 5%1767 154135 1% / /dev/sd0l 202395708 4 192275920 0% 1 12794877 0% /home /dev/sd0d 412539010 3919112 0% 6 545656 0% /tmp /dev/sd0f 2061054 157808437991881% 285822 0 100% /usr /dev/sd0g 102887821466076277622%9218 146684 6% /usr/X11R6 /dev/sd0h10318462 26502 9776038 0%1820 1323362 0% /usr/local /dev/sd0k 2061054 2 1958000 0% 1 285821 0% /usr/obj /dev/sd0j 2061054805962 115204041% 110019 17580338% /usr/src /dev/sd0e36618012 5154 34781958 0% 186 4676932 0% /var The disk is a 300G SAS: /usr # dmesg | grep sd0 sd0 at scsibus1 targ 0 lun 0:SCSI3 0/direct fixed sd0: 286070MB, 512 bytes/sector, 585871964 sectors root on sd0a (bd36a419525ca0cb.a) swap on sd0b dump on sd0b Maybe the caclculation of the autolayout can be adjusted to provide enough inodes to checkout the sources and build the system. Marc dmesg: OpenBSD 5.9 (GENERIC.MP) #1888: Fri Feb 26 01:20:19 MST 2016 dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 34208731136 (32623MB) avail mem = 33167773696 (31631MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.8 @ 0x788cc000 (216 entries) bios0: vendor HP version "P89" date 08/26/2014 bios0: HP ProLiant DL360 Gen9 acpi0 at bios0: rev 2 acpi0: sleep states S0 S5 acpi0: tables DSDT FACP UEFI MCEJ SSDT HEST BERT ERST EINJ HPET PMCT WDDT APIC MCFG SLIT SRAT SPMI RASF SPCR MSCT BDAT PCCT DMAR SSDT SSDT SSDT BGRT acpi0: wakeup devices PEX4(S4) BR05(S4) BR03(S4) BR07(S4) BR11(S4) BR13(S4) BR15(S4) BR17(S4) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpihpet0 at acpi0: 14318179 Hz acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz, 2397.53 MHz cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,PQM,SENSOR,ARAT cpu0: 256KB 64b/line 8-way L2 cache cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges cpu0: apic clock running at 99MHz cpu0: mwait min=64, max=64, C-substates=0.2.1.2, IBE cpu1 at mainbus0: apid 2 (application processor) cpu1: Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz, 2397.23 MHz cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,PQM,SENSOR,ARAT cpu1: 256KB 64b/line 8-way L2 cache cpu1: failed to identify cpu1: smt 0, core 1, package 0 cpu2 at mainbus0: apid 4 (application processor) cpu2: Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz, 2397.23 MHz cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,PQM,SENSOR,ARAT cpu2: 256KB 64b/line 8-way L2 cache cpu2: failed to identify cpu2: smt 0, core 2, package 0 cpu3 at mainbus0: apid 6 (application processor) cpu3: Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz, 2397.23 MHz cpu3:
Re: IP_SENDSRCADDR [2/2] : add cmsg support
On 14/06/16(Tue) 13:49, Jeremie Courreges-Anglas wrote: > Vincent Grosswrites: > > On Mon, 13 Jun 2016 19:57:15 +0200 > > Jeremie Courreges-Anglas wrote: > >> Vincent Gross writes: > >> > Le Mon, 13 Jun 2016 07:35:16 +0200, > >> > j...@wxcvbn.org (Jeremie Courreges-Anglas) a écrit : > >> >> j...@wxcvbn.org (Jeremie Courreges-Anglas) writes: > >> >> > >> >> > cc'ing sthen since he also has interest in IP_SENDSRCADDR > >> >> > > >> >> > Jeremie Courreges-Anglas writes: > >> >> > > >> >> >> Vincent Gross writes: > >> >> >> > >> >> >>> This diff adds support for IP_SENDSRCADDR cmsg on UDP sockets. > >> >> >>> As for udp6_output(), we check that the source address+port is > >> >> >>> available only if inp_laddr != * > >> >> >> > >> >> >> Your last IP_SENDSRCADDR diff didn't have that check, I think > >> >> >> it is harmful. If the socket is not bound then there is > >> >> >> effectively no check performed by in_pcbaddrisavail(), thus I > >> >> >> can use any random address. Other than this additional bypass > >> >> >> check, your diff looks good to me. > >> >> >> > >> > [...] > >> >> >> > >> >> >> I haven't checked yet whether udp6_output is also affected. If > >> >> >> you folks already know that it isn't, please let me know. > >> >> > >> >> The answer is "no", a few tests can't trigger the same problem. > >> >> IIUC in6_selectsrc is responsible for rejection of non-local > >> >> systems. Maybe we should take the same approach in netinet/, and > >> >> extend in_selectsrc()? > >> >> > >> >> -- > >> > > >> > While validating source address inside selection functions is the > >> > right direction, I don't think it would be a good thing to extend > >> > further in_selectsrc() prototype. > >> > >> I find it nice to have all the source address selection in one place. > >> Or do you have another refactoring in mind? > >> > > > > Uh, turns out I was operating on obsolete data. I would actually be > > easy to shrink in_selectsrc() prototype to > > (int)(struct in_addr **, struct sockaddr_in *, struct in_pcb *). > > But this looks like a layering violation to me ... What do you think ? > > I wouldn't mind adding an extra argument and staying closer to > in6_selectsrc. Can we get the feature in first then see how we refactor things later? I really don't think that extending in_selectsrc() is a good thing. in6_selectsrc() is a bad example and IMHO this function should be revisited. Having a function taking 7 arguments with 4 optional ones makes it very difficult to understand what's happening.
Re: Kill nd6_output()
There is a typo in a comment in nd6.c. s/nd6_resove/nd6_resolve/ With that fixed OK florian@ On Tue, Jun 14, 2016 at 11:52:02AM +0200, Martin Pieuchot wrote: > It's no longer doing anything, so let's remove it, ok? > > Index: net/pf.c > === > RCS file: /cvs/src/sys/net/pf.c,v > retrieving revision 1.975 > diff -u -p -r1.975 pf.c > --- net/pf.c 7 Jun 2016 01:31:54 - 1.975 > +++ net/pf.c 8 Jun 2016 14:34:33 - > @@ -5762,7 +5762,7 @@ pf_route6(struct mbuf **m, struct pf_rul > ip6stat.ip6s_noroute++; > goto bad; > } > - nd6_output(ifp, m0, dst, rt); > + ifp->if_output(ifp, m0, sin6tosa(dst), rt); > rtfree(rt); > } else { > icmp6_error(m0, ICMP6_PACKET_TOO_BIG, 0, ifp->if_mtu); > Index: net/pf_norm.c > === > RCS file: /cvs/src/sys/net/pf_norm.c,v > retrieving revision 1.186 > diff -u -p -r1.186 pf_norm.c > --- net/pf_norm.c 31 May 2016 07:35:36 - 1.186 > +++ net/pf_norm.c 8 Jun 2016 14:34:07 - > @@ -761,7 +761,7 @@ pf_refragment6(struct mbuf **m0, struct > if (ifp == NULL) { > ip6_forward(m, 0); > } else if ((u_long)m->m_pkthdr.len <= ifp->if_mtu) { > - nd6_output(ifp, m, dst, rt); > + ifp->if_output(ifp, m, sin6tosa(dst), rt); > } else { > icmp6_error(m, ICMP6_PACKET_TOO_BIG, 0, > ifp->if_mtu); > Index: netinet6/ip6_forward.c > === > RCS file: /cvs/src/sys/netinet6/ip6_forward.c,v > retrieving revision 1.90 > diff -u -p -r1.90 ip6_forward.c > --- netinet6/ip6_forward.c2 May 2016 09:30:47 - 1.90 > +++ netinet6/ip6_forward.c8 Jun 2016 14:33:05 - > @@ -332,7 +332,7 @@ reroute: > goto out; > } > > - error = nd6_output(ifp, m, dst, rt); > + error = ifp->if_output(ifp, m, sin6tosa(dst), rt); > if (error) { > ip6stat.ip6s_cantforward++; > } else { > Index: netinet6/ip6_mroute.c > === > RCS file: /cvs/src/sys/netinet6/ip6_mroute.c,v > retrieving revision 1.102 > diff -u -p -r1.102 ip6_mroute.c > --- netinet6/ip6_mroute.c 21 Jan 2016 11:23:48 - 1.102 > +++ netinet6/ip6_mroute.c 8 Jun 2016 14:30:41 - > @@ -1429,10 +1429,6 @@ phyint_send6(struct ip6_hdr *ip6, struct > dst6->sin6_len = sizeof(struct sockaddr_in6); > dst6->sin6_family = AF_INET6; > dst6->sin6_addr = ip6->ip6_dst; > - /* > - * We just call if_output instead of nd6_output here, since > - * we need no ND for a multicast forwarded packet...right? > - */ > error = ifp->if_output(ifp, mb_copy, sin6tosa(_dst), > NULL); > } else { > Index: netinet6/ip6_output.c > === > RCS file: /cvs/src/sys/netinet6/ip6_output.c,v > retrieving revision 1.207 > diff -u -p -r1.207 ip6_output.c > --- netinet6/ip6_output.c 19 May 2016 11:34:40 - 1.207 > +++ netinet6/ip6_output.c 8 Jun 2016 14:33:44 - > @@ -692,7 +692,7 @@ reroute: >* transmit packet without fragmentation >*/ > if (dontfrag || (!alwaysfrag && tlen <= mtu)) { /* case 1-a and 2-a */ > - error = nd6_output(ifp, m, dst, ro->ro_rt); > + error = ifp->if_output(ifp, m, sin6tosa(dst), ro->ro_rt); > goto done; > } > > @@ -767,7 +767,8 @@ reroute: > m->m_nextpkt = 0; > if (error == 0) { > ip6stat.ip6s_ofragments++; > - error = nd6_output(ifp, m, dst, ro->ro_rt); > + error = ifp->if_output(ifp, m, sin6tosa(dst), > + ro->ro_rt); > } else > m_freem(m); > } > Index: netinet6/nd6.c > === > RCS file: /cvs/src/sys/netinet6/nd6.c,v > retrieving revision 1.185 > diff -u -p -r1.185 nd6.c > --- netinet6/nd6.c8 Jun 2016 12:57:58 - 1.185 > +++ netinet6/nd6.c8 Jun 2016 14:32:50 - > @@ -1352,7 +1352,7 @@ fail: > > if (ln->ln_state == ND6_LLINFO_STALE) { > /* > - * XXX: since nd6_output() below will cause > + * Since nd6_resove() in ifp->if_output() will cause >* state transition to DELAY and reset the timer, >* we must set the timer now, although it is actually >
(u)ral remove ralink url
Hello tech@, It appears that http://www.ralinktech.com isn't available anymore. OK to remove? martijn@ Index: ral.4 === RCS file: /cvs/src/share/man/man4/ral.4,v retrieving revision 1.108 diff -u -p -r1.108 ral.4 --- ral.4 7 Mar 2016 13:47:53 - 1.108 +++ ral.4 14 Jun 2016 12:53:29 - @@ -302,9 +302,6 @@ inet 192.168.1.1 255.255.255.0 .Xr hostname.if 5 , .Xr hostapd 8 , .Xr ifconfig 8 -.Pp -Ralink Technology: -.Lk http://www.ralinktech.com/ .Sh HISTORY The .Nm Index: rum.4 === RCS file: /cvs/src/share/man/man4/rum.4,v retrieving revision 1.57 diff -u -p -r1.57 rum.4 --- rum.4 7 Mar 2016 13:47:53 - 1.57 +++ rum.4 14 Jun 2016 12:53:29 - @@ -199,9 +199,6 @@ This should not happen. .Xr hostname.if 5 , .Xr hostapd 8 , .Xr ifconfig 8 -.Pp -Ralink Technology: -.Lk http://www.ralinktech.com/ .Sh HISTORY The .Nm Index: run.4 === RCS file: /cvs/src/share/man/man4/run.4,v retrieving revision 1.47 diff -u -p -r1.47 run.4 --- run.4 6 Feb 2015 23:46:30 - 1.47 +++ run.4 14 Jun 2016 12:53:29 - @@ -214,9 +214,6 @@ This should not happen. .Xr usb 4 , .Xr hostname.if 5 , .Xr ifconfig 8 -.Pp -Ralink Technology: -.Lk http://www.ralinktech.com/ .Sh HISTORY The .Nm Index: ural.4 === RCS file: /cvs/src/share/man/man4/ural.4,v retrieving revision 1.21 diff -u -p -r1.21 ural.4 --- ural.4 7 Mar 2016 13:47:53 - 1.21 +++ ural.4 14 Jun 2016 12:53:29 - @@ -170,9 +170,6 @@ This should not happen. .Xr hostname.if 5 , .Xr hostapd 8 , .Xr ifconfig 8 -.Pp -Ralink Technology: -.Lk http://www.ralinktech.com/ .Sh HISTORY The .Nm
Re: IP_SENDSRCADDR [2/2] : add cmsg support
Vincent Grosswrites: > On Mon, 13 Jun 2016 19:57:15 +0200 > Jeremie Courreges-Anglas wrote: > >> Vincent Gross writes: >> >> > Le Mon, 13 Jun 2016 07:35:16 +0200, >> > j...@wxcvbn.org (Jeremie Courreges-Anglas) a écrit : >> > >> >> j...@wxcvbn.org (Jeremie Courreges-Anglas) writes: >> >> >> >> > cc'ing sthen since he also has interest in IP_SENDSRCADDR >> >> > >> >> > Jeremie Courreges-Anglas writes: >> >> > >> >> >> Vincent Gross writes: >> >> >> >> >> >>> This diff adds support for IP_SENDSRCADDR cmsg on UDP sockets. >> >> >>> As for udp6_output(), we check that the source address+port is >> >> >>> available only if inp_laddr != * >> >> >> >> >> >> Your last IP_SENDSRCADDR diff didn't have that check, I think >> >> >> it is harmful. If the socket is not bound then there is >> >> >> effectively no check performed by in_pcbaddrisavail(), thus I >> >> >> can use any random address. Other than this additional bypass >> >> >> check, your diff looks good to me. >> >> >> >> > [...] >> >> >> >> >> >> I haven't checked yet whether udp6_output is also affected. If >> >> >> you folks already know that it isn't, please let me know. >> >> >> >> The answer is "no", a few tests can't trigger the same problem. >> >> IIUC in6_selectsrc is responsible for rejection of non-local >> >> systems. Maybe we should take the same approach in netinet/, and >> >> extend in_selectsrc()? >> >> >> >> -- >> > >> > While validating source address inside selection functions is the >> > right direction, I don't think it would be a good thing to extend >> > further in_selectsrc() prototype. >> >> I find it nice to have all the source address selection in one place. >> Or do you have another refactoring in mind? >> > > Uh, turns out I was operating on obsolete data. I would actually be > easy to shrink in_selectsrc() prototype to > (int)(struct in_addr **, struct sockaddr_in *, struct in_pcb *). > But this looks like a layering violation to me ... What do you think ? I wouldn't mind adding an extra argument and staying closer to in6_selectsrc. > $ grep -r in_selectsrc sys/net* > sys/netinet/in_pcb.c > sys/netinet/in_pcb.h > sys/netinet/udp_usrreq.c > $ cd sys/netinet > $ grep -A2 in_selectsrc > error = in_selectsrc(, sin, inp->inp_moptions, > >inp_route, >inp_laddr, inp->inp_rtableid); > if (error) > in_selectsrc(struct in_addr **insrc, struct sockaddr_in *sin, > struct ip_moptions *mopts, struct route *ro, struct in_addr *laddr, > u_int rtableid) > $ grep -A2 in_selectsrc udp_usrreq.c > error = in_selectsrc(, sin, inp->inp_moptions, > >inp_route, >inp_laddr, inp->inp_rtableid); > if (error) > > >> > However it is easy to add a check while >> > processing cmsg. >> > >> > rev2 below. Ok ? >> >> Nits below, looks fine otherwise. The checks do detect addresses not >> configured on the system and overlaps of bound sockets. >> >> > >> > diff --git a/share/man/man4/ip.4 b/share/man/man4/ip.4 >> > index 111432b..154b0d1 100644 >> > --- a/share/man/man4/ip.4 >> > +++ b/share/man/man4/ip.4 >> > @@ -290,6 +290,27 @@ cmsg_len = CMSG_LEN(sizeof(u_int)) >> > cmsg_level = IPPROTO_IP >> > cmsg_type = IP_RECVRTABLE >> > .Ed >> > +.Pp >> > +If the >> > +.Dv IP_SENDSRCADDR >> > +option is passed to a >> > +.Xr sendmsg 2 >> > +call on a >> > +.Dv SOCK_DGRAM >> > +socket, the address passed along the >> > +.Vt cmsghdr >> > +structure will be used as the source of the outgoing >> > +.Tn UDP >> > +datagram. The >> > +.Vt cmsghdr >> > +fields for >> > +.Xr sendmsg 2 >> > +have the following values: >> >> I would have worded it "should have" here, since these are the values >> that the developer is supposed to pass. > > Yes, I have to find a better wording for this part. > >> >> > +.Bd -literal -offset indent >> > +cmsg_len = CMSG_LEN(sizeof(struct in_addr)) >> > +cmsg_level = IPPROTO_IP >> > +cmsg_type = IP_SENDSRCADDR >> > +.Ed >> > .Ss "Multicast Options" >> > .Tn IP >> > multicasting is supported only on >> > diff --git a/sys/netinet/in.h b/sys/netinet/in.h >> > index adb1b30..bf8c95d 100644 >> > --- a/sys/netinet/in.h >> > +++ b/sys/netinet/in.h >> > @@ -307,6 +307,7 @@ struct ip_opts { >> > #define IP_RECVRTABLE 35 /* bool; receive rdomain >> > w/dgram */ #define IP_IPSECFLOWINFO36 /* bool; IPsec flow >> > info for dgram */ #define IP_IPDEFTTL 37 /* int; >> > IP TTL system default */ +#define IP_SENDSRCADDR >> > 38 /* struct in_addr; source address to use */ >> > #define IP_RTABLE 0x1021 /* int; routing >> > table, see SO_RTABLE */ #define IP_DIVERTFL >> > 0x1022 /* int; divert direction flag opt */ diff --git >> > a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index >> > 1feea11..401ed7a 100644 --- a/sys/netinet/udp_usrreq.c >> > +++
merge urtwn(4) into rtwn(4)
This (unfortunately rather large) diff merges urtwn(4) into rtwn(4). Removes bloat caused by having 2 separate drivers: ic/rtwn.c | 448 ++ ic/rtwnvar.h | 38 pci/if_rtwn.c | 126 ++- usb/if_urtwn.c | 2378 + 4 files changed, 657 insertions(+), 2333 deletions(-) To preserve USB driver code paths I had to move some things around again and tweak the sc_ops interface slightly. The code could still be unified further. I've now merged most PCI and USB functions which only differ in register access patterns, but some function in the init code path remain unmerged. I'll deal with that later. No functional change is expected. Tested with: 8188CE (PCI) 8188CUS (USB) 8188EU (USB) 8192CU (USB) Index: ic/rtwn.c === RCS file: /cvs/src/sys/dev/ic/rtwn.c,v retrieving revision 1.8 diff -u -p -r1.8 rtwn.c --- ic/rtwn.c 5 Jun 2016 20:11:41 - 1.8 +++ ic/rtwn.c 14 Jun 2016 10:42:10 - @@ -56,9 +56,6 @@ #define RTWN_RIDX_COUNT28 -#define RTWN_LED_LINK 0 -#define RTWN_LED_DATA 1 - #ifdef RTWN_DEBUG #define DPRINTF(x) do { if (rtwn_debug) printf x; } while (0) #define DPRINTFN(n, x) do { if (rtwn_debug >= (n)) printf x; } while (0) @@ -92,20 +89,11 @@ int rtwn_r88e_ra_init(struct rtwn_softc int, uint32_t, int); void rtwn_tsf_sync_enable(struct rtwn_softc *); void rtwn_set_led(struct rtwn_softc *, int, int); -intrtwn_newstate(struct ieee80211com *, enum ieee80211_state, int); void rtwn_updateedca(struct ieee80211com *); -intrtwn_set_key(struct ieee80211com *, struct ieee80211_node *, - struct ieee80211_key *); -void rtwn_delete_key(struct ieee80211com *, - struct ieee80211_node *, struct ieee80211_key *); void rtwn_update_avgrssi(struct rtwn_softc *, int, int8_t); int8_t rtwn_r88e_get_rssi(struct rtwn_softc *, int, void *); -void rtwn_start(struct ifnet *); void rtwn_watchdog(struct ifnet *); -intrtwn_ioctl(struct ifnet *, u_long, caddr_t); -void rtwn_fw_reset(struct rtwn_softc *); void rtwn_r88e_fw_reset(struct rtwn_softc *); -intrtwn_fw_loadpage(struct rtwn_softc *, int, uint8_t *, int); intrtwn_load_firmware(struct rtwn_softc *); void rtwn_rf_init(struct rtwn_softc *); void rtwn_cam_init(struct rtwn_softc *); @@ -134,6 +122,8 @@ voidrtwn_iq_calib_write_results(struct void rtwn_iq_calib(struct rtwn_softc *); void rtwn_lc_calib(struct rtwn_softc *); void rtwn_temp_calib(struct rtwn_softc *); +void rtwn_enable_intr(struct rtwn_softc *); +void rtwn_disable_intr(struct rtwn_softc *); intrtwn_init(struct ifnet *); void rtwn_init_task(void *); void rtwn_stop(struct ifnet *); @@ -153,13 +143,10 @@ rtwn_attach(struct device *pdev, struct task_set(>init_task, rtwn_init_task, sc); + sc->chip = 0; error = rtwn_read_chipid(sc, chip_type); if (error != 0) { - printf("%s: unsupported test chip\n", sc->sc_pdev->dv_xname); - return (ENXIO); - } - if (sc->chip == 0) { - printf("%s: could not read chip ID\n", sc->sc_pdev->dv_xname); + printf("%s: unsupported chip\n", sc->sc_pdev->dv_xname); return (ENXIO); } @@ -177,13 +164,27 @@ rtwn_attach(struct device *pdev, struct else rtwn_read_rom(sc); - printf("%s: MAC/BB RTL%s, RF 6052 %dT%dR, address %s\n", - sc->sc_pdev->dv_xname, - (sc->chip & RTWN_CHIP_92C) ? "8192CE" : - (sc->chip & RTWN_CHIP_88E) ? "8188EE" : - "8188CE", - sc->ntxchains, sc->nrxchains, - ether_sprintf(ic->ic_myaddr)); + if (sc->chip & RTWN_CHIP_PCI) { + printf("%s: MAC/BB RTL%s, RF 6052 %dT%dR, address %s\n", + sc->sc_pdev->dv_xname, + (sc->chip & RTWN_CHIP_92C) ? "8192CE" : + (sc->chip & RTWN_CHIP_88E) ? "8188EE" : "8188CE", + sc->ntxchains, sc->nrxchains, + ether_sprintf(ic->ic_myaddr)); + } else if (sc->chip & RTWN_CHIP_USB) { + printf("%s: MAC/BB RTL%s, RF 6052 %dT%dR, address %s\n", + sc->sc_pdev->dv_xname, + (sc->chip & RTWN_CHIP_92C) ? "8192CU" : + (sc->chip & RTWN_CHIP_88E) ? "8188EU" : + (sc->board_type == R92C_BOARD_TYPE_HIGHPA) ? "8188RU" : + (sc->board_type == R92C_BOARD_TYPE_MINICARD) ? + "8188CE-VAU" : "8188CUS", + sc->ntxchains, sc->nrxchains, + ether_sprintf(ic->ic_myaddr)); + }
Re: disklabel(8): refactor readlabel() for a better placed pledge
On Tue, Jun 07, 2016 at 08:51:27AM +0200, Theo Buehler wrote: > On Sun, May 29, 2016 at 10:55:48PM +0200, Theo Buehler wrote: > > The readlabel() function in disklabel() does two things: it reads the > > disklabel from the device using a ioctl() and then parses it into some > > strings. We can't pledge beforehand since we have no way of knowing the > > file we process is actually a disk device. However, once the ioctl() > > succeeds, we know that we deal with a disk and we can do all further > > processing of the untrusted data under pledge. > > > > Thus, split up readlabel() into two functions and pledge between the > > two function calls. > > Here's an updated version of this diff that also takes care of two > further things: > > First, we need to call parse_autotable() before parselabel() because the > template will be used by the call to editor_allocspace() in parselabel(). > > Second, there still is a pledge problem: > > $ ktrace disklabel -w /dev/tty floppy576 > Abort trap (core dumped) Here's the third revision after jsg@'s fix went in. In the (op == WRITE && (argc == 2 || argc == 3)) path, makelabel() will not honor or need an autotable and the argument parsing will only allow -[fF] with -E or -R, so we can keep the simple pledge logic there. Index: disklabel.c === RCS file: /var/cvs/src/sbin/disklabel/disklabel.c,v retrieving revision 1.221 diff -u -p -r1.221 disklabel.c --- disklabel.c 13 Jun 2016 09:54:01 - 1.221 +++ disklabel.c 13 Jun 2016 10:12:46 - @@ -206,26 +206,36 @@ main(int argc, char *argv[]) if (f < 0) err(4, "%s", specname); - if (autotable != NULL) - parse_autotable(autotable); - - if (op != WRITE || aflag || dflag) + if (op != WRITE || aflag || dflag) { readlabel(f); - else if (argc == 2 || argc == 3) - makelabel(argv[1], argc == 3 ? argv[2] : NULL, ); - else - usage(); - if (op == EDIT || op == EDITOR || aflag) { - if (pledge("stdio rpath wpath cpath disklabel proc exec", NULL) == -1) - err(1, "pledge"); - } else if (fstabfile) { - if (pledge("stdio rpath wpath cpath disklabel", NULL) == -1) - err(1, "pledge"); - } else { + if (op == EDIT || op == EDITOR || aflag) { + if (pledge("stdio rpath wpath cpath disklabel proc " + "exec", NULL) == -1) + err(1, "pledge"); + } else if (fstabfile) { + if (pledge("stdio rpath wpath cpath disklabel", NULL) + == -1) + err(1, "pledge"); + } else { + if (pledge("stdio rpath wpath disklabel", NULL) == -1) + err(1, "pledge"); + } + + if (autotable != NULL) + parse_autotable(autotable); + parselabel(); + } else if (argc == 2 || argc == 3) { + /* Ensure f is a disk device before pledging. */ + if (ioctl(f, DIOCGDINFO, ) < 0) + err(4, "ioctl DIOCGDINFO"); + if (pledge("stdio rpath wpath disklabel", NULL) == -1) err(1, "pledge"); - } + + makelabel(argv[1], argc == 3 ? argv[2] : NULL, ); + } else + usage(); switch (op) { case EDIT: @@ -356,9 +366,6 @@ l_perror(char *s) void readlabel(int f) { - char *partname, *partduid; - struct fstab *fsent; - int i; if (cflag && ioctl(f, DIOCRLDINFO) < 0) err(4, "ioctl DIOCRLDINFO"); @@ -370,6 +377,14 @@ readlabel(int f) if (ioctl(f, DIOCGDINFO, ) < 0) err(4, "ioctl DIOCGDINFO"); } +} + +void +parselabel(void) +{ + char *partname, *partduid; + struct fstab *fsent; + int i; i = asprintf(, "/dev/%s%c", dkname, 'a'); if (i == -1) Index: extern.h === RCS file: /var/cvs/src/sbin/disklabel/extern.h,v retrieving revision 1.27 diff -u -p -r1.27 extern.h --- extern.h17 Oct 2015 13:27:08 - 1.27 +++ extern.h7 Jun 2016 06:18:50 - @@ -28,6 +28,7 @@ void display_partition(FILE *, struct di intduid_parse(struct disklabel *, char *); void readlabel(int); +void parselabel(void); struct disklabel *makebootarea(char *, struct disklabel *); inteditor(int); void editor_allocspace(struct disklabel *);
rt_addr & source address selection
Instead of dereferencing ``rt->rt_ifa'' to get the address, let's use ``rt_addr''. ok? Index: netinet/in_pcb.c === RCS file: /cvs/src/sys/netinet/in_pcb.c,v retrieving revision 1.206 diff -u -p -r1.206 in_pcb.c --- netinet/in_pcb.c19 Apr 2016 22:16:25 - 1.206 +++ netinet/in_pcb.c14 Jun 2016 09:57:25 - @@ -924,8 +924,10 @@ in_selectsrc(struct in_addr **insrc, str * If we found a route, use the address * corresponding to the outgoing interface. */ - if (ro->ro_rt != NULL) - ia = ifatoia(ro->ro_rt->rt_ifa); + if (ro->ro_rt != NULL) { + *insrc = (ro->ro_rt->rt_addr)->sin_addr; + return (0); + } if (ia == NULL) return (EADDRNOTAVAIL); Index: netinet6/in6_src.c === RCS file: /cvs/src/sys/netinet6/in6_src.c,v retrieving revision 1.72 diff -u -p -r1.72 in6_src.c --- netinet6/in6_src.c 5 Dec 2015 13:21:00 - 1.72 +++ netinet6/in6_src.c 14 Jun 2016 09:57:26 - @@ -257,8 +257,11 @@ in6_selectsrc(struct in6_addr **in6src, ia6 = in6_ifawithscope(ifp, dst, rtableid); if_put(ifp); } - if (ia6 == NULL) /* xxx scope error ?*/ - ia6 = ifatoia6(ro->ro_rt->rt_ifa); + if (ia6 == NULL) { /* xxx scope error ?*/ + *in6src = + (ro->ro_rt->rt_addr)->sin6_addr; + return (0); + } } if (ia6 == NULL) return (EHOSTUNREACH); /* no route */
Kill nd6_output()
It's no longer doing anything, so let's remove it, ok? Index: net/pf.c === RCS file: /cvs/src/sys/net/pf.c,v retrieving revision 1.975 diff -u -p -r1.975 pf.c --- net/pf.c7 Jun 2016 01:31:54 - 1.975 +++ net/pf.c8 Jun 2016 14:34:33 - @@ -5762,7 +5762,7 @@ pf_route6(struct mbuf **m, struct pf_rul ip6stat.ip6s_noroute++; goto bad; } - nd6_output(ifp, m0, dst, rt); + ifp->if_output(ifp, m0, sin6tosa(dst), rt); rtfree(rt); } else { icmp6_error(m0, ICMP6_PACKET_TOO_BIG, 0, ifp->if_mtu); Index: net/pf_norm.c === RCS file: /cvs/src/sys/net/pf_norm.c,v retrieving revision 1.186 diff -u -p -r1.186 pf_norm.c --- net/pf_norm.c 31 May 2016 07:35:36 - 1.186 +++ net/pf_norm.c 8 Jun 2016 14:34:07 - @@ -761,7 +761,7 @@ pf_refragment6(struct mbuf **m0, struct if (ifp == NULL) { ip6_forward(m, 0); } else if ((u_long)m->m_pkthdr.len <= ifp->if_mtu) { - nd6_output(ifp, m, dst, rt); + ifp->if_output(ifp, m, sin6tosa(dst), rt); } else { icmp6_error(m, ICMP6_PACKET_TOO_BIG, 0, ifp->if_mtu); Index: netinet6/ip6_forward.c === RCS file: /cvs/src/sys/netinet6/ip6_forward.c,v retrieving revision 1.90 diff -u -p -r1.90 ip6_forward.c --- netinet6/ip6_forward.c 2 May 2016 09:30:47 - 1.90 +++ netinet6/ip6_forward.c 8 Jun 2016 14:33:05 - @@ -332,7 +332,7 @@ reroute: goto out; } - error = nd6_output(ifp, m, dst, rt); + error = ifp->if_output(ifp, m, sin6tosa(dst), rt); if (error) { ip6stat.ip6s_cantforward++; } else { Index: netinet6/ip6_mroute.c === RCS file: /cvs/src/sys/netinet6/ip6_mroute.c,v retrieving revision 1.102 diff -u -p -r1.102 ip6_mroute.c --- netinet6/ip6_mroute.c 21 Jan 2016 11:23:48 - 1.102 +++ netinet6/ip6_mroute.c 8 Jun 2016 14:30:41 - @@ -1429,10 +1429,6 @@ phyint_send6(struct ip6_hdr *ip6, struct dst6->sin6_len = sizeof(struct sockaddr_in6); dst6->sin6_family = AF_INET6; dst6->sin6_addr = ip6->ip6_dst; - /* -* We just call if_output instead of nd6_output here, since -* we need no ND for a multicast forwarded packet...right? -*/ error = ifp->if_output(ifp, mb_copy, sin6tosa(_dst), NULL); } else { Index: netinet6/ip6_output.c === RCS file: /cvs/src/sys/netinet6/ip6_output.c,v retrieving revision 1.207 diff -u -p -r1.207 ip6_output.c --- netinet6/ip6_output.c 19 May 2016 11:34:40 - 1.207 +++ netinet6/ip6_output.c 8 Jun 2016 14:33:44 - @@ -692,7 +692,7 @@ reroute: * transmit packet without fragmentation */ if (dontfrag || (!alwaysfrag && tlen <= mtu)) { /* case 1-a and 2-a */ - error = nd6_output(ifp, m, dst, ro->ro_rt); + error = ifp->if_output(ifp, m, sin6tosa(dst), ro->ro_rt); goto done; } @@ -767,7 +767,8 @@ reroute: m->m_nextpkt = 0; if (error == 0) { ip6stat.ip6s_ofragments++; - error = nd6_output(ifp, m, dst, ro->ro_rt); + error = ifp->if_output(ifp, m, sin6tosa(dst), + ro->ro_rt); } else m_freem(m); } Index: netinet6/nd6.c === RCS file: /cvs/src/sys/netinet6/nd6.c,v retrieving revision 1.185 diff -u -p -r1.185 nd6.c --- netinet6/nd6.c 8 Jun 2016 12:57:58 - 1.185 +++ netinet6/nd6.c 8 Jun 2016 14:32:50 - @@ -1352,7 +1352,7 @@ fail: if (ln->ln_state == ND6_LLINFO_STALE) { /* -* XXX: since nd6_output() below will cause +* Since nd6_resove() in ifp->if_output() will cause * state transition to DELAY and reset the timer, * we must set the timer now, although it is actually * meaningless. @@ -1366,7 +1366,7 @@ fail: * we assume ifp is not a p2p here, so just * set the 2nd argument as the 1st one. */ -
Re: `rt_addr' or the end of `rt_ifa'
On 10/06/16(Fri) 09:43, Florian Obser wrote: > Any reason you are not adding the free(9) sizes in rtrequest(), too? Because ``rt->rt_addr'' might be NULL, so I can't dereference it to get the size of the allocated memory chunk.
Re: splraise for sparc
On Mon, Jun 13, 2016 at 11:29:13AM +1000, David Gwynne wrote: > this is kind of like the change i just made to sparc64. > > sparc created instances of inline functions for each of the splfoo > calls. this provides an splraise call and turns splfoo into a macro > to splraise(IPL_FOO). > > the spl code is quite long so i turned it into functions instead > of inlines. > > could someone test this? i haven't got a running (walking?) sparc > anymore. OK getting further with this diff[1]. Going to let it run overnight. but one more nit below: > Index: sparc/intr.c > === > RCS file: /cvs/src/sys/arch/sparc/sparc/intr.c,v > retrieving revision 1.43 > diff -u -p -r1.43 intr.c > --- sparc/intr.c 10 Dec 2015 19:48:04 - 1.43 > +++ sparc/intr.c 13 Jun 2016 01:27:01 - > @@ -544,3 +544,70 @@ splassert_check(int wantipl, const char > } > } > #endif > + > +int > +spl0(void) > +{ > + int psr, oldipl; > + > + /* > + * wrpsr xors two values: we choose old psr and old ipl here, > + * which gives us the same value as the old psr but with all > + * the old PIL bits turned off. > + */ > + __asm volatile("rd %%psr,%0" : "=r" (psr)); > + oldipl = psr & PSR_PIL; > + __asm volatile("wr %0,%1,%%psr" : : "r" (psr), "r" (oldipl)); > + > + /* > + * Three instructions must execute before we can depend > + * on the bits to be changed. > + */ > + __asm volatile("nop; nop; nop"); > + return (oldipl); > +} > + > +int > +splraise(int newipl) > +{ > + int psr, oldipl; > + > + newipl <<= 8; > + > + __asm volatile("rd %%psr,%0" : "=r" (psr)); > + oldipl = psr & PSR_PIL; > + if (newipl <= oldipl) > + return oldipl; > + > + psr &= ~oldipl; > + __asm volatile("wr %0,%1,%%psr" : : "r" (psr), "n" (newipl)); > + __asm volatile("nop; nop; nop"); > + __asm volatile("":::"memory"); /* protect from reordering */ \ leftover back-slash in above line :-) > + > + return (oldipl); > +} > + > +int > +splhigh(void) > +{ > + int psr, oldipl; > + > + __asm volatile("rd %%psr,%0" : "=r" (psr)); > + __asm volatile("wr %0,0,%%psr" : : "r" (psr | PSR_PIL)); > + __asm volatile("and %1,%2,%0; nop; nop" : "=r" (oldipl) : > + "r" (psr), "n" (PSR_PIL)); > + __asm volatile("":::"memory"); /* protect from reordering */ > + return (oldipl); > +} > + > +void > +splx(int newipl) > +{ > + int psr; > + > + __asm volatile("":::"memory"); /* protect from reordering */ > + __asm volatile("rd %%psr,%0" : "=r" (psr)); > + __asm volatile("wr %0,%1,%%psr" : : > + "r" (psr & ~PSR_PIL), "rn" (newipl)); > + __asm volatile("nop; nop; nop"); > +} > [1] My grep may be defective but I couldn't find anything for sparc using: -SPLHOLD(splausoft, IPL_AUSOFT) -SPLHOLD(splfdsoft, IPL_FDSOFT) -SPLHOLD(splaudio, IPL_AUHARD) so not included. Index: include/psl.h === RCS file: /cvs/obsd/src/sys/arch/sparc/include/psl.h,v retrieving revision 1.28 diff -u -p -u -p -r1.28 psl.h --- include/psl.h 29 Mar 2014 18:09:30 - 1.28 +++ include/psl.h 14 Jun 2016 07:51:32 - @@ -106,9 +106,6 @@ static __inline int getpsr(void); static __inline void setpsr(int); -static __inline int spl0(void); -static __inline int splhigh(void); -static __inline void splx(int); static __inline int getmid(void); /* @@ -142,28 +139,6 @@ setpsr(newpsr) __asm volatile("nop"); } -static __inline int -spl0() -{ - int psr, oldipl; - - /* -* wrpsr xors two values: we choose old psr and old ipl here, -* which gives us the same value as the old psr but with all -* the old PIL bits turned off. -*/ - __asm volatile("rd %%psr,%0" : "=r" (psr)); - oldipl = psr & PSR_PIL; - __asm volatile("wr %0,%1,%%psr" : : "r" (psr), "r" (oldipl)); - - /* -* Three instructions must execute before we can depend -* on the bits to be changed. -*/ - __asm volatile("nop; nop; nop"); - return (oldipl); -} - #ifdef DIAGNOSTIC /* * Although this function is implemented in MI code, it must be in this MD @@ -183,83 +158,24 @@ void splassert_check(int, const char *); #define splsoftassert(wantipl) do { /* nada */ } while (0) #endif -/* - * PIL 1 through 14 can use this macro. - * (spl0 and splhigh are special since they put all 0s or all 1s - * into the ipl field.) - */ -#defineSPL(name, newipl) \ -static __inline int name(void); \ -static __inline int name() \ -{ \ - int psr, oldipl; \ - __asm volatile("rd %%psr,%0" : "=r" (psr)); \ - oldipl = psr & PSR_PIL; \ - psr &= ~oldipl; \ - __asm volatile("wr %0,%1,%%psr" : : \ - "r" (psr), "n" ((newipl) << 8)); \ - __asm volatile("nop; nop; nop"); \ - __asm
Better alignment of `netstat -nr' for IPv6 addresses
`netstat -r' uses 34 columns for "Destination" and 30 for "Gateway". As these two columns have the same notation, these columns could also have the same length. 30 is too short for SLAAC addresses with longer interface names: % echo -n 'fe80:::::%vether99' | wc 0 1 34 Thus let's use 34 for both (WID_DST / WID_GW) columns. OK? Index: usr.bin/netstat/show.c === RCS file: /cvs/src/usr.bin/netstat/show.c,v retrieving revision 1.49 diff -u -p -U15 -r1.49 show.c --- usr.bin/netstat/show.c 11 Sep 2015 20:10:26 - 1.49 +++ usr.bin/netstat/show.c 14 Jun 2016 07:30:39 - @@ -156,31 +156,31 @@ p_rttables(int af, u_int tableid) rtm = (struct rt_msghdr *)next; if (rtm->rtm_version != RTM_VERSION) continue; sa = (struct sockaddr *)(next + rtm->rtm_hdrlen); p_rtentry(rtm); } } free(buf); } /* * column widths; each followed by one space * width of destination/gateway column * strlen("fe80:::::@gif0") == 30, strlen("/128") == 4 */ -#defineWID_GW(af) ((af) == AF_INET6 ? (nflag ? 30 : 18) : 18) +#defineWID_GW(af) ((af) == AF_INET6 ? (nflag ? 34 : 18) : 18) int WID_DST(int af) { if (nflag) switch (af) { case AF_MPLS: return 9; case AF_INET6: return 34; default: return 18; } else
Re: armv7 / efi failure on imx6q SabreLite
On Tue, Jun 14, 2016 at 08:29:09AM +0200, Matthieu Herrb wrote: > On Mon, Jun 13, 2016 at 12:43:59PM +0200, Mark Kettenis wrote: > > > Date: Sun, 12 Jun 2016 19:48:24 +0200 > > > From: Matthieu Herrb> > > > > > Hi, > > > > > > I'm trying to convert my SabreLite board to boot via efiboot, but > > > without success so far. > > > > > > I'm using the nitrogen6q u-boot from ports > > > > > > the boot loader is loaded and runs but it > > > fails to find the sata disk to load the kernel: > > > > > > => fatload sata 0:1 0x1080 efi/boot/bootarm.efi > > > reading efi/boot/bootarm.efi > > > 65556 bytes read in 9 ms (6.9 MiB/s) > > > => fatload sata 0:1 0x1300 imx6q-sabrelite.dtb > > > reading imx6q-sabrelite.dtb > > > 36834 bytes read in 8 ms (4.4 MiB/s) > > > => bootefi 0x1080 0x1300 > > > ## Starting EFI application at 0x1080 ... > > > Scanning disks on sata... > > > Scanning disks on usb... > > > Scanning disks on mmc... > > > MMC: no card present > > > MMC Device 2 not found > > > MMC Device 3 not found > > > Found 2 disks > > > > The firmware found 2 disks. Perhaps there is something wrong with > > efiboot boot device selection code. And unfortunately efiboot doesn't > > currently support selecting alternative boot devices. > > > > > >> OpenBSD/armv7 BOOTARM 0.1 > > > boot> > > > cannot open sd0a:/etc/random.seed: Device not configured > > > booting sd0a:/bsd: open sd0a:/bsd: Device not configured > > > failed(6). will try /bsd > > > boot> > > > > This suggests that we actually didn't find the boot device. So the > > problem might be that the boot device selection code in efiboot > > doesn't work for SATA devices. > > I played a bit with the u-boot sources, and rebuilt it with the patch > below to print the devname of the disks it found. I get: > > => bootefi 0x1080 0x1300 > ## Starting EFI application at 0x1080 ... > Scanning disks on sata... > Found 'sata0' > Scanning disks on usb... > Scanning disks on mmc... > Found 'mmc0' > MMC: no card present > MMC Device 2 not found > MMC Device 3 not found > Found 2 disks > » OpenBSD/armv7 BOOTARM 0.1 > boot> > booting sd0a:/bsd: open sd0a:/bsd: Device not configured > failed(6). will try /bsd > > so the sata0 disk is found. now I lost track of how this is passed to > the bootloader. Any hint ? I'd look at efi_diskprobe() in sys/arch/armv7/stand/efiboot/efiboot.c with http://www.uefi.org/sites/default/files/resources/UEFI%20Spec%202_6.pdf There is likely some way to skip the mmc disk (that isn't actually present?) > > --- lib/efi_loader/efi_disk.c~Mon May 16 16:40:32 2016 > +++ lib/efi_loader/efi_disk.c Sun Jun 12 17:22:22 2016 > @@ -242,6 +242,7 @@ > snprintf(devname, sizeof(devname), "%s%d", >cur_drvr->name, i); > efi_disk_add_dev(devname, cur_drvr, desc, i, 0); > + printf("Found '%s'\n", devname); > disks++; > > /* > > -- > Matthieu Herrb
Re: armv7 / efi failure on imx6q SabreLite
On Mon, Jun 13, 2016 at 01:18:12PM +1000, Jonathan Gray wrote: > On Sun, Jun 12, 2016 at 07:48:24PM +0200, Matthieu Herrb wrote: > > Hi, > > > > I'm trying to convert my SabreLite board to boot via efiboot, but > > without success so far. > > > > I'm using the nitrogen6q u-boot from ports > > > > the boot loader is loaded and runs but it > > fails to find the sata disk to load the kernel: > > > > => fatload sata 0:1 0x1080 efi/boot/bootarm.efi > > reading efi/boot/bootarm.efi > > 65556 bytes read in 9 ms (6.9 MiB/s) > > => fatload sata 0:1 0x1300 imx6q-sabrelite.dtb > > reading imx6q-sabrelite.dtb > > 36834 bytes read in 8 ms (4.4 MiB/s) > > => bootefi 0x1080 0x1300 > > ## Starting EFI application at 0x1080 ... > > Scanning disks on sata... > > Scanning disks on usb... > > Scanning disks on mmc... > > MMC: no card present > > MMC Device 2 not found > > MMC Device 3 not found > > Found 2 disks > > >> OpenBSD/armv7 BOOTARM 0.1 > > boot> > > cannot open sd0a:/etc/random.seed: Device not configured > > booting sd0a:/bsd: open sd0a:/bsd: Device not configured > > failed(6). will try /bsd > > boot> > > > > Any idea ? > > If you take the nitrogen miniroot and try start that off > an sd card does it work? > > Something along the lines of > > => run findfdt > => load mmc 0:1 ${fdt_addr_r} ${fdtfile} > => load mmc 0:1 ${kernel_addr_r} efi/boot/bootarm.efi > => bootefi ${kernel_addr_r} ${fdt_addr_r} No. The U-boot default environment for the nitrogen/sabrelite doesn't have a 'findfdt' command defined in it's default environment. After digging around in u-boot sources, I found that there is also a freescale/mx6qsabreauto board definition that may fit better. I haven't found time to build an try that version instead. > > Though ${fdt_addr_r}/${kernel_addr_r} may only be set in u-boot > configurations with "distro_bootcmd" (not utilite/sabrelite apparently). > ${loadaddr} is comparable to ${kernel_addr_r} and ${fdtaddr} is > comparable to ${fdt_addr_r}. ${fdtfile} is set by running 'findfdt', > though this also may not exist in some cases... > > When the U-boot target is built with "distro_bootcmd" it also scans > and loads bootarm.efi and dtbs, then runs the efi payload itself. > I found a fedora patch to convert cm-fx6/utilite not sure if there > is another around for nitrogen6x/sabrelite. Ok I need to dig more into u-boot internals... (see also my answer to Mark). > > > > > Below is a dmesg of a bsd.umg kernel booted the old way, with > > imx6q-sabrelite.dtb loaded > > > > OpenBSD 6.0-beta (GENERIC) #69: Sun Jun 5 14:21:01 CEST 2016 > > matth...@sabre.herrb.net:/usr/obj/GENERIC > > real mem = 1073741824 (1024MB) > > avail mem = 1044602880 (996MB) > > warning: no entropy supplied by boot loader > > mainbus0 at root: Freescale i.MX6 Quad SABRE Lite Board > > cpu0 at mainbus0: ARM Cortex A9 R2 rev 10 (ARMv7 core) > > cpu0: DC enabled IC enabled WB disabled EABT branch prediction enabled > > cpu0: 32KB(32b/l,4way) I-cache, 32KB(32b/l,4way) wr-back D-cache > > cortex0 at mainbus0 > > ampintc0 at cortex0 nirq 160 > > amptimer0 at cortex0: tick rate 396000 KHz > > armliicc0 at cortex0: rtl 7 waymask: 0x000f > > imx0 at mainbus0 > > imxccm0 at imx0: imx6 rev 1.2 CPU freq: 792 MHz > > imxiomuxc0 at imx0 > > imxdog0 at imx0 > > imxocotp0 at imx0 > > imxuart0 at imx0 console > > imxgpio0 at imx0 > > imxgpio1 at imx0 > > imxgpio2 at imx0 > > imxgpio3 at imx0 > > imxgpio4 at imx0 > > imxgpio5 at imx0 > > imxgpio6 at imx0 > > imxesdhc0 at imx0 > > imxesdhc0: 198 MHz base clock > > sdmmc0 at imxesdhc0: 4-bit, mmc high-speed, dma > > imxesdhc1 at imx0 > > imxesdhc1: 198 MHz base clock > > sdmmc1 at imxesdhc1: 4-bit, mmc high-speed, dma > > ehci0 at imx0 > > usb0 at ehci0: USB revision 2.0 > > uhub0 at usb0 "i.MX6 EHCI root hub" rev 2.00/1.00 addr 1 > > fec0 at imx0 > > fec0: address 00:19:b8:01:31:1c > > ukphy0 at fec0 phy 6: Generic IEEE 802.3u media interface, rev. 1: OUI > > 0x000885, model 0x0021 > > ahci0 at imx0 AHCI 1.3 > > ahci0: port 0: 3.0Gb/s > > scsibus0 at ahci0: 32 targets > > sd0 at scsibus0 targ 0 lun 0:SCSI3 0/direct > > fixed naa.50025388a00f2042 > > sd0: 114473MB, 512 bytes/sector, 234441648 sectors, thin > > simplebus0 at mainbus0: "soc" > > simplebus1 at simplebus0: "aips-bus" > > simplebus2 at simplebus1: "spba-bus" > > simplebus3 at simplebus1: "anatop" > > simplebus4 at simplebus0: "aips-bus" > > imxiic0 at simplebus4 > > iic0 at imxiic0 > > "fsl,sgtl5000" at iic0 addr 0xa not configured > > imxiic1 at simplebus4 > > iic1 at imxiic1 > > imxiic2 at simplebus4 > > iic2 at imxiic2 > > simplebus5 at mainbus0: "regulators" > > uhub1 at uhub0 port 1 "Standard Microsystems Hub" rev 2.00/b.b3 addr 2 > > vscsi0 at root > > scsibus1 at vscsi0: 256 targets > > softraid0 at root > > scsibus2 at softraid0: 256 targets > > boot device: lookup '' failed. > > root device: sd0a > > swap device (default sd0b): > > root