On 25/12/12(Tue) 12:02, Federico Schwindt wrote:
> On Mon, Dec 24, 2012 at 12:01 PM, Martin Pieuchot
> <[email protected]> wrote:
> > On 23/12/12(Sun) 23:06, Federico Schwindt wrote:
> >> On Fri, Dec 21, 2012 at 5:44 PM, Paul Stoeber <[email protected]> wrote:
> >> > On Fri, 21 Dec 2012 17:57:27 +0100
> >> > Martin Pieuchot <[email protected]> wrote:
> >> >> I think that the problem you are seeing is a regression introduced by
> >> >> the revision 1.34 of /sys/dev/usb/if_urndis.c
> >> >
> >> > Confirmed. I use OpenBSD 5.2. I downgrade the kernel source to
> >> > if_urndis.c 1.33
> >> > if_urndisreg.h 1.14
> >> > usb.h 1.40
> >> > Then urndis doesn't appear in dmesg, and I get cdce0 and internet.
> >>
> >> Hi,
> >>
> >> Can you please try the attached diff? It includes 2 other changes in
> >> urndis but it shouldn't matter in this case.
> >> Thanks,
> >
> > I'm ok with this change but I would prefer to use an existing define
> > like MATCH_IFACECLASS_GENERIC instead of adding a new one for this
> > workaround.
>
> You can't. if_cdce uses UMATCH_IFACECLASS_GENERIC (which btw, looks
> wrong to me) so it has to be lower. ugen uses UMATCH_GENERIC, so I
> need to add something in between.
Yes, if_cdce should return UMATCH_IFACECLASS_IFACESUBCLASS. Then we can
use UMATCH_IFACECLASS{_GENERIC,} if urndis matches against a vendor
protocol. Untested diff below, we may also add a comment explaining why
we need this workaround.
M.
Index: if_cdce.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_cdce.c,v
retrieving revision 1.51
diff -u -p -r1.51 if_cdce.c
--- if_cdce.c 9 Nov 2011 21:45:50 -0000 1.51
+++ if_cdce.c 21 Dec 2012 08:42:21 -0000
@@ -150,7 +150,7 @@ cdce_match(struct device *parent, void *
(id->bInterfaceSubClass ==
UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL ||
id->bInterfaceSubClass == UISUBCLASS_MOBILE_DIRECT_LINE_MODEL))
- return (UMATCH_IFACECLASS_GENERIC);
+ return (UMATCH_IFACECLASS_IFACESUBCLASS);
return (UMATCH_NONE);
}
Index: if_urndis.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_urndis.c,v
retrieving revision 1.35
diff -u -p -r1.35 if_urndis.c
--- if_urndis.c 5 Dec 2012 23:20:21 -0000 1.35
+++ if_urndis.c 24 Dec 2012 11:58:24 -0000
@@ -134,7 +134,6 @@ struct urndis_class {
u_int8_t subclass;
u_int8_t protocol;
} urndis_class[] = {
- { UICLASS_CDC, UISUBCLASS_ABSTRACT_CONTROL_MODEL, 0xff },
{ UICLASS_WIRELESS, UISUBCLASS_RF, UIPROTO_RNDIS },
{ UICLASS_MISC, UISUBCLASS_SYNC, UIPROTO_ACTIVESYNC }
};
@@ -1338,6 +1337,9 @@ urndis_match(struct device *parent, void
if (id == NULL)
return (UMATCH_NONE);
+ if (usb_lookup(urndis_devs, uaa->vendor, uaa->product) != NULL)
+ return (UMATCH_VENDOR_PRODUCT);
+
for (i = 0; i < nitems(urndis_class); i++) {
if (urndis_class[i].class == id->bInterfaceClass &&
urndis_class[i].subclass == id->bInterfaceSubClass &&
@@ -1345,8 +1347,12 @@ urndis_match(struct device *parent, void
return (UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO);
}
- return (usb_lookup(urndis_devs, uaa->vendor, uaa->product) != NULL) ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE;
+ if (id->bInterfaceClass == UICLASS_CDC &&
+ id->bInterfaceSubClass == UISUBCLASS_ABSTRACT_CONTROL_MODEL &&
+ id->bInterfaceProtocol == 0xff)
+ return (UMATCH_IFACECLASS_GENERIC);
+
+ return (UMATCH_NONE);
}
void