Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Feb 2009 20:17:12 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 157677 for review
Message-ID:  <200902132017.n1DKHCsT071861@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=157677

Change 157677 by jhb@jhb_jhbbsd on 2009/02/13 20:16:20

	IFC @157676

Affected files ...

.. //depot/projects/smpng/sys/dev/usb/u3g.c#6 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdevs#126 integrate
.. //depot/projects/smpng/sys/kern/subr_taskqueue.c#39 integrate
.. //depot/projects/smpng/sys/net/if_bridge.c#54 integrate
.. //depot/projects/smpng/sys/netinet/sctp_pcb.c#26 integrate
.. //depot/projects/smpng/sys/netinet/sctp_usrreq.c#23 integrate

Differences ...

==== //depot/projects/smpng/sys/dev/usb/u3g.c#6 (text+ko) ====

@@ -16,7 +16,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $FreeBSD: src/sys/dev/usb/u3g.c,v 1.22 2009/01/27 19:37:30 n_hibma Exp $
+ * $FreeBSD: src/sys/dev/usb/u3g.c,v 1.23 2009/02/13 19:49:51 n_hibma Exp $
  */
 
 /*
@@ -87,25 +87,25 @@
 
 
 struct u3g_speeds_s {
-	u_int32_t		ispeed;		// Speed in bits per second
-	u_int32_t		ospeed;		// Speed in bits per second
+	u_int32_t		ispeed;
+	u_int32_t		ospeed;
 };
 
 static const struct u3g_speeds_s u3g_speeds[] = {
-#define U3GSP_GPRS		0
-	{64000,   64000},
-#define U3GSP_EDGE		1
-	{384000,  64000},
-#define U3GSP_CDMA		2
-	{384000,  64000},
-#define U3GSP_UMTS		3
-	{384000,  64000},
-#define U3GSP_HSDPA		4
-	{1200000, 384000},
-#define U3GSP_HSUPA		5
-	{1200000, 384000},
-#define U3GSP_HSPA		6
-	{7200000, 384000},
+#define U3GSP_GPRS	0
+	{64000,		64000},
+#define U3GSP_EDGE	1
+	{384000,	64000},
+#define U3GSP_CDMA	2
+	{384000,	64000},
+#define U3GSP_UMTS	3
+	{384000,	64000},
+#define U3GSP_HSDPA	4
+	{1200000,	384000},
+#define U3GSP_HSUPA	5
+	{1200000,	384000},
+#define U3GSP_HSPA	6
+	{7200000,	384000},
 };
 
 #define U3GIBUFSIZE	1024
@@ -122,7 +122,8 @@
 #define U3GFL_HUAWEI_INIT	0x01		// Requires init command (Huawei cards)
 #define U3GFL_SCSI_EJECT	0x02		// Requires SCSI eject command (Novatel)
 #define U3GFL_SIERRA_INIT	0x04		// Requires init command (Sierra cards)
-#define U3GFL_STUB_WAIT		0x08		// Device reappears after a short delay
+#define U3GFL_CMOTECH_INIT	0x08		// Requires init command (CMOTECH cards)
+#define U3GFL_STUB_WAIT		0x80		// Device reappears after a short delay
 };
 
 // Note: The entries marked with XXX should be checked for the correct speed
@@ -184,10 +185,13 @@
 	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8765 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
 	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC875U },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
 	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8775_2 },		U3GSP_HSDPA,	U3GFL_NONE },		// XXX
-	{{ USB_VENDOR_HP, USB_PRODUCT_HP_HS2300 },			U3GSP_HSDPA,	U3GFL_NONE },		// XXX
 	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8780 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
 	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8781 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
-	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_TRUINSTALL },		U3GSP_UMTS,	U3GFL_SIERRA_INIT },	// Sierra TruInstaller device ID
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_TRUINSTALL },		U3GSP_UMTS,	U3GFL_SIERRA_INIT },
+	{{ USB_VENDOR_HP, USB_PRODUCT_HP_HS2300 },			U3GSP_HSDPA,	U3GFL_NONE },
+	/* OEM: CMOTECH */
+	{{ USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CGU628 },		U3GSP_HSDPA,	U3GFL_CMOTECH_INIT },
+	{{ USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_DISK },		U3GSP_HSDPA,	U3GFL_NONE },
 };
 #define u3g_lookup(v, p) ((const struct u3g_dev_type_s *)usb_lookup(u3g_devs, v, p))
 
