Re: Avoid memory leak in nfs_serv.c

2009-07-30 Thread David
On Thu, 2009-07-30 at 17:37 -0600, Theo de Raadt wrote:

> Follow the flow of the code:
> 
> again:
>   ...
> 
> if (cookies) {
> free((caddr_t)cookies, M_TEMP);
> cookies = NULL;
> }
> 
> A kernel double free.  I doubt it.
> 

Holy shit that was big to miss.
I'm going to sleep now :)



Re: Avoid memory leak in nfs_serv.c

2009-07-30 Thread Theo de Raadt
> >From NetBSD.
> 
> Index: nfs_serv.c
> ===
> RCS file: /cvs/src/sys/nfs/nfs_serv.c,v
> retrieving revision 1.77
> diff -u -p -r1.77 nfs_serv.c
> --- nfs_serv.c20 Jul 2009 16:49:40 -  1.77
> +++ nfs_serv.c30 Jul 2009 23:11:33 -
> @@ -2489,6 +2489,7 @@ again:
>   if (cpos >= cend || ncookies == 0) {
>   toff = off;
>   siz = fullsiz;
> + free(cookies, M_TEMP);
>   goto again;
>   }
>  
> @@ -2698,6 +2699,7 @@ again:
>   if (cpos >= cend || ncookies == 0) {
>   toff = off;
>   siz = fullsiz;
> + free(cookies, M_TEMP);
>   goto again;
>   }
> 

Follow the flow of the code:

again:
...

if (cookies) {
free((caddr_t)cookies, M_TEMP);
cookies = NULL;
}

A kernel double free.  I doubt it.



Avoid memory leak in nfs_serv.c

2009-07-30 Thread David
>From NetBSD.

Index: nfs_serv.c
===
RCS file: /cvs/src/sys/nfs/nfs_serv.c,v
retrieving revision 1.77
diff -u -p -r1.77 nfs_serv.c
--- nfs_serv.c  20 Jul 2009 16:49:40 -  1.77
+++ nfs_serv.c  30 Jul 2009 23:11:33 -
@@ -2489,6 +2489,7 @@ again:
if (cpos >= cend || ncookies == 0) {
toff = off;
siz = fullsiz;
+   free(cookies, M_TEMP);
goto again;
}
 
@@ -2698,6 +2699,7 @@ again:
if (cpos >= cend || ncookies == 0) {
toff = off;
siz = fullsiz;
+   free(cookies, M_TEMP);
goto again;
}



ripd split-horizon configuration diff

2009-07-30 Thread Eugene Yunak
This diff changes the configuration format of the split-horizon option
of ripd. This involves no behavior change, only configuration.
The old way was to give choice among three possible variants:
split-horizon default
split-horizon poisoned
split-horizon none
And the default behavior was "split-horizon none". This is kind of
confusing, imho, to have "default" which is not default ;)
And this "default" actually just means that split-horizon is on.

With this diff you have the same three options, but with other names:
split-horizon yes
split-horizon poisoned
split-horizon no
And the default is still "no", but there is no "default", which isn't,
actually, the default behavior.

btw, why is "no" default? most networks will only benefit from "yes" or
poison-reverse. It causes troubles only under certain and rare
conditions, but, you know, this conditions will make rip network
almost unusable anyway.


