Re: txp(4) 3Com 3XP Typhoon/Sidewinder diff needs testing

2013-12-02 Thread Mike Belopuhov
On 2 December 2013 03:07, Brad Smith b...@comstyle.com wrote:
 Here is a diff for the txp(4) 3Com 3XP Typhoon/Sidewinder driver to clean up
 and update the receive filter / ioctl handling code to be in line with the
 other drivers.

 Anyone with hw and able to test? OK?


as long as you're just moving stuff around, it should be fine.
i doubt you'll find people with such ancient and rather rare
hardware.

i might have also missed why are you doing that.  is it to have
if_iff and call all this stuff from the ether_ioctl?



Re: txp(4) 3Com 3XP Typhoon/Sidewinder diff needs testing

2013-12-02 Thread Loganaden Velvindron
On Mon, Dec 2, 2013 at 4:36 PM, Mike Belopuhov m...@belopuhov.com wrote:
 On 2 December 2013 03:07, Brad Smith b...@comstyle.com wrote:
 Here is a diff for the txp(4) 3Com 3XP Typhoon/Sidewinder driver to clean up
 and update the receive filter / ioctl handling code to be in line with the
 other drivers.

 Anyone with hw and able to test? OK?


 as long as you're just moving stuff around, it should be fine.
 i doubt you'll find people with such ancient and rather rare
 hardware.

I have a bunch of adapters that brad mentioned.

Give me some hours, I'm setting up my gear.



 i might have also missed why are you doing that.  is it to have
 if_iff and call all this stuff from the ether_ioctl?




-- 
This message is strictly personal and the opinions expressed do not
represent those of my employers, either past or present.



Re: sdmmc update