@@ -437,7 +441,7 @@
 struct u3gstub_softc {
 	device_t		sc_dev;
 	usbd_device_handle	sc_udev;
-	usbd_pipe_handle 	sc_pipe;
+	usbd_pipe_handle 	sc_pipe_out, sc_pipe_in;
 	usbd_xfer_handle 	sc_xfer;
 };
 
@@ -457,6 +461,25 @@
 	return 1;
 }
 
+static void
+u3gstub_BBB_cb(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status err)
+{
+	struct u3gstub_softc *sc = (struct u3gstub_softc *) priv;
+	unsigned char cmd[13];
+
+	if (err) {
+		device_printf(sc->sc_dev,
+			      "Failed to send CD eject command to "
+		              "change to modem mode\n");
+	} else {
+		usbd_setup_xfer(sc->sc_xfer, sc->sc_pipe_in, NULL, cmd, sizeof(cmd),
+				0, USBD_DEFAULT_TIMEOUT, NULL);
+		int err = usbd_transfer(sc->sc_xfer) != USBD_NORMAL_COMPLETION;
+		if (err != USBD_NORMAL_COMPLETION && err != USBD_IN_PROGRESS)
+			DPRINTF("failed to start transfer (CSW)\n");
+	}
+}
+
 static int
 u3gstub_scsi_eject(struct u3gstub_softc *sc, struct usb_attach_arg *uaa)
 {
@@ -467,7 +490,7 @@
 	    0x55, 0x53, 0x42, 0x43,	/* 0..3: Command Block Wrapper (CBW) signature */
 	    0x01, 0x00, 0x00, 0x00,	/* 4..7: CBW Tag, unique 32-bit number */
 	    0x00, 0x00, 0x00, 0x00,	/* 8..11: CBW Transfer Length, no data here */
-	    0x00,			/* 12: CBW Flag: output, so 0 */
+	    0x00,			/* 12: CBW Flag: output */
 	    0x00,			/* 13: CBW Lun */
 	    0x06,			/* 14: CBW Length */
 
@@ -488,11 +511,33 @@
 
 	/* Find the bulk-out endpoints */
 	id = usbd_get_interface_descriptor(uaa->iface);
-	for (i = 0 ; i < id->bNumEndpoints ; i++) {
+	for (i = 0 ; i < id->bNumEndpoints; i++) {
 		ed = usbd_interface2endpoint_descriptor(uaa->iface, i);
 		if (ed != NULL
-		    && UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT
-		    && (ed->bmAttributes & UE_XFERTYPE) == UE_BULK)
+		    && (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) {
+			if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) {
+				if (usbd_open_pipe(uaa->iface,
+					           ed->bEndpointAddress,
+				                   USBD_EXCLUSIVE_USE,
+						   &sc->sc_pipe_out)
+				    != USBD_NORMAL_COMPLETION) {
+					DPRINTF("failed to open bulk-out pipe on endpoint %d\n",
+						ed->bEndpointAddress);
+					return 0;
+				}
+			} else {
+				if (usbd_open_pipe(uaa->iface,
+					           ed->bEndpointAddress,
+				                   USBD_EXCLUSIVE_USE,
+						   &sc->sc_pipe_in)
+				    != USBD_NORMAL_COMPLETION) {
+					DPRINTF("failed to open bulk-in pipe on endpoint %d\n",
+						ed->bEndpointAddress);
+					return 0;
+				}
+			}
+		}
+		if (sc->sc_pipe_out && sc->sc_pipe_in)
 			break;
 	}
 
@@ -501,10 +546,88 @@
 		return 0;
 	}
 
