On Sun, Jul 09, 2017 at 09:57:34AM +0300, Artturi Alm wrote:
> Hi,
> 
> anyone else having issues w/urndis(android)?
> victim of circumstances, i have to rely on it at times during the summer.
> When i plug phone into usb, and enable usb tethering or w/e it is called,
> i never get ip on first try, i have nothing but "dhcp"
> in /etc/hostname.urndis0, so i just ^C on the first i"ksh /etc/netstart"
> and get ip pretty much as expected in seconds on the successive run
> right after ^C, the first dhclient would end up sleeping if not ^C'ed..
> 
> this is what i see in dmesg:
> urndis0 at uhub0 port 1 configuration 1 interface 0 "SAMSUNG SAMSUNG_Android" 
> rev 2.00/ff.ff addr 2
> urndis0: using RNDIS, address 02:56:66:63:30:3c
> urndis0: ctrl message error: unknown event 0x7
> 
> no dmesg, as i've ran into this issue on every installation of OpenBSD
> i have tried w/.
> unrelated issue is this spam i get which i haven't noticed to affect
> anything:
> urndis0: urndis_decap invalid buffer len 1 < minimum header 44
> 
> for which i ended up w/diff below.
> -Artturi
> 
> diff --git a/sys/dev/usb/if_urndis.c b/sys/dev/usb/if_urndis.c
> index 4af6b55cf05..9a3d5db66c0 100644
> --- a/sys/dev/usb/if_urndis.c
> +++ b/sys/dev/usb/if_urndis.c
> @@ -796,11 +796,11 @@ urndis_decap(struct urndis_softc *sc, struct 
> urndis_chain *c, u_int32_t len)
>                   len));
>  
>               if (len < sizeof(*msg)) {
> -                     printf("%s: urndis_decap invalid buffer len %u < "
> +                     DPRINTF(("%s: urndis_decap invalid buffer len %u < "
>                           "minimum header %zu\n",
>                           DEVNAME(sc),
>                           len,
> -                         sizeof(*msg));
> +                         sizeof(*msg)));
>                       return;
>               }
>  
> 
> 

Hi,

so here's the diff i was too embarrassed to send along the above,
that fixes the issue, but is so ugly i don't know what to do w/it,
which is why i came asking.

diff for the archives below.
-Artturi


diff --git a/sys/dev/usb/if_urndis.c b/sys/dev/usb/if_urndis.c
index 4af6b55cf05..234e4d223d0 100644
--- a/sys/dev/usb/if_urndis.c
+++ b/sys/dev/usb/if_urndis.c
@@ -1032,8 +1032,17 @@ urndis_init(struct urndis_softc *sc)
        int                      i, s;
        usbd_status              err;
 
-       if (urndis_ctrl_init(sc) != RNDIS_STATUS_SUCCESS)
+       if (urndis_ctrl_init(sc) != RNDIS_STATUS_SUCCESS) {
+               if (sc->sc_attached == 1) {     /* XXX hack for androids. */
+                       /*
+                        * first try often(always here, w/o dbg.) fails with:
+                        * urndis0: ctrl message error: unknown event 0x7
+                        */
+                       sc->sc_attached++;
+                       urndis_init(sc);        /* so retry once per attach */
+               }
                return;
+       }
 
        s = splnet();
 

Reply via email to