Hello all,

I'm sending this email to check whether my approach is reasonable that I
added 2 line into ifconfig(8) to skip IFT_USB interfaces as follows:

+               if (sdl != NULL && sdl->sdl_type == IFT_USB)
+                       continue;

And as additionally I added two changes of USB pf to call if_up(ifp) /
if_down(ifp) explicitly to UP usbus interfaces though normally it always
should be called through user ioctl calls.

The reason why I make this patch is that I encountered a side-effect
output from ifconfig(8) after USB packet filter is committed.  Yes usbus
interfaces are printed.

Please give me some hints whether the patch is reasonable.  If it's
reasonable, is there other tools which I should make patches?

regards,
Weongyo Jeong

Index: sbin/ifconfig/ifconfig.c
===================================================================
--- sbin/ifconfig/ifconfig.c	(revision 215648)
+++ sbin/ifconfig/ifconfig.c	(working copy)
@@ -295,6 +295,8 @@
 			sdl = (const struct sockaddr_dl *) ifa->ifa_addr;
 		else
 			sdl = NULL;
+		if (sdl != NULL && sdl->sdl_type == IFT_USB)
+			continue;
 		if (cp != NULL && strcmp(cp, ifa->ifa_name) == 0 && !namesonly)
 			continue;
 		iflen = strlcpy(name, ifa->ifa_name, sizeof(name));
Index: sys/dev/usb/usb_pf.c
===================================================================
--- sys/dev/usb/usb_pf.c	(revision 215812)
+++ sys/dev/usb/usb_pf.c	(working copy)
@@ -65,6 +65,7 @@
 	ifp = ubus->ifp = if_alloc(IFT_USB);
 	if_initname(ifp, "usbus", device_get_unit(ubus->bdev));
 	if_attach(ifp);
+	if_up(ifp);
 
 	KASSERT(sizeof(struct usbpf_pkthdr) == USBPF_HDR_LEN,
 	    ("wrong USB pf header length (%zd)", sizeof(struct usbpf_pkthdr)));
@@ -86,6 +87,7 @@
 
 	if (ifp != NULL) {
 		bpfdetach(ifp);
+		if_down(ifp);
 		if_detach(ifp);
 		if_free(ifp);
 	}
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to