-	if (usbd_open_pipe(uaa->iface, ed->bEndpointAddress,
-			   USBD_EXCLUSIVE_USE, &sc->sc_pipe) != USBD_NORMAL_COMPLETION) {
-		DPRINTF("failed to open bulk-out pipe on endpoint %d\n",
-			ed->bEndpointAddress);
+	sc->sc_xfer = usbd_alloc_xfer(uaa->device);
+	if (sc->sc_xfer == NULL) {
+		DPRINTF("failed to allocate xfer\n");
+		return 0;
+	}
+
+	usbd_setup_xfer(sc->sc_xfer, sc->sc_pipe_out, NULL, cmd, sizeof(cmd),
+			0, USBD_DEFAULT_TIMEOUT, u3gstub_BBB_cb);
+	int err = usbd_transfer(sc->sc_xfer) != USBD_NORMAL_COMPLETION;
+	if (err != USBD_NORMAL_COMPLETION && err != USBD_IN_PROGRESS) {
+		DPRINTF("failed to start transfer (CBW)\n");
+		return 0;
+	}
+
+	return 1;
+}
+
+static int
+u3gstub_cmotech_init(struct u3gstub_softc *sc, struct usb_attach_arg *uaa)
+{
+	/* See definition of umass_bbb_cbw_t in sys/dev/usb/umass.c
+	 * in sys/cam/scsi/scsi_all.h .
+         */
+	unsigned char cmd[31] = {
+	    0x55, 0x53, 0x42, 0x43,	/* 0..3: Command Block Wrapper (CBW) signature */
+	    0x01, 0x00, 0x00, 0x00,	/* 4..7: CBW Tag, unique 32-bit number */
+	    0x00, 0x00, 0x00, 0x00,	/* 8..11: CBW Transfer Length, no data here */
+	    0x80,			/* 12: CBW Flag: output, so 0 */
+	    0x00,			/* 13: CBW Lun */
+	    0x08,			/* 14: CBW Length */
+
+	    0xff,			/* 15+0 */
+	    0x52,			/* 15+1 */
+	    0x44,			/* 15+2 */
+	    0x45,			/* 15+2 */
+	    0x56,			/* 15+4 */
+	    0x43,			/* 15+5 */
+	    0x48,			/* 15+5 */
+	    0x47,			/* 15+5 */
+	    0x00, 0x00, 0x00, 0x00,	/* 15+8..15: unused */
+	    0x00, 0x00, 0x00, 0x00
+	};
+
+	usb_interface_descriptor_t *id;
+	usb_endpoint_descriptor_t *ed = NULL;
+	int i;
+
+
+	/* Find the bulk-out endpoints */
+	id = usbd_get_interface_descriptor(uaa->iface);
+	for (i = 0 ; i < id->bNumEndpoints ; i++) {
+		ed = usbd_interface2endpoint_descriptor(uaa->iface, i);
+		if (ed != NULL
+		    && (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) {
+			if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) {
+				if (usbd_open_pipe(uaa->iface,
+					           ed->bEndpointAddress,
+				                   USBD_EXCLUSIVE_USE,
+						   &sc->sc_pipe_out)
+				    != USBD_NORMAL_COMPLETION) {
+					DPRINTF("failed to open bulk-out pipe on endpoint %d\n",
+						ed->bEndpointAddress);
+					return 0;
+				}
+			} else {
+				if (usbd_open_pipe(uaa->iface,
+					           ed->bEndpointAddress,
+				                   USBD_EXCLUSIVE_USE,
+						   &sc->sc_pipe_in)
+				    != USBD_NORMAL_COMPLETION) {
+					DPRINTF("failed to open bulk-in pipe on endpoint %d\n",
+						ed->bEndpointAddress);
+					return 0;
+				}
+			}
+		}
+		if (sc->sc_pipe_out && sc->sc_pipe_in)
+			break;
+	}
+
+	if (i == id->bNumEndpoints) {
+		DPRINTF("failed to find bulk-out pipe\n");
 		return 0;
 	}
 
@@ -514,11 +637,11 @@
 		return 0;
 	}
 
-	usbd_setup_xfer(sc->sc_xfer, sc->sc_pipe, NULL, cmd, sizeof(cmd),
-			0, USBD_DEFAULT_TIMEOUT, NULL);
+	usbd_setup_xfer(sc->sc_xfer, sc->sc_pipe_out, NULL, cmd, sizeof(cmd),
+			0, USBD_DEFAULT_TIMEOUT, u3gstub_BBB_cb);
 	int err = usbd_transfer(sc->sc_xfer) != USBD_NORMAL_COMPLETION;
 	if (err != USBD_NORMAL_COMPLETION && err != USBD_IN_PROGRESS) {
-		DPRINTF("failed to start transfer\n");
+		DPRINTF("failed to start transfer (CBW)\n");
 		return 0;
 	}
 