Index: parse.y
===
RCS file: /cvs/src/usr.sbin/ripd/parse.y,v
retrieving revision 1.24
diff -u -p -r1.24 parse.y
--- parse.y 31 Mar 2009 21:03:49 -  1.24
+++ parse.y 30 Jul 2009 22:34:31 -
@@ -157,9 +157,9 @@ conf_main   : SPLIT_HORIZON STRING {
/* clean flags first */
conf->options &= ~(OPT_SPLIT_HORIZON |
OPT_SPLIT_POISONED);
-   if (!strcmp($2, "none"))
+   if (!strcmp($2, "no"))
/* nothing */ ;
-   else if (!strcmp($2, "default"))
+   else if (!strcmp($2, "yes"))
conf->options |= OPT_SPLIT_HORIZON;
else if (!strcmp($2, "poisoned"))
conf->options |= OPT_SPLIT_POISONED;
Index: printconf.c
===
RCS file: /cvs/src/usr.sbin/ripd/printconf.c,v
retrieving revision 1.5
diff -u -p -r1.5 printconf.c
--- printconf.c 24 Mar 2009 19:26:13 -  1.5
+++ printconf.c 30 Jul 2009 22:34:31 -
@@ -44,11 +44,11 @@ print_mainconf(struct ripd_conf *conf)
print_redistribute(conf);

if (conf->options & OPT_SPLIT_HORIZON)
-   printf("split-horizon default\n");
+   printf("split-horizon yes\n");
else if (conf->options & OPT_SPLIT_POISONED)
printf("split-horizon poisoned\n");
else
-   printf("split-horizon none\n");
+   printf("split-horizon no\n");

if (conf->options & OPT_TRIGGERED_UPDATES)
printf("triggered-updates yes\n");
Index: ripd.conf.5
===
RCS file: /cvs/src/usr.sbin/ripd/ripd.conf.5,v
retrieving revision 1.9
diff -u -p -r1.9 ripd.conf.5
--- ripd.conf.5 17 Dec 2008 15:47:30 -  1.9
+++ ripd.conf.5 30 Jul 2009 22:34:31 -
@@ -122,12 +122,12 @@ will force the route to be not announced
 .It Xo
 .Ic split-horizon
 .Sm off
-.Po Ic default Ns \&| Ns Ic poisoned Ns \&| Ns
-.Ic none Pc
+.Po Ic yes Ns \&| Ns Ic poisoned Ns \&| Ns
+.Ic no Pc
 .Sm on
 .Xc
 If set to
-.Ic default ,
+.Ic yes ,
 do not redistribute routes to the interface from which they were learned.
 If set to
 .Ic poisoned ,
@@ -135,7 +135,7 @@ redistribute routes to the interface fro
 forcing the metric to infinity.
 Both these behaviours can resolve routing loops when a router goes down.
 The default is
-.Ic none .
+.Ic no .
 .Pp
 .It Xo
 .Ic triggered-updates



-- 
The best the little guy can do is what
the little guy does right



tftp-proxy; remove unused function

2009-07-30 Thread Stuart Henderson
ok?

Index: filter.c
===
RCS file: /cvs/src/libexec/tftp-proxy/filter.c,v
retrieving revision 1.2
diff -u -p -r1.2 filter.c
--- filter.c23 Jun 2007 15:51:21 -  1.2
+++ filter.c30 Jul 2009 19:47:45 -
@@ -78,40 +78,6 @@ add_filter(u_int32_t id, u_int8_t dir, s
 }
 
 int
-add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst,
-u_int16_t d_port, struct sockaddr *nat, u_int16_t nat_range_low,
-u_int16_t nat_range_high, u_int8_t proto)
-{
-   if (!src || !dst || !d_port || !nat || !nat_range_low || !proto ||
-   (src->sa_family != nat->sa_family)) {
-   errno = EINVAL;
-   return (-1);
-   }
-
-   if (prepare_rule(id, PF_RULESET_NAT, src, dst, d_port, proto) == -1)
-   return (-1);
-
-   if (nat->sa_family == AF_INET) {
-   memcpy(&pfp.addr.addr.v.a.addr.v4,
-   &satosin(nat)->sin_addr.s_addr, 4);
-   memset(&pfp.addr.addr.v.a.mask.addr8, 255, 4);
-   } else {
-   memcpy(&pfp.addr.addr.v.a.addr.v6,
-   &satosin6(nat)->sin6_addr.s6_addr, 16);
-   memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16);
-   }
-   if (ioctl(dev, DIOCADDADDR, &pfp) == -1)
-   return (-1);
-
-   pfr.rule.rpool.proxy_port[0] = nat_range_low;
-   pfr.rule.rpool.proxy_port[1] = nat_range_high;
-   if (ioctl(dev, DIOCADDRULE, &pfr) == -1)
-   return (-1);
-
-   return (0);
-}
-
-int
 add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst,
 u_int16_t d_port, struct sockaddr *rdr, u_int16_t rdr_port, u_int8_t proto)
 {
Index: filter.h
===
RCS file: /cvs/src/libexec/tftp-proxy/filter.h,v
retrieving revision 1.1
diff -u -p -r1.1 filter.h
--- filter.h28 Dec 2005 19:07:07 -  1.1
+++ filter.h30 Jul 2009 19:47:45 -
@@ -20,8 +20,6 @@
 
 int add_filter(u_int32_t, u_int8_t, struct sockaddr *, struct sockaddr *,
 u_int16_t, u_int8_t);
-int add_nat(u_int32_t, struct sockaddr *, struct sockaddr *, u_int16_t,
-struct sockaddr *, u_int16_t, u_int16_t, u_int8_t);
 int add_rdr(u_int32_t, struct sockaddr *, struct sockaddr *, u_int16_t,
 struct sockaddr *, u_int16_t, u_int8_t);
 int do_commit(void);



Re: 4.6-beta acpicpu0 panic

2009-07-30 Thread frantisek holop
hmm, on Thu, Jul 30, 2009 at 11:05:14AM -0500, Marco Peereboom said that
> But is that an interrupt issue or does the disk simply suck?

the interrupt issues i reported about this machine are gone (atm).
interrupts in top showed normal level as far as i can tell.
this disk is of course the highest udma breed (actually it is
ahci, but last time i checked it wasn't found by the kernel)
but if it's doing PIO, doing anything that touches the disk
makes everything go slow-mo.

just send me any commands you want me to execute and collect
the output...

-f
-- 
if people listened to themselves more often, they would shut up.



Re: 4.6-beta acpicpu0 panic

2009-07-30 Thread Marco Peereboom
But is that an interrupt issue or does the disk simply suck?

On Thu, Jul 30, 2009 at 05:27:25PM +0200, frantisek holop wrote:
> hmm, on Thu, Jul 30, 2009 at 09:25:49AM -0500, Marco Peereboom said that
> > Performance ok/better with the fancy pci routing tables enabled?
> 
> hard to say as the disk is pig slow.  feels like the 486 times..
> 
> > > pciide1 at pci0 dev 9 function 0 "NVIDIA MCP77 AHCI" rev 0xa2: DMA 
> > > (unsupported), channel 0 wired to native-PCI, channel 1 wired to 
> > > native-PCI
> > > pciide1: using apic 0 int 10 (irq 10) for native-PCI interrupt
> > > wd0 at pciide1 channel 0 drive 0: 
> > > wd0: 16-sector PIO, LBA48, 305245MB, 625142448 sectors
> 
> -f
> 
> > On Thu, Jul 30, 2009 at 03:52:05PM +0200, frantisek holop wrote:
> > > hmm, on Wed, Jul 29, 2009 at 08:50:14PM -0500, Marco Peereboom said that
> > > > did you try disabling acpicpu only?
> > > 
> > > i have tried this and here is the dmesg:
> > > (it is also accessible under obiit.org/f/dmesg.bsd.sp.acpi)
> > > 
> > > OpenBSD 4.6-current (GENERIC) #85: Mon Jul 27 19:10:16 MDT 2009
> > > dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
> > > cpu0: AMD Turion(tm) X2 Ultra Dual-Core Mobile ZM-80 ("AuthenticAMD" 
> > > 686-class, 1024KB L2 cache) 2.11 GHz
> > > cpu0: 
> > > FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,CX16
> > > real mem  = 3217108992 (3068MB)
> > > avail mem = 311880 (2972MB)
> > > User Kernel Config
> > > UKC> disable acpicpu
> > > 471 acpicpu* disabled
> > > UKC> quit
> > > Continuing...
> > > mainbus0 at root
> > > bios0 at mainbus0: AT/286+ BIOS, date 02/08/08, SMBIOS rev. 2.4 @ 
> > > 0xbfb51018 (53 entries)
> > > bios0: vendor American Megatrends Inc. version "E1652NMS VER.106" date 
> > > 12/26/2008
> > > bios0: Micro-Star International GX-630
> > > acpi0 at bios0: rev 2
> > > acpi0: tables DSDT FACP APIC SSDT MCFG SLIC
> > > acpi0: wakeup devices PS2K(S4) PS2M(S4) NSMB(S4) USB0(S4) USB2(S3) 
> > > USB1(S4) USB4(S3) NMAC(S5) HDAC(S4) POP2(S4) BR12(S4) BR13(S4) BR14(S4) 
> > > BR16(S4) SLPB(S4) PWRB(S4)
> > > acpitimer0 at acpi0: 3579545 Hz, 24 bits
> > > acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
> > > cpu0 at mainbus0: apid 0 (boot processor)
> > > cpu0: apic clock running at 200MHz
> > > cpu at mainbus0: not configured
> > > ioapic0 at mainbus0: apid 0 pa 0xfec0, version 11, 24 pins
> > > acpiprt0 at acpi0: bus 0 (PCI0)
> > > acpiprt1 at acpi0: bus 3 (BR12)
> > > acpiprt2 at acpi0: bus 4 (BR13)
> > > acpiprt3 at acpi0: bus 5 (BR14)
> > > acpiprt4 at acpi0: bus 8 (BR16)
> > > acpiec0 at acpi0
> > > acpicpu at acpi0 not configured
> > > acpitz0 at acpi0: critical temperature 100 degC
> > > acpiac0 at acpi0: AC unit online
> > > acpibat0 at acpi0: BAT1 model "MS-1221
> > > " serial 
> > >  type LION
> > >  oem "MSI Corp.
> > > "
> > > acpibtn0 at acpi0: LID0
> > > acpibtn1 at acpi0: SLPB
> > > acpibtn2 at acpi0: PWRB
> > > acpivideo0 at acpi0: VGA_
> > > acpivout0 at acpivideo0: CRT_
> > > acpivout1 at acpivideo0: LCD_
> > > acpivout2 at acpivideo0: HDMI
> > > bios0: ROM list: 0xc/0xe200 0xce800/0x1800
> > > pci0 at mainbus0 bus 0: configuration mode 1 (bios)
> > > "NVIDIA MCP77 Memory" rev 0xa2 at pci0 dev 0 function 0 not configured
> > > pcib0 at pci0 dev 1 function 0 "NVIDIA MCP77 ISA" rev 0xa2
> > > nviic0 at pci0 dev 1 function 1 "NVIDIA MCP77 SMBus" rev 0xa1
> > > iic0 at nviic0
> > > iic1 at nviic0
> > > spdmem0 at iic1 addr 0x50: 2GB DDR2 SDRAM non-parity PC2-6400CL5 SO-DIMM
> > > spdmem1 at iic1 addr 0x51: 2GB DDR2 SDRAM non-parity PC2-6400CL5 SO-DIMM
> > > "NVIDIA MCP77 Co-processor" rev 0xa2 at pci0 dev 1 function 3 not 
> > > configured
> > > "NVIDIA MCP77 Memory" rev 0xa1 at pci0 dev 1 function 4 not configured
> > > ohci0 at pci0 dev 2 function 0 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 7 
> > > (irq 7), version 1.0, legacy support
> > > ehci0 at pci0 dev 2 function 1 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 11 
> > > (irq 11)
> > > usb0 at ehci0: USB revision 2.0
> > > uhub0 at usb0 "NVIDIA EHCI root hub" rev 2.00/1.00 addr 1
> > > ohci1 at pci0 dev 4 function 0 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 5 
> > > (irq 5), version 1.0, legacy support
> > > ehci1 at pci0 dev 4 function 1 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 7 
> > > (irq 7)
> > > usb1 at ehci1: USB revision 2.0
> > > uhub1 at usb1 "NVIDIA EHCI root hub" rev 2.00/1.00 addr 1
> > > pciide0 at pci0 dev 6 function 0 "NVIDIA MCP77 IDE" rev 0xa1: DMA, 
> > > channel 0 configured to compatibility, channel 1 configured to 
> > > compatibility
> > > pciide0: channel 0 ignored (disabled)
> > > pciide0: channel 1 ignored (disabled)
> > > azalia0 at pci0 dev 7 function 0 "NVIDIA MCP77 HD Audio" rev 0xa1: apic 0 
> > > int 11 (irq 11)
> > > azalia0: codecs: Realtek ALC888, Motorola/0x3055, NVIDIA/0x0006, using 
> > > Realtek ALC888
> > > audio0 at azalia0
> > > ppb0 at pci0 dev 8 function 0 "NVIDIA MCP77 PCI" rev 0xa1
> > > pci1 at ppb0 bus 1
>

Re: 4.6-beta acpicpu0 panic

2009-07-30 Thread frantisek holop
hmm, on Thu, Jul 30, 2009 at 09:25:49AM -0500, Marco Peereboom said that
> Performance ok/better with the fancy pci routing tables enabled?

hard to say as the disk is pig slow.  feels like the 486 times..

> > pciide1 at pci0 dev 9 function 0 "NVIDIA MCP77 AHCI" rev 0xa2: DMA 
> > (unsupported), channel 0 wired to native-PCI, channel 1 wired to native-PCI
> > pciide1: using apic 0 int 10 (irq 10) for native-PCI interrupt
> > wd0 at pciide1 channel 0 drive 0: 
> > wd0: 16-sector PIO, LBA48, 305245MB, 625142448 sectors

-f

> On Thu, Jul 30, 2009 at 03:52:05PM +0200, frantisek holop wrote:
> > hmm, on Wed, Jul 29, 2009 at 08:50:14PM -0500, Marco Peereboom said that
> > > did you try disabling acpicpu only?
> > 
> > i have tried this and here is the dmesg:
> > (it is also accessible under obiit.org/f/dmesg.bsd.sp.acpi)
> > 
> > OpenBSD 4.6-current (GENERIC) #85: Mon Jul 27 19:10:16 MDT 2009
> > dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
> > cpu0: AMD Turion(tm) X2 Ultra Dual-Core Mobile ZM-80 ("AuthenticAMD" 
> > 686-class, 1024KB L2 cache) 2.11 GHz
> > cpu0: 
> > FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,CX16
> > real mem  = 3217108992 (3068MB)
> > avail mem = 311880 (2972MB)
> > User Kernel Config
> > UKC> disable acpicpu
> > 471 acpicpu* disabled
> > UKC> quit
> > Continuing...
> > mainbus0 at root
> > bios0 at mainbus0: AT/286+ BIOS, date 02/08/08, SMBIOS rev. 2.4 @ 
> > 0xbfb51018 (53 entries)
> > bios0: vendor American Megatrends Inc. version "E1652NMS VER.106" date 
> > 12/26/2008
> > bios0: Micro-Star International GX-630
> > acpi0 at bios0: rev 2
> > acpi0: tables DSDT FACP APIC SSDT MCFG SLIC
> > acpi0: wakeup devices PS2K(S4) PS2M(S4) NSMB(S4) USB0(S4) USB2(S3) USB1(S4) 
> > USB4(S3) NMAC(S5) HDAC(S4) POP2(S4) BR12(S4) BR13(S4) BR14(S4) BR16(S4) 
> > SLPB(S4) PWRB(S4)
> > acpitimer0 at acpi0: 3579545 Hz, 24 bits
> > acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
> > cpu0 at mainbus0: apid 0 (boot processor)
> > cpu0: apic clock running at 200MHz
> > cpu at mainbus0: not configured
> > ioapic0 at mainbus0: apid 0 pa 0xfec0, version 11, 24 pins
> > acpiprt0 at acpi0: bus 0 (PCI0)
> > acpiprt1 at acpi0: bus 3 (BR12)
> > acpiprt2 at acpi0: bus 4 (BR13)
> > acpiprt3 at acpi0: bus 5 (BR14)
> > acpiprt4 at acpi0: bus 8 (BR16)
> > acpiec0 at acpi0
> > acpicpu at acpi0 not configured
> > acpitz0 at acpi0: critical temperature 100 degC
> > acpiac0 at acpi0: AC unit online
> > acpibat0 at acpi0: BAT1 model "MS-1221
> > " serial 
> >  type LION
> >  oem "MSI Corp.
> > "
> > acpibtn0 at acpi0: LID0
> > acpibtn1 at acpi0: SLPB
> > acpibtn2 at acpi0: PWRB
> > acpivideo0 at acpi0: VGA_
> > acpivout0 at acpivideo0: CRT_
> > acpivout1 at acpivideo0: LCD_
> > acpivout2 at acpivideo0: HDMI
> > bios0: ROM list: 0xc/0xe200 0xce800/0x1800
> > pci0 at mainbus0 bus 0: configuration mode 1 (bios)
> > "NVIDIA MCP77 Memory" rev 0xa2 at pci0 dev 0 function 0 not configured
> > pcib0 at pci0 dev 1 function 0 "NVIDIA MCP77 ISA" rev 0xa2
> > nviic0 at pci0 dev 1 function 1 "NVIDIA MCP77 SMBus" rev 0xa1
> > iic0 at nviic0
> > iic1 at nviic0
> > spdmem0 at iic1 addr 0x50: 2GB DDR2 SDRAM non-parity PC2-6400CL5 SO-DIMM
> > spdmem1 at iic1 addr 0x51: 2GB DDR2 SDRAM non-parity PC2-6400CL5 SO-DIMM
> > "NVIDIA MCP77 Co-processor" rev 0xa2 at pci0 dev 1 function 3 not configured
> > "NVIDIA MCP77 Memory" rev 0xa1 at pci0 dev 1 function 4 not configured
> > ohci0 at pci0 dev 2 function 0 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 7 
> > (irq 7), version 1.0, legacy support
> > ehci0 at pci0 dev 2 function 1 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 11 
> > (irq 11)
> > usb0 at ehci0: USB revision 2.0
> > uhub0 at usb0 "NVIDIA EHCI root hub" rev 2.00/1.00 addr 1
> > ohci1 at pci0 dev 4 function 0 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 5 
> > (irq 5), version 1.0, legacy support
> > ehci1 at pci0 dev 4 function 1 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 7 
> > (irq 7)
> > usb1 at ehci1: USB revision 2.0
> > uhub1 at usb1 "NVIDIA EHCI root hub" rev 2.00/1.00 addr 1
> > pciide0 at pci0 dev 6 function 0 "NVIDIA MCP77 IDE" rev 0xa1: DMA, channel 
> > 0 configured to compatibility, channel 1 configured to compatibility
> > pciide0: channel 0 ignored (disabled)
> > pciide0: channel 1 ignored (disabled)
> > azalia0 at pci0 dev 7 function 0 "NVIDIA MCP77 HD Audio" rev 0xa1: apic 0 
> > int 11 (irq 11)
> > azalia0: codecs: Realtek ALC888, Motorola/0x3055, NVIDIA/0x0006, using 
> > Realtek ALC888
> > audio0 at azalia0
> > ppb0 at pci0 dev 8 function 0 "NVIDIA MCP77 PCI" rev 0xa1
> > pci1 at ppb0 bus 1
> > pciide1 at pci0 dev 9 function 0 "NVIDIA MCP77 AHCI" rev 0xa2: DMA 
> > (unsupported), channel 0 wired to native-PCI, channel 1 wired to native-PCI
> > pciide1: using apic 0 int 10 (irq 10) for native-PCI interrupt
> > wd0 at pciide1 channel 0 drive 0: 
> > wd0: 16-sector PIO, LBA48, 305245MB, 625142448 sectors
> > atapiscsi0 at pciide1 channel 0 drive 

print-tftp.c missing " in error printing

2009-07-30 Thread Stuart Henderson
this changes output from

15:48:38.877024 10.15.5.75.53496 > 10.15.5.2.69: 28 ERROR EUNDEF Interrupted 
system call"

to

15:48:38.877024 10.15.5.75.53496 > 10.15.5.2.69: 28 ERROR EUNDEF "Interrupted 
system call"

ok?

Index: print-tftp.c
===
RCS file: /cvs/src/usr.sbin/tcpdump/print-tftp.c,v
retrieving revision 1.8
diff -u -p -r1.8 print-tftp.c
--- print-tftp.c7 Oct 2007 16:41:05 -   1.8
+++ print-tftp.c30 Jul 2009 14:48:08 -
@@ -126,6 +126,7 @@ tftp_print(register const u_char *bp, u_
printf(" %s ", tok2str(err2str, "tftp-err-#%d \"",
   ntohs(tp->th_code)));
/* Print error message string */
+   putchar('"');
i = fn_print((const u_char *)tp->th_data, snapend);
putchar('"');
if (i)



Re: 4.6-beta acpicpu0 panic

2009-07-30 Thread Marco Peereboom
Performance ok/better with the fancy pci routing tables enabled?

On Thu, Jul 30, 2009 at 03:52:05PM +0200, frantisek holop wrote:
> hmm, on Wed, Jul 29, 2009 at 08:50:14PM -0500, Marco Peereboom said that
> > did you try disabling acpicpu only?
> 
> i have tried this and here is the dmesg:
> (it is also accessible under obiit.org/f/dmesg.bsd.sp.acpi)
> 
> OpenBSD 4.6-current (GENERIC) #85: Mon Jul 27 19:10:16 MDT 2009
> dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
> cpu0: AMD Turion(tm) X2 Ultra Dual-Core Mobile ZM-80 ("AuthenticAMD" 
> 686-class, 1024KB L2 cache) 2.11 GHz
> cpu0: 
> FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,CX16
> real mem  = 3217108992 (3068MB)
> avail mem = 311880 (2972MB)
> User Kernel Config
> UKC> disable acpicpu
> 471 acpicpu* disabled
> UKC> quit
> Continuing...
> mainbus0 at root
> bios0 at mainbus0: AT/286+ BIOS, date 02/08/08, SMBIOS rev. 2.4 @ 0xbfb51018 
> (53 entries)
> bios0: vendor American Megatrends Inc. version "E1652NMS VER.106" date 
> 12/26/2008
> bios0: Micro-Star International GX-630
> acpi0 at bios0: rev 2
> acpi0: tables DSDT FACP APIC SSDT MCFG SLIC
> acpi0: wakeup devices PS2K(S4) PS2M(S4) NSMB(S4) USB0(S4) USB2(S3) USB1(S4) 
> USB4(S3) NMAC(S5) HDAC(S4) POP2(S4) BR12(S4) BR13(S4) BR14(S4) BR16(S4) 
> SLPB(S4) PWRB(S4)
> acpitimer0 at acpi0: 3579545 Hz, 24 bits
> acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
> cpu0 at mainbus0: apid 0 (boot processor)
> cpu0: apic clock running at 200MHz
> cpu at mainbus0: not configured
> ioapic0 at mainbus0: apid 0 pa 0xfec0, version 11, 24 pins
> acpiprt0 at acpi0: bus 0 (PCI0)
> acpiprt1 at acpi0: bus 3 (BR12)
> acpiprt2 at acpi0: bus 4 (BR13)
> acpiprt3 at acpi0: bus 5 (BR14)
> acpiprt4 at acpi0: bus 8 (BR16)
> acpiec0 at acpi0
> acpicpu at acpi0 not configured
> acpitz0 at acpi0: critical temperature 100 degC
> acpiac0 at acpi0: AC unit online
> acpibat0 at acpi0: BAT1 model "MS-1221
> " serial 
>  type LION
>  oem "MSI Corp.
> "
> acpibtn0 at acpi0: LID0
> acpibtn1 at acpi0: SLPB
> acpibtn2 at acpi0: PWRB
> acpivideo0 at acpi0: VGA_
> acpivout0 at acpivideo0: CRT_
> acpivout1 at acpivideo0: LCD_
> acpivout2 at acpivideo0: HDMI
> bios0: ROM list: 0xc/0xe200 0xce800/0x1800
> pci0 at mainbus0 bus 0: configuration mode 1 (bios)
> "NVIDIA MCP77 Memory" rev 0xa2 at pci0 dev 0 function 0 not configured
> pcib0 at pci0 dev 1 function 0 "NVIDIA MCP77 ISA" rev 0xa2
> nviic0 at pci0 dev 1 function 1 "NVIDIA MCP77 SMBus" rev 0xa1
> iic0 at nviic0
> iic1 at nviic0
> spdmem0 at iic1 addr 0x50: 2GB DDR2 SDRAM non-parity PC2-6400CL5 SO-DIMM
> spdmem1 at iic1 addr 0x51: 2GB DDR2 SDRAM non-parity PC2-6400CL5 SO-DIMM
> "NVIDIA MCP77 Co-processor" rev 0xa2 at pci0 dev 1 function 3 not configured
> "NVIDIA MCP77 Memory" rev 0xa1 at pci0 dev 1 function 4 not configured
> ohci0 at pci0 dev 2 function 0 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 7 (irq 
> 7), version 1.0, legacy support
> ehci0 at pci0 dev 2 function 1 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 11 
> (irq 11)
> usb0 at ehci0: USB revision 2.0
> uhub0 at usb0 "NVIDIA EHCI root hub" rev 2.00/1.00 addr 1
> ohci1 at pci0 dev 4 function 0 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 5 (irq 
> 5), version 1.0, legacy support
> ehci1 at pci0 dev 4 function 1 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 7 (irq 
> 7)
> usb1 at ehci1: USB revision 2.0
> uhub1 at usb1 "NVIDIA EHCI root hub" rev 2.00/1.00 addr 1
> pciide0 at pci0 dev 6 function 0 "NVIDIA MCP77 IDE" rev 0xa1: DMA, channel 0 
> configured to compatibility, channel 1 configured to compatibility
> pciide0: channel 0 ignored (disabled)
> pciide0: channel 1 ignored (disabled)
> azalia0 at pci0 dev 7 function 0 "NVIDIA MCP77 HD Audio" rev 0xa1: apic 0 int 
> 11 (irq 11)
> azalia0: codecs: Realtek ALC888, Motorola/0x3055, NVIDIA/0x0006, using 
> Realtek ALC888
> audio0 at azalia0
> ppb0 at pci0 dev 8 function 0 "NVIDIA MCP77 PCI" rev 0xa1
> pci1 at ppb0 bus 1
> pciide1 at pci0 dev 9 function 0 "NVIDIA MCP77 AHCI" rev 0xa2: DMA 
> (unsupported), channel 0 wired to native-PCI, channel 1 wired to native-PCI
> pciide1: using apic 0 int 10 (irq 10) for native-PCI interrupt
> wd0 at pciide1 channel 0 drive 0: 
> wd0: 16-sector PIO, LBA48, 305245MB, 625142448 sectors
> atapiscsi0 at pciide1 channel 0 drive 1
> scsibus0 at atapiscsi0: 2 targets
> cd0 at scsibus0 targ 0 lun 0:  ATAPI 5/cdrom 
> removable
> pciide1: channel 1 ignored (not responding; disabled or no drives?)
> nfe0 at pci0 dev 10 function 0 "NVIDIA MCP77 LAN" rev 0xa2: apic 0 int 5 (irq 
> 5), address 00:21:85:55:af:d3
> eephy0 at nfe0 phy 1: 88E1116 Gigabit PHY, rev. 1
> ppb1 at pci0 dev 16 function 0 "NVIDIA MCP77 PCIE" rev 0xa1: apic 0 int 7 
> (irq 7)
> pci2 at ppb1 bus 2
> vga1 at pci2 dev 0 function 0 vendor "NVIDIA", unknown product 0x0649 rev 0xa1
> wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
> wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
> ppb2 at pci0 dev 1

Re: 4.6-beta acpicpu0 panic

2009-07-30 Thread frantisek holop
hmm, on Wed, Jul 29, 2009 at 08:50:14PM -0500, Marco Peereboom said that
> did you try disabling acpicpu only?

i have tried this and here is the dmesg:
(it is also accessible under obiit.org/f/dmesg.bsd.sp.acpi)

OpenBSD 4.6-current (GENERIC) #85: Mon Jul 27 19:10:16 MDT 2009
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: AMD Turion(tm) X2 Ultra Dual-Core Mobile ZM-80 ("AuthenticAMD" 686-class, 
1024KB L2 cache) 2.11 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,CX16
real mem  = 3217108992 (3068MB)
avail mem = 311880 (2972MB)
User Kernel Config
UKC> disable acpicpu
471 acpicpu* disabled
UKC> quit
Continuing...
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 02/08/08, SMBIOS rev. 2.4 @ 0xbfb51018 
(53 entries)
bios0: vendor American Megatrends Inc. version "E1652NMS VER.106" date 
12/26/2008
bios0: Micro-Star International GX-630
acpi0 at bios0: rev 2
acpi0: tables DSDT FACP APIC SSDT MCFG SLIC
acpi0: wakeup devices PS2K(S4) PS2M(S4) NSMB(S4) USB0(S4) USB2(S3) USB1(S4) 
USB4(S3) NMAC(S5) HDAC(S4) POP2(S4) BR12(S4) BR13(S4) BR14(S4) BR16(S4) 
SLPB(S4) PWRB(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 200MHz
cpu at mainbus0: not configured
ioapic0 at mainbus0: apid 0 pa 0xfec0, version 11, 24 pins
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 3 (BR12)
acpiprt2 at acpi0: bus 4 (BR13)
acpiprt3 at acpi0: bus 5 (BR14)
acpiprt4 at acpi0: bus 8 (BR16)
acpiec0 at acpi0
acpicpu at acpi0 not configured
acpitz0 at acpi0: critical temperature 100 degC
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT1 model "MS-1221
" serial 
 type LION
 oem "MSI Corp.
"
acpibtn0 at acpi0: LID0
acpibtn1 at acpi0: SLPB
acpibtn2 at acpi0: PWRB
acpivideo0 at acpi0: VGA_
acpivout0 at acpivideo0: CRT_
acpivout1 at acpivideo0: LCD_
acpivout2 at acpivideo0: HDMI
bios0: ROM list: 0xc/0xe200 0xce800/0x1800
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
"NVIDIA MCP77 Memory" rev 0xa2 at pci0 dev 0 function 0 not configured
pcib0 at pci0 dev 1 function 0 "NVIDIA MCP77 ISA" rev 0xa2
nviic0 at pci0 dev 1 function 1 "NVIDIA MCP77 SMBus" rev 0xa1
iic0 at nviic0
iic1 at nviic0
spdmem0 at iic1 addr 0x50: 2GB DDR2 SDRAM non-parity PC2-6400CL5 SO-DIMM
spdmem1 at iic1 addr 0x51: 2GB DDR2 SDRAM non-parity PC2-6400CL5 SO-DIMM
"NVIDIA MCP77 Co-processor" rev 0xa2 at pci0 dev 1 function 3 not configured
"NVIDIA MCP77 Memory" rev 0xa1 at pci0 dev 1 function 4 not configured
ohci0 at pci0 dev 2 function 0 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 7 (irq 
7), version 1.0, legacy support
ehci0 at pci0 dev 2 function 1 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 11 (irq 
11)
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "NVIDIA EHCI root hub" rev 2.00/1.00 addr 1
ohci1 at pci0 dev 4 function 0 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 5 (irq 
5), version 1.0, legacy support
ehci1 at pci0 dev 4 function 1 "NVIDIA MCP77 USB" rev 0xa1: apic 0 int 7 (irq 7)
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 "NVIDIA EHCI root hub" rev 2.00/1.00 addr 1
pciide0 at pci0 dev 6 function 0 "NVIDIA MCP77 IDE" rev 0xa1: DMA, channel 0 
configured to compatibility, channel 1 configured to compatibility
pciide0: channel 0 ignored (disabled)
pciide0: channel 1 ignored (disabled)
azalia0 at pci0 dev 7 function 0 "NVIDIA MCP77 HD Audio" rev 0xa1: apic 0 int 
11 (irq 11)
azalia0: codecs: Realtek ALC888, Motorola/0x3055, NVIDIA/0x0006, using Realtek 
ALC888
audio0 at azalia0
ppb0 at pci0 dev 8 function 0 "NVIDIA MCP77 PCI" rev 0xa1
pci1 at ppb0 bus 1
pciide1 at pci0 dev 9 function 0 "NVIDIA MCP77 AHCI" rev 0xa2: DMA 
(unsupported), channel 0 wired to native-PCI, channel 1 wired to native-PCI
pciide1: using apic 0 int 10 (irq 10) for native-PCI interrupt
wd0 at pciide1 channel 0 drive 0: 
wd0: 16-sector PIO, LBA48, 305245MB, 625142448 sectors
atapiscsi0 at pciide1 channel 0 drive 1
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0:  ATAPI 5/cdrom 
removable
pciide1: channel 1 ignored (not responding; disabled or no drives?)
nfe0 at pci0 dev 10 function 0 "NVIDIA MCP77 LAN" rev 0xa2: apic 0 int 5 (irq 
5), address 00:21:85:55:af:d3
eephy0 at nfe0 phy 1: 88E1116 Gigabit PHY, rev. 1
ppb1 at pci0 dev 16 function 0 "NVIDIA MCP77 PCIE" rev 0xa1: apic 0 int 7 (irq 
7)
pci2 at ppb1 bus 2
vga1 at pci2 dev 0 function 0 vendor "NVIDIA", unknown product 0x0649 rev 0xa1
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
ppb2 at pci0 dev 18 function 0 "NVIDIA MCP77 PCIE" rev 0xa1: apic 0 int 11 (irq 
11)
pci3 at ppb2 bus 3
ral0 at pci3 dev 0 function 0 "Ralink RT2790" rev 0x00: apic 0 int 11 (irq 11), 
address 00:21:85:b3:c4:ec
ral0: MAC/BBP RT2872 (rev 0x0200), RF RT2720 (MIMO 1T2R)
ppb3 at pci0 dev 19 function 0 "NVIDIA MCP77 PCI" rev 0xa1: apic 0 int 5 (irq 5)
pci4 at ppb3 bus 4
ppb4

Re: nfe(4) diff for promisc/multicast changes needs testing.

2009-07-30 Thread damien . bergamini
OK, thanks for the explanation.
It wasn't obvious from just reading the diff.

Damien


| On Thursday 30 July 2009 05:12:50 damien.bergam...@free.fr wrote:
| > Except "rewriting parts of the code", what does this diff do?
| > Does it fix an existing bug?
| > Or is it just rewriting for the sake of rewriting?
| 
| The current ALLMULTI flag handling is a bug.
| 
| Drivers should now be checking ac->ac_multirangecnt instead of
| using the bcmp range check. It also tidies things up.
| 
| Simplifying the SIOCSIFFLAGS ioctl handler. The same thing I have
| been doing everywhere else.
| 
| -- 
| This message has been scanned for viruses and
| dangerous content by MailScanner, and is
| believed to be clean.



ipgphy(4) diff for IC Plus IP1001 support.

2009-07-30 Thread Brad
Here is a diff to add support for the IC Plus IP1001 GigE PHY.

>From FreeBSD

Tested by jasper@ with a IP1000A PHY to make sure I didn't break anything.


Index: ipgphy.c
===
RCS file: /cvs/src/sys/dev/mii/ipgphy.c,v
retrieving revision 1.11
diff -u -p -r1.11 ipgphy.c
--- ipgphy.c30 Jul 2009 10:26:23 -  1.11
+++ ipgphy.c30 Jul 2009 10:50:27 -
@@ -29,7 +29,7 @@
  */
 
 /*
- * Driver for the IC Plus IP1000A 10/100/1000 PHY.
+ * Driver for the IC Plus IP1000A/IP1001 10/100/1000 PHY.
  */
 
 #include 
@@ -80,6 +80,8 @@ const struct mii_phy_funcs ipgphy_funcs 
 static const struct mii_phydesc ipgphys[] = {
{ MII_OUI_ICPLUS,   MII_MODEL_ICPLUS_IP1000A,
  MII_STR_ICPLUS_IP1000A },
+   { MII_OUI_ICPLUS,   MII_MODEL_ICPLUS_IP1001,
+ MII_STR_ICPLUS_IP1001 },
 
{ 0,
  NULL },
@@ -110,6 +112,7 @@ ipgphy_attach(struct device *parent, str
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;
sc->mii_funcs = &ipgphy_funcs;
+   sc->mii_model = MII_MODEL(ma->mii_id2);
sc->mii_pdata = mii;
 
sc->mii_flags |= MIIF_NOISOLATE;
@@ -245,7 +248,7 @@ done:
 * Only retry autonegotiation every mii_anegticks seconds.
 */
if (sc->mii_ticks <= sc->mii_anegticks)
-   return (0);
+   break;
 
sc->mii_ticks = 0;
ipgphy_mii_phy_auto(sc);
@@ -264,6 +267,7 @@ void
 ipgphy_status(struct mii_softc *sc)
 {
struct mii_data *mii = sc->mii_pdata;
+   struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
uint32_t bmsr, bmcr, stat;
 
mii->mii_media_status = IFM_AVALID;
@@ -271,63 +275,99 @@ ipgphy_status(struct mii_softc *sc)
 
bmsr = PHY_READ(sc, IPGPHY_MII_BMSR) |
PHY_READ(sc, IPGPHY_MII_BMSR);
-   if ((bmsr & IPGPHY_BMSR_LINK) != 0)
+   if (bmsr & IPGPHY_BMSR_LINK) 
mii->mii_media_status |= IFM_ACTIVE;
 
bmcr = PHY_READ(sc, IPGPHY_MII_BMCR);
-   if ((bmcr & IPGPHY_BMCR_LOOP) != 0)
+   if (bmcr & IPGPHY_BMCR_LOOP)
mii->mii_media_active |= IFM_LOOP;
 
-   if ((bmcr & IPGPHY_BMCR_AUTOEN) != 0) {
+   if (bmcr & IPGPHY_BMCR_AUTOEN) {
if ((bmsr & IPGPHY_BMSR_ANEGCOMP) == 0) {
/* Erg, still trying, I guess... */
mii->mii_media_active |= IFM_NONE;
return;
}
-   }
 
-   stat = PHY_READ(sc, STGE_PhyCtrl);
-   switch (PC_LinkSpeed(stat)) {
-   case PC_LinkSpeed_Down:
-   mii->mii_media_active |= IFM_NONE;
-   return;
-   case PC_LinkSpeed_10:
-   mii->mii_media_active |= IFM_10_T;
-   break;
-   case PC_LinkSpeed_100:
-   mii->mii_media_active |= IFM_100_TX;
-   break;
-   case PC_LinkSpeed_1000:
-   mii->mii_media_active |= IFM_1000_T;
-   break;
-   }
+   if (sc->mii_model == MII_MODEL_ICPLUS_IP1001) {
+   stat = PHY_READ(sc, IPGPHY_LSR);
+   switch (stat & IPGPHY_LSR_SPEED_MASK) {
+   case IPGPHY_LSR_SPEED_10:
+   mii->mii_media_active |= IFM_10_T;
+   break;
+   case IPGPHY_LSR_SPEED_100:
+   mii->mii_media_active |= IFM_100_TX;
+   break;
+   case IPGPHY_LSR_SPEED_1000:
+   mii->mii_media_active |= IFM_1000_T;
+   break;
+   default:
+   mii->mii_media_active |= IFM_NONE;
+   return;
+   }
+
+   if (stat & IPGPHY_LSR_FULL_DUPLEX)
+   mii->mii_media_active |= IFM_FDX;
+   else
+   mii->mii_media_active |= IFM_HDX;
+   } else {
+   stat = PHY_READ(sc, STGE_PhyCtrl);
+   switch (PC_LinkSpeed(stat)) {
+   case PC_LinkSpeed_Down:
+   mii->mii_media_active |= IFM_NONE;
+   return;
+   case PC_LinkSpeed_10:
+   mii->mii_media_active |= IFM_10_T;
+   break;
+   case PC_LinkSpeed_100:
+   mii->mii_media_active |= IFM_100_TX;
+   break;
+   case PC_LinkSpeed_1000:
+   mii->mii_media_active |= IFM_1000_T;
+   break;
+   default:
+   mii->mii_media_a

Re: nfe(4) diff for promisc/multicast changes needs testing.

2009-07-30 Thread Brad
On Thursday 30 July 2009 05:12:50 damien.bergam...@free.fr wrote:
> Except "rewriting parts of the code", what does this diff do?
> Does it fix an existing bug?
> Or is it just rewriting for the sake of rewriting?

The current ALLMULTI flag handling is a bug.

Drivers should now be checking ac->ac_multirangecnt instead of
using the bcmp range check. It also tidies things up.

Simplifying the SIOCSIFFLAGS ioctl handler. The same thing I have
been doing everywhere else.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: nfe(4) diff for promisc/multicast changes needs testing.

2009-07-30 Thread damien . bergamini
Except "rewriting parts of the code", what does this diff do?
Does it fix an existing bug?
Or is it just rewriting for the sake of rewriting?

Damien


| The following diff rewrites parts of the code for promiscuous mode
| and multicast handling for the nfe(4) driver. Please test promisc
| mode and multicast mode of operation with any nfe(4) adapters.
| 
| Please provide a dmesg.
| 
| 
| Index: if_nfe.c
| ===
| RCS file: /cvs/src/sys/dev/pci/if_nfe.c,v
| retrieving revision 1.89
| diff -u -p -r1.89 if_nfe.c
| --- if_nfe.c  18 Jun 2009 08:19:03 -  1.89
| +++ if_nfe.c  20 Jun 2009 02:52:31 -
| @@ -100,7 +100,7 @@ void  nfe_reset_tx_ring(struct nfe_softc 
|  void nfe_free_tx_ring(struct nfe_softc *, struct nfe_tx_ring *);
|  int  nfe_ifmedia_upd(struct ifnet *);
|  void nfe_ifmedia_sts(struct ifnet *, struct ifmediareq *);
| -void nfe_setmulti(struct nfe_softc *);
| +void nfe_iff(struct nfe_softc *);
|  void nfe_get_macaddr(struct nfe_softc *, uint8_t *);
|  void nfe_set_macaddr(struct nfe_softc *, const uint8_t *);
|  void nfe_tick(void *);
| @@ -543,24 +543,14 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd,
|  
|   case SIOCSIFFLAGS:
|   if (ifp->if_flags & IFF_UP) {
| - /*
| -  * If only the PROMISC or ALLMULTI flag changes, then
| -  * don't do a full re-init of the chip, just update
| -  * the Rx filter.
| -  */
| - if ((ifp->if_flags & IFF_RUNNING) &&
| - ((ifp->if_flags ^ sc->sc_if_flags) &
| -  (IFF_ALLMULTI | IFF_PROMISC)) != 0) {
| - nfe_setmulti(sc);
| - } else {
| - if (!(ifp->if_flags & IFF_RUNNING))
| - nfe_init(ifp);
| - }
| + if (ifp->if_flags & IFF_RUNNING)
| + error = ENETRESET;
| + else
| + nfe_init(ifp);
|   } else {
|   if (ifp->if_flags & IFF_RUNNING)
|   nfe_stop(ifp, 1);
|   }
| - sc->sc_if_flags = ifp->if_flags;
|   break;
|  
|   case SIOCSIFMEDIA:
| @@ -574,7 +564,7 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd,
|  
|   if (error == ENETRESET) {
|   if (ifp->if_flags & IFF_RUNNING)
| - nfe_setmulti(sc);
| + nfe_iff(sc);
|   error = 0;
|   }
|  
| @@ -1156,7 +1146,7 @@ nfe_init(struct ifnet *ifp)
|   NFE_WRITE(sc, NFE_RXTX_CTL, NFE_RXTX_BIT1 | sc->rxtxctl);
|  
|   /* set Rx filter */
| - nfe_setmulti(sc);
| + nfe_iff(sc);
|  
|   nfe_ifmedia_upd(ifp);
|  
| @@ -1698,39 +1688,45 @@ nfe_ifmedia_sts(struct ifnet *ifp, struc
|  }
|  
|  void
| -nfe_setmulti(struct nfe_softc *sc)
| +nfe_iff(struct nfe_softc *sc)
|  {
| + struct ifnet *ifp = &sc->sc_arpcom.ac_if;
|   struct arpcom *ac = &sc->sc_arpcom;
| - struct ifnet *ifp = &ac->ac_if;
|   struct ether_multi *enm;
|   struct ether_multistep step;
|   uint8_t addr[ETHER_ADDR_LEN], mask[ETHER_ADDR_LEN];
| - uint32_t filter = NFE_RXFILTER_MAGIC;
| + uint32_t filter;
|   int i;
|  
| - if ((ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) != 0) {
| + filter = NFE_RXFILTER_MAGIC;
| + ifp->if_flags &= ~IFF_ALLMULTI;
| +
| + if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0) {
| + ifp->if_flags |= IFF_ALLMULTI;
| + if (ifp->if_flags & IFF_PROMISC)
| + filter |= NFE_PROMISC;
| + else
| + filter |= NFE_U2M;
|   bzero(addr, ETHER_ADDR_LEN);
|   bzero(mask, ETHER_ADDR_LEN);
|   goto done;
|   }
|  
| + filter |= NFE_U2M;
| +
|   bcopy(etherbroadcastaddr, addr, ETHER_ADDR_LEN);
|   bcopy(etherbroadcastaddr, mask, ETHER_ADDR_LEN);
|  
|   ETHER_FIRST_MULTI(step, ac, enm);
|   while (enm != NULL) {
| - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
| - ifp->if_flags |= IFF_ALLMULTI;
| - bzero(addr, ETHER_ADDR_LEN);
| - bzero(mask, ETHER_ADDR_LEN);
| - goto done;
| - }
|   for (i = 0; i < ETHER_ADDR_LEN; i++) {
|   addr[i] &=  enm->enm_addrlo[i];
|   mask[i] &= ~enm->enm_addrlo[i];
|   }
| +
|   ETHER_NEXT_MULTI(step, enm);
|   }
| +
|   for (i = 0; i < ETHER_ADDR_LEN; i++)
|   mask[i] |= addr[i];
|  
| @@ -1746,7 +1742,6 @@ done:
|   NFE_WRITE(sc, NFE_MULTIMASK_LO,
|   mask[5] <<  8 | mask[4]);
|  
| - filter |= (ifp->if_flags & IFF_PROMISC) ? NFE_PROMISC : NFE_U2M;
| 

nfe(4) diff for promisc/multicast changes needs testing.

2009-07-30 Thread Brad
The following diff rewrites parts of the code for promiscuous mode
and multicast handling for the nfe(4) driver. Please test promisc
mode and multicast mode of operation with any nfe(4) adapters.

Please provide a dmesg.


Index: if_nfe.c
===
RCS file: /cvs/src/sys/dev/pci/if_nfe.c,v
retrieving revision 1.89
diff -u -p -r1.89 if_nfe.c
--- if_nfe.c18 Jun 2009 08:19:03 -  1.89
+++ if_nfe.c20 Jun 2009 02:52:31 -
@@ -100,7 +100,7 @@ voidnfe_reset_tx_ring(struct nfe_softc 
 void   nfe_free_tx_ring(struct nfe_softc *, struct nfe_tx_ring *);
 intnfe_ifmedia_upd(struct ifnet *);
 void   nfe_ifmedia_sts(struct ifnet *, struct ifmediareq *);
-void   nfe_setmulti(struct nfe_softc *);
+void   nfe_iff(struct nfe_softc *);
 void   nfe_get_macaddr(struct nfe_softc *, uint8_t *);
 void   nfe_set_macaddr(struct nfe_softc *, const uint8_t *);
 void   nfe_tick(void *);
@@ -543,24 +543,14 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd,
 
case SIOCSIFFLAGS:
if (ifp->if_flags & IFF_UP) {
-   /*
-* If only the PROMISC or ALLMULTI flag changes, then
-* don't do a full re-init of the chip, just update
-* the Rx filter.
-*/
-   if ((ifp->if_flags & IFF_RUNNING) &&
-   ((ifp->if_flags ^ sc->sc_if_flags) &
-(IFF_ALLMULTI | IFF_PROMISC)) != 0) {
-   nfe_setmulti(sc);
-   } else {
-   if (!(ifp->if_flags & IFF_RUNNING))
-   nfe_init(ifp);
-   }
+   if (ifp->if_flags & IFF_RUNNING)
+   error = ENETRESET;
+   else
+   nfe_init(ifp);
} else {
if (ifp->if_flags & IFF_RUNNING)
nfe_stop(ifp, 1);
}
-   sc->sc_if_flags = ifp->if_flags;
break;
 
case SIOCSIFMEDIA:
@@ -574,7 +564,7 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd,
 
if (error == ENETRESET) {
if (ifp->if_flags & IFF_RUNNING)
-   nfe_setmulti(sc);
+   nfe_iff(sc);
error = 0;
}
 
@@ -1156,7 +1146,7 @@ nfe_init(struct ifnet *ifp)
NFE_WRITE(sc, NFE_RXTX_CTL, NFE_RXTX_BIT1 | sc->rxtxctl);
 
/* set Rx filter */
-   nfe_setmulti(sc);
+   nfe_iff(sc);
 
nfe_ifmedia_upd(ifp);
 
@@ -1698,39 +1688,45 @@ nfe_ifmedia_sts(struct ifnet *ifp, struc
 }
 
 void
-nfe_setmulti(struct nfe_softc *sc)
+nfe_iff(struct nfe_softc *sc)
 {
+   struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct arpcom *ac = &sc->sc_arpcom;
-   struct ifnet *ifp = &ac->ac_if;
struct ether_multi *enm;
struct ether_multistep step;
uint8_t addr[ETHER_ADDR_LEN], mask[ETHER_ADDR_LEN];
-   uint32_t filter = NFE_RXFILTER_MAGIC;
+   uint32_t filter;
int i;
 
-   if ((ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) != 0) {
+   filter = NFE_RXFILTER_MAGIC;
+   ifp->if_flags &= ~IFF_ALLMULTI;
+
+   if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0) {
+   ifp->if_flags |= IFF_ALLMULTI;
+   if (ifp->if_flags & IFF_PROMISC)
+   filter |= NFE_PROMISC;
+   else
+   filter |= NFE_U2M;
bzero(addr, ETHER_ADDR_LEN);
bzero(mask, ETHER_ADDR_LEN);
goto done;
}
 
+   filter |= NFE_U2M;
+
bcopy(etherbroadcastaddr, addr, ETHER_ADDR_LEN);
bcopy(etherbroadcastaddr, mask, ETHER_ADDR_LEN);
 
ETHER_FIRST_MULTI(step, ac, enm);
while (enm != NULL) {
-   if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
-   ifp->if_flags |= IFF_ALLMULTI;
-   bzero(addr, ETHER_ADDR_LEN);
-   bzero(mask, ETHER_ADDR_LEN);
-   goto done;
-   }
for (i = 0; i < ETHER_ADDR_LEN; i++) {
addr[i] &=  enm->enm_addrlo[i];
mask[i] &= ~enm->enm_addrlo[i];
}
+
ETHER_NEXT_MULTI(step, enm);
}
+
for (i = 0; i < ETHER_ADDR_LEN; i++)
mask[i] |= addr[i];
 
@@ -1746,7 +1742,6 @@ done:
NFE_WRITE(sc, NFE_MULTIMASK_LO,
mask[5] <<  8 | mask[4]);
 
-   filter |= (ifp->if_flags & IFF_PROMISC) ? NFE_PROMISC : NFE_U2M;
NFE_WRITE(sc, NFE_RXFILTER, filter);
 }
 
Index: if_nfevar.h
===
RCS file: /cvs/src/sys/dev/pci/if_nfevar.h,v
retrieving revision 1.13
diff -u -p -r1.13 if_nfev