2013-12-02 Thread Sylvestre Gallon
On Wed, Nov 20, 2013 at 10:25:52AM +0100, Stefan Sperling wrote:
 On Thu, Nov 07, 2013 at 08:10:16PM +0100, Stefan Sperling wrote:
  On Thu, Nov 07, 2013 at 08:06:11PM +0100, Sylvestre Gallon wrote:
   +int
   +rtsx_bus_width(sdmmc_chipset_handle_t sch, int width)
   +{
   + struct rtsx_softc *sc = sch;
   +
   + return (rtsx_set_bus_width(sc, width));
  
  rtsx_set_bus_width() currently never returns an error so you'll
  need to tweak it as well.
  
  I will test your diff on rtsx and sdhc.
 
 This diff works with sdhc and provides an increase in read performance.
 
 Unfortunately, the diff breaks rtsx. The disk manages to attach after
 a CRC error, but it cannot be read. We'll need to figure this out.
 

Hi,

Does this diff works better ? I have just renable these lines in 
rtsx_bus_power() :

-   error = rtsx_set_bus_width(sc, 1);
-   if (error)
-   goto ret;

If it still not work with this diff can you add a printf in the
bus_clock code to know which frequency is required by the stack ?

Thanks,

Index: arch/arm/xscale/pxa2x0_mmc.c
===
RCS file: /cvs/src/sys/arch/arm/xscale/pxa2x0_mmc.c,v
retrieving revision 1.11
diff -u -p -u -p -r1.11 pxa2x0_mmc.c
--- arch/arm/xscale/pxa2x0_mmc.c22 Aug 2012 13:37:04 -  1.11
+++ arch/arm/xscale/pxa2x0_mmc.c2 Dec 2013 15:34:18 -
@@ -56,6 +56,7 @@ u_int32_t pxammc_host_ocr(sdmmc_chipset_
 intpxammc_host_maxblklen(sdmmc_chipset_handle_t);
 intpxammc_card_detect(sdmmc_chipset_handle_t);
 intpxammc_bus_power(sdmmc_chipset_handle_t, u_int32_t);
+intpxammc_bus_width(sdmmc_chipset_handle_t, int);
 intpxammc_bus_clock(sdmmc_chipset_handle_t, int);
 void   pxammc_exec_command(sdmmc_chipset_handle_t, struct sdmmc_command *);
 void   pxammc_clock_stop(struct pxammc_softc *);
@@ -90,6 +91,7 @@ struct sdmmc_chip_functions pxammc_funct
/* bus power and clock frequency */
pxammc_bus_power,
pxammc_bus_clock,
+   pxammc_bus_width,
/* command execution */
pxammc_exec_command
 };
@@ -179,6 +181,8 @@ pxammc_attach(struct pxammc_softc *sc, v
 */
bzero(saa, sizeof saa);
saa.saa_busname = sdmmc;
+   saa.saa_clkmax = SDMMC_SDCLK_25MHZ;
+
saa.sct = pxammc_functions;
saa.sch = sc;
saa.flags = SMF_STOP_AFTER_MULTIPLE;
@@ -274,6 +278,12 @@ pxammc_bus_power(sdmmc_chipset_handle_t 
DPRINTF(0,(%s: driver lacks set_power() function\n,
sc-sc_dev.dv_xname));
return ENXIO;
+}
+
+int
+pxammc_bus_width(sdmmc_chipset_handle_t sch, int width)
+{
+   return (0);
 }
 
 int
Index: arch/armv7/imx/imxesdhc.c
===
RCS file: /cvs/src/sys/arch/armv7/imx/imxesdhc.c,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 imxesdhc.c
--- arch/armv7/imx/imxesdhc.c   6 Nov 2013 19:03:07 -   1.4
+++ arch/armv7/imx/imxesdhc.c   2 Dec 2013 15:34:18 -
@@ -195,6 +195,7 @@ int imxesdhc_host_maxblklen(sdmmc_chipse
 intimxesdhc_card_detect(sdmmc_chipset_handle_t);
 intimxesdhc_bus_power(sdmmc_chipset_handle_t, uint32_t);
 intimxesdhc_bus_clock(sdmmc_chipset_handle_t, int);
+intimxesdhc_bus_width(sdmmc_chipset_handle_t, int);
 void   imxesdhc_card_intr_mask(sdmmc_chipset_handle_t, int);
 void   imxesdhc_card_intr_ack(sdmmc_chipset_handle_t);
 void   imxesdhc_exec_command(sdmmc_chipset_handle_t, struct sdmmc_command *);
@@ -225,6 +226,7 @@ struct sdmmc_chip_functions imxesdhc_fun
/* bus power and clock frequency */
imxesdhc_bus_power,
imxesdhc_bus_clock,
+   imxesdhc_bus_width,
/* command execution */
imxesdhc_exec_command,
/* card interrupt */
@@ -319,6 +321,7 @@ imxesdhc_attach(struct device *parent, s
 
bzero(saa, sizeof(saa));
saa.saa_busname = sdmmc;
+   saa.saa_clkmax = SDMMC_SDCLK_25MHZ;
saa.sct = imxesdhc_functions;
saa.sch = sc;
 
@@ -327,7 +330,7 @@ imxesdhc_attach(struct device *parent, s
error = 0;
goto err;
}
-   
+
return;
 
 err:
@@ -483,6 +486,12 @@ imxesdhc_card_detect(sdmmc_chipset_handl
  */
 int
 imxesdhc_bus_power(sdmmc_chipset_handle_t sch, uint32_t ocr)
+{
+   return 0;
+}
+
+int
+imxesdhc_bus_width(sdmmc_chipset_handle_t sch, int freq)
 {
return 0;
 }
Index: arch/armv7/omap/ommmc.c
===
RCS file: /cvs/src/sys/arch/armv7/omap/ommmc.c,v
retrieving revision 1.11
diff -u -p -u -p -r1.11 ommmc.c
--- arch/armv7/omap/ommmc.c 12 Nov 2013 17:51:52 -  1.11
+++ arch/armv7/omap/ommmc.c 2 Dec 2013 15:34:18 -
@@ -229,6 +229,7 @@ int ommmc_host_maxblklen(sdmmc_chipset_h
 intommmc_card_detect(sdmmc_chipset_handle_t);
 intommmc_bus_power(sdmmc_chipset_handle_t, uint32_t);
 intommmc_bus_clock(sdmmc_chipset_handle_t, int);
+int

Kernel leak with compat-linux

2013-12-02 Thread Maxime Villard
Hi,
when loading a linux binary, the kernel could leak MAXPATHLEN bytes.

Index: linux_exec.c
===
RCS file: /cvs/src/sys/compat/linux/linux_exec.c,v
retrieving revision 1.38
diff -u -r1.38 linux_exec.c
--- linux_exec.c3 Nov 2013 13:52:44 -   1.38
+++ linux_exec.c1 Dec 2013 17:33:55 -
@@ -227,9 +227,10 @@
if (itp) {
if ((error = emul_find(p, NULL, linux_emul_path, itp, bp, 0)))
return (error);
-   if ((error = copystr(bp, itp, MAXPATHLEN, len)))
-   return (error);
+   error = copystr(bp, itp, MAXPATHLEN, len);
free(bp, M_TEMP);
+   if (error)
+   return (error);
}
epp-ep_emul = emul_linux_elf;
*pos = ELF32_NO_ADDR;

emul_find() allocates bp, and if the copystr() fails, bp is lost.

However, there's apparently no reason to fail here, since bp isn't
larger than MAXPATHLEN and is NUL-terminated.

While here, also fix a typo in a comment:

Index: linux_exec.c
===
RCS file: /cvs/src/sys/compat/linux/linux_exec.c,v
retrieving revision 1.38
diff -u -r1.38 linux_exec.c
--- linux_exec.c3 Nov 2013 13:52:44 -   1.38
+++ linux_exec.c2 Dec 2013 17:40:11 -
@@ -218,7 +218,7 @@
 * If this is a static binary, do not allow it to run, as it
 * has not been identified. We'll give non-static binaries a
 * chance to run, as the Linux ld.so name is usually unique
-* enough to clear any amibiguity.
+* enough to clear any ambiguity.
 */
if (itp == NULL)
return (EINVAL);


Ok/Comments?



lynx: drop -lcompat

2013-12-02 Thread Christian Weisgerber
The configure script unconditionally adds -lcompat.  This isn't
needed; configure checks for the presence of cuserid() and ftime()
and the build copes well with the absence of either.  ftime() would only
ever be used if gettimeofday() wasn't available, and cuserid() is
replaced by getlogin() but that code branch in unreached anyway.

In short, we can just drop -lcompat.

ok?

Index: configure
===
RCS file: /cvs/src/gnu/usr.bin/lynx/configure,v
retrieving revision 1.15
diff -u -p -r1.15 configure
--- configure   22 Jul 2011 14:10:37 -  1.15
+++ configure   2 Dec 2013 20:50:02 -
@@ -5877,7 +5877,7 @@ msdosdjgpp*)
 next*)
TRY_CFLAGS=$TRY_CFLAGS -DNEXT
;;
-openbsd* | ekkobsd* | mirbsd*)
+ekkobsd* | mirbsd*)
LIBS=$LIBS -lcompat
;;
 osf4*)
Index: configure.in
===
RCS file: /cvs/src/gnu/usr.bin/lynx/configure.in,v
retrieving revision 1.11
diff -u -p -r1.11 configure.in
--- configure.in22 Jul 2011 14:10:37 -  1.11
+++ configure.in2 Dec 2013 20:48:28 -
@@ -289,7 +289,7 @@ msdosdjgpp*)
 next*)