@@ -563,6 +686,7 @@
 	if (u3g_dev_type->flags&U3GFL_HUAWEI_INIT
 	    || u3g_dev_type->flags&U3GFL_SCSI_EJECT
 	    || u3g_dev_type->flags&U3GFL_SIERRA_INIT
+	    || u3g_dev_type->flags&U3GFL_CMOTECH_INIT
 	    || u3g_dev_type->flags&U3GFL_STUB_WAIT) {
 		/* We assume that if the first interface is still a mass
 		 * storage device the device has not yet changed appearance.
@@ -620,6 +744,12 @@
 				      "changing Sierra modem to modem mode\n");
 		if (!u3gstub_sierra_init(sc, uaa))
 			return ENXIO;
+	} else if (u3g_dev_type->flags&U3GFL_CMOTECH_INIT) {
+		if (bootverbose)
+			device_printf(sc->sc_dev,
+				      "changing CMOTECH modem to modem mode\n");
+		if (!u3gstub_cmotech_init(sc, uaa))
+			return ENXIO;
 	} else if (u3g_dev_type->flags&U3GFL_STUB_WAIT) {
 		if (bootverbose)
 			device_printf(sc->sc_dev, "waiting for modem to change "
@@ -638,9 +768,13 @@
 	if (sc->sc_xfer)
 		usbd_free_xfer(sc->sc_xfer);
 
-	if (sc->sc_pipe) {
-		usbd_abort_pipe(sc->sc_pipe);
-		usbd_close_pipe(sc->sc_pipe);
+	if (sc->sc_pipe_in) {
+		usbd_abort_pipe(sc->sc_pipe_in);
+		usbd_close_pipe(sc->sc_pipe_in);
+	}
+	if (sc->sc_pipe_out) {
+		usbd_abort_pipe(sc->sc_pipe_out);
+		usbd_close_pipe(sc->sc_pipe_out);
 	}
 
 	return 0;

==== //depot/projects/smpng/sys/dev/usb/usbdevs#126 (text+ko) ====

@@ -1,4 +1,4 @@
-$FreeBSD: src/sys/dev/usb/usbdevs,v 1.398 2009/02/06 15:03:17 kevlo Exp $
+$FreeBSD: src/sys/dev/usb/usbdevs,v 1.400 2009/02/13 19:49:51 n_hibma Exp $
 /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */
 
 /*-
@@ -613,7 +613,7 @@
 vendor GLOBALSUN	0x16ab	Global Sun Technology
 vendor ANYDATA		0x16d5	AnyDATA Corporation
 vendor JABLOTRON	0x16d6	Jablotron
-vendor CMOTECH		0x16d8	CMOTECH Co., Ltd.
+vendor CMOTECH		0x16d8	C-motech
 vendor AXESSTEL		0x1726  Axesstel Co., Ltd.
 vendor LINKSYS4		0x1737	Linksys
 vendor SENAO		0x1740	Senao
@@ -1030,9 +1030,11 @@
 product CISCOLINKSYS WUSBF54G	0x0024	WUSBF54G
 
 /* CMOTECH products */
-product CMOTECH CNU510		0x5141	CMOTECH CDMA Technologies USB modem
+product CMOTECH CNU510		0x5141	CDMA Technologies USB modem
 product CMOTECH CNU550		0x5543	CDMA 2000 1xRTT/1xEVDO USB modem
-product CMOTECH CDMA_MODEM1	0x6280	CMOTECH CDMA Technologies USB modem
+product CMOTECH CGU628		0x6006	CGU-628
+product CMOTECH CDMA_MODEM1	0x6280	CDMA Technologies USB modem
+product CMOTECH DISK		0xf000	disk mode
 
 /* Compaq products */
 product COMPAQ IPAQPOCKETPC	0x0003	iPAQ PocketPC
@@ -1866,6 +1868,8 @@
 product NOVATEL U727		0x4100	Merlin U727 CDMA
 product NOVATEL MC950D		0x4400	Novatel MC950D HSUPA
 product NOVATEL ZEROCD		0x5010	Novatel ZeroCD
+product NOVATEL ZEROCD2		0x5030	Novatel ZeroCD
+product NOVATEL U760		0x6000	Novatel U760
 product NOVATEL2 FLEXPACKGPS	0x0100	NovAtel FlexPack GPS receiver
 
 /* Merlin products */

==== //depot/projects/smpng/sys/kern/subr_taskqueue.c#39 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/subr_taskqueue.c,v 1.47 2009/02/13 01:16:51 thompsa Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/subr_taskqueue.c,v 1.48 2009/02/13 18:51:39 thompsa Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -402,7 +402,7 @@
 	while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) {
 		taskqueue_run(tq);
 		TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0);
-	};
+	}
 
 	/* rendezvous with thread that asked us to terminate */
 	tq->tq_tcount--;

==== //depot/projects/smpng/sys/net/if_bridge.c#54 (text+ko) ====

@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net/if_bridge.c,v 1.120 2008/12/10 23:12:39 zec Exp $");
+__FBSDID("$FreeBSD: src/sys/net/if_bridge.c,v 1.121 2009/02/13 19:20:25 thompsa Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -220,6 +220,7 @@
 	LIST_HEAD(, bridge_iflist) sc_spanlist;	/* span ports list */
 	struct bstp_state	sc_stp;		/* STP state */
 	uint32_t		sc_brtexceeded;	/* # of cache drops */
+	struct ifnet		*sc_ifaddr;	/* member mac copied from */
 	u_char			sc_defaddr[6];	/* Default MAC address */
 };
 
@@ -930,15 +931,16 @@
 	 * the mac address of the bridge to the address of the next member, or
 	 * to its default address if no members are left.
 	 */
-	if (bridge_inherit_mac &&
-	    !memcmp(IF_LLADDR(sc->sc_ifp), IF_LLADDR(ifs), ETHER_ADDR_LEN)) {
-		if (LIST_EMPTY(&sc->sc_iflist))
+	if (bridge_inherit_mac && sc->sc_ifaddr == ifs) {
+		if (LIST_EMPTY(&sc->sc_iflist)) {
 			bcopy(sc->sc_defaddr,
 			    IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN);
-		else {
+			sc->sc_ifaddr = NULL;
+		} else {
 			fif = LIST_FIRST(&sc->sc_iflist)->bif_ifp;
 			bcopy(IF_LLADDR(fif),
 			    IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN);
+			sc->sc_ifaddr = fif;
 		}
 	}
 
@@ -1039,8 +1041,10 @@
 	 * the default randomly generated one.
 	 */
 	if (bridge_inherit_mac && LIST_EMPTY(&sc->sc_iflist) &&
-	    !memcmp(IF_LLADDR(sc->sc_ifp), sc->sc_defaddr, ETHER_ADDR_LEN))
+	    !memcmp(IF_LLADDR(sc->sc_ifp), sc->sc_defaddr, ETHER_ADDR_LEN)) {
 		bcopy(IF_LLADDR(ifs), IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN);
+		sc->sc_ifaddr = ifs;
+	}
 
 	ifs->if_bridge = sc;
 	bstp_create(&sc->sc_stp, &bif->bif_stp, bif->bif_ifp);

==== //depot/projects/smpng/sys/netinet/sctp_pcb.c#26 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_pcb.c,v 1.38 2005/03/06 16:04:18 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_pcb.c,v 1.80 2009/02/03 11:04:03 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_pcb.c,v 1.81 2009/02/13 18:44:30 rrs Exp $");
 
 #include <netinet/sctp_os.h>
 #include <sys/proc.h>
@@ -2649,9 +2649,9 @@
 				 * will transmute the ip address to the
 				 * proper value.
 				 */
-				if (p && prison_local_ip4(p->td_ucred, &sin->sin_addr) != 0) {
-					SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL);
-					return (EINVAL);
+				if (p && (error = prison_local_ip4(p->td_ucred, &sin->sin_addr)) != 0) {
+					SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error);
+					return (error);
 				}
 				if (sin->sin_addr.s_addr != INADDR_ANY) {
 					bindall = 0;
@@ -2680,10 +2680,10 @@
 				 * will transmute the ipv6 address to the
 				 * proper value.
 				 */
-				if (p && prison_local_ip6(p->td_ucred, &sin6->sin6_addr,
-				    (SCTP_IPV6_V6ONLY(inp) != 0)) != 0) {
-					SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL);
-					return (EINVAL);
+				if (p && (error = prison_local_ip6(p->td_ucred, &sin6->sin6_addr,
+				    (SCTP_IPV6_V6ONLY(inp) != 0))) != 0) {
+					SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error);
+					return (error);
 				}
 				if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
 					bindall = 0;