TRY_CFLAGS=$TRY_CFLAGS -DNEXT
;;
-openbsd* | ekkobsd* | mirbsd*)
+ekkobsd* | mirbsd*)
LIBS=$LIBS -lcompat
;;
 osf4*)
-- 
Christian naddy Weisgerber  na...@mips.inka.de



urndis(4): fix charging on my nokia c2-01

2013-12-02 Thread Paul Irofti
Could people doing actual networking with urndis(4) please test the
following diff and report if any regressions are encountered?

I plan on commiting it by the end of the week if I don't hear anything
bad in regards to the patch.


Index: if_urndis.c
===
RCS file: /cvs/src/sys/dev/usb/if_urndis.c,v
retrieving revision 1.44
diff -u -p -r1.44 if_urndis.c
--- if_urndis.c 21 Nov 2013 14:08:05 -  1.44
+++ if_urndis.c 28 Nov 2013 10:22:42 -
@@ -1363,6 +1363,7 @@ urndis_attach(struct device *parent, str
sc = (void *)self;
uaa = aux;
 
+   sc-sc_attached = 0;
sc-sc_udev = uaa-device;
id = usbd_get_interface_descriptor(uaa-iface);
sc-sc_ifaceno_ctl = id-bInterfaceNumber;
@@ -1447,14 +1448,11 @@ urndis_attach(struct device *parent, str
 
IFQ_SET_READY(ifp-if_snd);
 
-   urndis_init(sc);
-
s = splnet();
 
if (urndis_ctrl_query(sc, OID_802_3_PERMANENT_ADDRESS, NULL, 0,
buf, bufsz) != RNDIS_STATUS_SUCCESS) {
printf(: unable to get hardware address\n);
-   urndis_stop(sc);
splx(s);
return;
}
@@ -1466,7 +1464,6 @@ urndis_attach(struct device *parent, str
} else {
printf(, invalid address\n);
free(buf, M_TEMP);
-   urndis_stop(sc);
splx(s);
return;
}
@@ -1478,7 +1475,6 @@ urndis_attach(struct device *parent, str
if (urndis_ctrl_set(sc, OID_GEN_CURRENT_PACKET_FILTER, filter,
sizeof(filter)) != RNDIS_STATUS_SUCCESS) {
printf(%s: unable to set data filters\n, DEVNAME(sc));
-   urndis_stop(sc);
splx(s);
return;
}



Re: urndis(4): fix charging on my nokia c2-01

2013-12-02 Thread Paul Irofti
On Tue, Dec 03, 2013 at 12:47:30AM +0200, Paul Irofti wrote:
 Could people doing actual networking with urndis(4) please test the
 following diff and report if any regressions are encountered?
 
 I plan on commiting it by the end of the week if I don't hear anything
 bad in regards to the patch.
 

To be more specific, this diff fixes a panic on detach when connecting
my phone to an OpenBSD machine.

The ctrl methods on attach only use control messages and don't need any
pipe besides the default pipe which is always present.

Thus the urndis_init() and, in turn, urndis_stop() funcalls are not
needed during attach.

Besides from that they're also poorly written as they can fail and that
is not checked nor reported. This driver is in really poor shape.

This diff just brings this awful driver closer to what other usb
ethernet drivers are doing.


Others diffs will probably follow in order to clean-up the current mess.


 Index: if_urndis.c
 ===
 RCS file: /cvs/src/sys/dev/usb/if_urndis.c,v
 retrieving revision 1.44
 diff -u -p -r1.44 if_urndis.c
 --- if_urndis.c   21 Nov 2013 14:08:05 -  1.44
 +++ if_urndis.c   28 Nov 2013 10:22:42 -
 @@ -1363,6 +1363,7 @@ urndis_attach(struct device *parent, str
   sc = (void *)self;
   uaa = aux;
  
 + sc-sc_attached = 0;
   sc-sc_udev = uaa-device;
   id = usbd_get_interface_descriptor(uaa-iface);
   sc-sc_ifaceno_ctl = id-bInterfaceNumber;
 @@ -1447,14 +1448,11 @@ urndis_attach(struct device *parent, str
  
   IFQ_SET_READY(ifp-if_snd);
  
 - urndis_init(sc);
 -
   s = splnet();
  
   if (urndis_ctrl_query(sc, OID_802_3_PERMANENT_ADDRESS, NULL, 0,
   buf, bufsz) != RNDIS_STATUS_SUCCESS) {
   printf(: unable to get hardware address\n);
 - urndis_stop(sc);
   splx(s);
   return;
   }
 @@ -1466,7 +1464,6 @@ urndis_attach(struct device *parent, str
   } else {
   printf(, invalid address\n);
   free(buf, M_TEMP);
 - urndis_stop(sc);
   splx(s);
   return;
   }
 @@ -1478,7 +1475,6 @@ urndis_attach(struct device *parent, str
   if (urndis_ctrl_set(sc, OID_GEN_CURRENT_PACKET_FILTER, filter,
   sizeof(filter)) != RNDIS_STATUS_SUCCESS) {
   printf(%s: unable to set data filters\n, DEVNAME(sc));
 - urndis_stop(sc);
   splx(s);
   return;
   }
 



Re: txp(4) 3Com 3XP Typhoon/Sidewinder diff needs testing

2013-12-02 Thread Brad Smith

On 02/12/13 7:36 AM, Mike Belopuhov wrote:

On 2 December 2013 03:07, Brad Smith b...@comstyle.com wrote:

Here is a diff for the txp(4) 3Com 3XP Typhoon/Sidewinder driver to clean up
and update the receive filter / ioctl handling code to be in line with the
other drivers.

Anyone with hw and able to test? OK?



as long as you're just moving stuff around, it should be fine.
i doubt you'll find people with such ancient and rather rare
hardware.


I've already done the first 40 - 50 odd drivers. I'm down to the
drivers of hardware that is somewhat rare or on other not so common
archs and I'd like to finish the rest.


i might have also missed why are you doing that.  is it to have
if_iff and call all this stuff from the ether_ioctl?


Well it is to do a bunch of things but its all in the same bits of
code. After taking a look at a lot of the drivers over time I noticed a
lot of inconsistencies and a handful of bugs. Drivers have been ported
from FreeBSD/NetBSD as well as drivers written for OpenBSD but there
was/has been a variety of ways of handling certain bits like
promiscuous mode handling whether its in the ioctl handler or separated
out to a separate function or within the function which is essentially
for multicast handling. Also some drivers have/had bugs; for example
udav(4) where once promisc mode was flipped on the hardware was always
stuck in all multicast mode even after promisc mode was disabled or
there are a variety of drivers once IFF_ALLMULTI is flipped on that the
driver has no way of coming out of all multicast mode since the driver
doesn't clear the flag properly. So the idea is to have consistent
ioctl handling between all of the drivers. Put all the receive filter
handling bits in one spot and have the drivers handle things in a 
consistent manner.


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



Re: urndis(4): fix charging on my nokia c2-01

2013-12-02 Thread Paul Irofti
On Tue, Dec 03, 2013 at 01:07:17AM +0200, Paul Irofti wrote:
 On Tue, Dec 03, 2013 at 12:47:30AM +0200, Paul Irofti wrote:
  Could people doing actual networking with urndis(4) please test the
  following diff and report if any regressions are encountered?
  
  I plan on commiting it by the end of the week if I don't hear anything
  bad in regards to the patch.
  
 
 To be more specific, this diff fixes a panic on detach when connecting
 my phone to an OpenBSD machine.

Clarifying further, this is due to failure to setup a pipe in
urndis_ctrl_init() which results in a TIMEOUT on receive with
side-effects later on during detach due to assumptions regarding
the existence of interface hooks during dohooks on if_detach tear-down.

This results on dereferencing a NULL function pointer which triggers a
panic.

 
 The ctrl methods on attach only use control messages and don't need any
 pipe besides the default pipe which is always present.
 
 Thus the urndis_init() and, in turn, urndis_stop() funcalls are not
 needed during attach.
 
 Besides from that they're also poorly written as they can fail and that
 is not checked nor reported. This driver is in really poor shape.
 
 This diff just brings this awful driver closer to what other usb
 ethernet drivers are doing.
 
 
 Others diffs will probably follow in order to clean-up the current mess.
 
 
  Index: if_urndis.c
  ===
  RCS file: /cvs/src/sys/dev/usb/if_urndis.c,v
  retrieving revision 1.44
  diff -u -p -r1.44 if_urndis.c
  --- if_urndis.c 21 Nov 2013 14:08:05 -  1.44
  +++ if_urndis.c 28 Nov 2013 10:22:42 -
  @@ -1363,6 +1363,7 @@ urndis_attach(struct device *parent, str
  sc = (void *)self;
  uaa = aux;
   
  +   sc-sc_attached = 0;
  sc-sc_udev = uaa-device;
  id = usbd_get_interface_descriptor(uaa-iface);
  sc-sc_ifaceno_ctl = id-bInterfaceNumber;
  @@ -1447,14 +1448,11 @@ urndis_attach(struct device *parent, str
   
  IFQ_SET_READY(ifp-if_snd);
   
  -   urndis_init(sc);
  -
  s = splnet();
   
  if (urndis_ctrl_query(sc, OID_802_3_PERMANENT_ADDRESS, NULL, 0,
  buf, bufsz) != RNDIS_STATUS_SUCCESS) {
  printf(: unable to get hardware address\n);
  -   urndis_stop(sc);
  splx(s);
  return;
  }
  @@ -1466,7 +1464,6 @@ urndis_attach(struct device *parent, str
  } else {
  printf(, invalid address\n);
  free(buf, M_TEMP);
  -   urndis_stop(sc);
  splx(s);
  return;
  }
  @@ -1478,7 +1475,6 @@ urndis_attach(struct device *parent, str
  if (urndis_ctrl_set(sc, OID_GEN_CURRENT_PACKET_FILTER, filter,
  sizeof(filter)) != RNDIS_STATUS_SUCCESS) {
  printf(%s: unable to set data filters\n, DEVNAME(sc));
  -   urndis_stop(sc);
  splx(s);
  return;
  }
  
 



pf.os: add additional fingerprints

2013-12-02 Thread Eitan Adler
Hi all,

This is a simple enough patch:

Index: pf.os
==*=
RCS file: /cvs/src/etc/pf.os,v
retrieving revision 1.26
diff -u -r1.26 pf.os
--- pf.os 3 Aug 2012 12:25:16 - 1.26
+++ pf.os 3 Dec 2013 04:37:55 -
@@ -314,6 +314,14 @@
 16384:64:1:64:M*,N,N,S,N,W3,N,N,T: OpenBSD:4.9::OpenBSD 4.9
 16384:64:0:64:M*,N,N,S,N,W3,N,N,T: OpenBSD:4.9:no-df:OpenBSD 4.9 (scrub no-df)

+# - DragonFly BSD -
+
+57344:64:1:60:M*,N,W0,N,N,T: DragonFly:1.0:A:DragonFly 1.0A
+57344:64:0:64:M*,N,W0,N,N,S,N,N,T: DragonFly:1.2-1.12::DragonFly 1.2-1.12
+5840:64:1:60:M*,S,T,N,W4: DragonFly:2.0-2.1::DragonFly 2.0-2.1
+57344:64:0:64:M*,N,W0,N,N,S,N,N,T: DragonFly:2.2-2.3::DragonFly 2.2-2.3
+57344:64:0:64:M*,N,W5,N,N,S,N,N,T: DragonFly:2.4-2.7::DragonFly 2.4-2.7
+
 # - Solaris -

 S17:64:1:64:N,W3,N,N,T0,N,N,S,M*: Solaris:8:RFC1323:Solaris 8 RFC1323


-- 
Eitan Adler