==== //depot/projects/smpng/sys/netinet/sctp_usrreq.c#23 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_usrreq.c,v 1.48 2005/03/07 23:26:08 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_usrreq.c,v 1.63 2009/02/03 11:04:03 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_usrreq.c,v 1.64 2009/02/13 18:44:30 rrs Exp $");
 #include <netinet/sctp_os.h>
 #include <sys/proc.h>
 #include <netinet/sctp_pcb.h>
@@ -4088,9 +4088,8 @@
 					error = EINVAL;
 					break;
 				}
-				if (td != NULL && prison_local_ip4(td->td_ucred, &(((struct sockaddr_in *)(addrs->addr))->sin_addr))) {
-					SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EADDRNOTAVAIL);
-					error = EADDRNOTAVAIL;
+				if (td != NULL && (error = prison_local_ip4(td->td_ucred, &(((struct sockaddr_in *)(addrs->addr))->sin_addr)))) {
+					SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
 					break;
 				}
 #ifdef INET6
@@ -4101,10 +4100,9 @@
 					error = EINVAL;
 					break;
 				}
-				if (td != NULL && prison_local_ip6(td->td_ucred, &(((struct sockaddr_in6 *)(addrs->addr))->sin6_addr),
-				    (SCTP_IPV6_V6ONLY(inp) != 0)) != 0) {
-					SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EADDRNOTAVAIL);
-					error = EADDRNOTAVAIL;
+				if (td != NULL && (error = prison_local_ip6(td->td_ucred, &(((struct sockaddr_in6 *)(addrs->addr))->sin6_addr),
+				    (SCTP_IPV6_V6ONLY(inp) != 0))) != 0) {
+					SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
 					break;
 				}
 #endif
@@ -4133,9 +4131,8 @@
 					error = EINVAL;
 					break;
 				}
-				if (td != NULL && prison_local_ip4(td->td_ucred, &(((struct sockaddr_in *)(addrs->addr))->sin_addr))) {
-					SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EADDRNOTAVAIL);
-					error = EADDRNOTAVAIL;
+				if (td != NULL && (error = prison_local_ip4(td->td_ucred, &(((struct sockaddr_in *)(addrs->addr))->sin_addr)))) {
+					SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
 					break;
 				}
 #ifdef INET6
@@ -4146,10 +4143,9 @@
 					error = EINVAL;
 					break;
 				}
-				if (td != NULL && prison_local_ip6(td->td_ucred, &(((struct sockaddr_in6 *)(addrs->addr))->sin6_addr),
-				    (SCTP_IPV6_V6ONLY(inp) != 0)) != 0) {
-					SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EADDRNOTAVAIL);
-					error = EADDRNOTAVAIL;
+				if (td != NULL && (error = prison_local_ip6(td->td_ucred, &(((struct sockaddr_in6 *)(addrs->addr))->sin6_addr),
+				    (SCTP_IPV6_V6ONLY(inp) != 0))) != 0) {
+					SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
 					break;
 				}
 #endif
@@ -4256,9 +4252,9 @@
 			return (EINVAL);
 		}
 		sin6p = (struct sockaddr_in6 *)addr;
-		if (p != NULL && prison_remote_ip6(p->td_ucred, &sin6p->sin6_addr) != 0) {
-			SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
-			return (EINVAL);
+		if (p != NULL && (error = prison_remote_ip6(p->td_ucred, &sin6p->sin6_addr)) != 0) {
+			SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
+			return (error);
 		}
 	} else
 #endif
@@ -4270,9 +4266,9 @@
 			return (EINVAL);
 		}
 		sinp = (struct sockaddr_in *)addr;
-		if (p != NULL && prison_remote_ip4(p->td_ucred, &sinp->sin_addr) != 0) {
-			SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
-			return (EINVAL);
+		if (p != NULL && (error = prison_remote_ip4(p->td_ucred, &sinp->sin_addr)) != 0) {
+			SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
+			return (error);
 		}
 	} else {
 		SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EAFNOSUPPORT);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902132017.n1DKHCsT071861>