svn commit: r324860 - head/share/man/man4

2017-10-22 Thread Bruce M Simpson
Author: bms
Date: Sun Oct 22 11:40:55 2017
New Revision: 324860
URL: https://svnweb.freebsd.org/changeset/base/324860

Log:
  Modernise this man page somewhat.
  
  1. Add a reference to a good 3rd party list of compatible cables, but
  provide suggestions for 'known good' vendors.
  
  2. Change IP-based USB host-host example to a modern Ethernet one which
  works 'out of box' with current Linux systems.
  
  3. Explain that USB 3.0 is host-host, even though point-to-point soft
  Ethernet can be achieved.
  
  MFC after:3 weeks

Modified:
  head/share/man/man4/udbp.4

Modified: head/share/man/man4/udbp.4
==
--- head/share/man/man4/udbp.4  Sun Oct 22 11:21:31 2017(r324859)
+++ head/share/man/man4/udbp.4  Sun Oct 22 11:40:55 2017(r324860)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 22, 2006
+.Dd October 20, 2017
 .Dt UDBP 4
 .Os
 .Sh NAME
@@ -48,9 +48,14 @@ udbp_load="YES"
 The
 .Nm
 driver provides support for host-to-host cables
-that contain at least two bulk pipes (one for each direction),
-for example
-the EzLink cable and the NetChip 1080 chip.
+that contain at least two bulk pipes (one for each direction).
+This typically includes cables branded for use with
+.Sy Windows USB Easy Transfer ,
+and many cables based on the Prolific PL2xx1 series of USB bridge chips.
+A useful (but non-comprehensive) list of compatible USB host cables
+is listed in the
+.Sx SEE ALSO
+section below.
 .Pp
 .\" XXXThe description of how to add netgraph to the kernel
 .\"is out of place here.  It should be limited to the
@@ -86,30 +91,64 @@ module and then the
 .Nm
 driver.
 .Pp
-.Dl ngctl mkpeer udbp0: iface data inet
-.Dl ifconfig ng0 10.0.0.1 10.0.0.2
+.Dl ngctl mkpeer udbp0: eiface data ether
+.Dl ifconfig ngeth0 ether aa:dd:xx:xx:xx
+.Dl ifconfig ngeth0 inet 169.254.x.x/16
 .Pp
-Create a new network interface node
-and connect its inet hook to the data hook of the
+Create a new Ethernet network interface node
+and connect its ether hook to the data hook of the
 .Nm
-node.
-.Xr ifconfig 8
-configures the resulting network interface ng0 with a local
-IP address of 10.0.0.1 and a remote IP address of 10.0.0.2.
-On the remote host, the two
-IP addresses should of course be reversed.
+driver.
+.Pp
+This enables FreeBSD to communicate with a Linux peer (e.g. using the
+.Sy plusb
+driver).
+The Linux node should be configured to prefer link-local IPv4 addresses
+(e.g. using Network Manager in Debian and Red Hat derived distributions).
+.Pp
+Whilst both FreeBSD and Linux are able to interoperate by
+loosely following CDC EEM 1.0 in their behaviour, neither implementation
+has been expressly designed to follow its specification.
 .Sh SEE ALSO
 .Xr netgraph 4 ,
-.Xr ng_iface 4 ,
+.Xr ng_eiface 4 ,
 .Xr ohci 4 ,
 .Xr uhci 4 ,
 .Xr usb 4 ,
 .Xr ngctl 8
+.\"
+.Rs
+.%B Universal Serial Bus: Communications Class Subclass Specification for 
Ethernet Emulation Model Devices 
+.%N Revision 1.0
+.%D February 2, 2005
+.%I USB Implementers Forum, Inc.
+.%U http://www.usb.org/developers/docs/devclass_docs/CDC_EEM10.pdf
+.Re
+.\"
+.Rs
+.%B Total Commander: Supported cables for USB cable connection
+.%I Ghisler Software GmbH.
+.%U https://www.ghisler.com/cables/index.htm
+.Re
+.Sh CAVEATS
+The point-to-point nature and additional latency of USB host-host links
+makes them unsuitable as a "drop-in" replacement for an Ethernet LAN;
+for a USB 3.0 SuperSpeed cable, latency is comparable to 100BaseTX Ethernet
+(but often worse), with throughput comparable to 2.5GBASE-T.
+.Pp
+However, their energy efficiency makes them attractive for embedded
+applications. A Plugable PL27A1 cable claims 24mA of USB3 bus power,
+as compared to 150mA for a typical USB 3.0 to Gigabit Ethernet interface.
 .Sh HISTORY
 The
 .Nm
 driver first appeared in
 .Fx 5.0 .
+.Sh BUGS
+The
+.Nm
+driver does not support the special packets described in section 5.1
+of the CDC EEM specification.
 .Sh AUTHORS
 .An -nosplit
 The
@@ -121,4 +160,6 @@ and
 .An Nick Hibma Aq Mt n_hi...@freebsd.org .
 .Pp
 This manual page was written by
-.An Nick Hibma Aq Mt n_hi...@freebsd.org .
+.An Nick Hibma Aq Mt n_hi...@freebsd.org 
+and updated by
+.An Bruce Simpson Aq Mt b...@freebsd.org .
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r324858 - in head/sys/dev/usb: . misc

2017-10-22 Thread Bruce M Simpson
Author: bms
Date: Sun Oct 22 11:15:58 2017
New Revision: 324858
URL: https://svnweb.freebsd.org/changeset/base/324858

Log:
  Add Prolific PL27A1 USB 3.0 Host-Host device to udbp(4).
  
  Tested with a Plugable cable in VirtualBox against Linux 4.11.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/usb/misc/udbp.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/misc/udbp.c
==
--- head/sys/dev/usb/misc/udbp.cSun Oct 22 10:35:29 2017
(r324857)
+++ head/sys/dev/usb/misc/udbp.cSun Oct 22 11:15:58 2017
(r324858)
@@ -264,6 +264,7 @@ static const STRUCT_USB_HOST_ID udbp_devs[] = {
{USB_VPI(USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_GADGETZERO, 0)},
{USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2301, 0)},
{USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2302, 0)},
+   {USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL27A1, 0)},
{USB_VPI(USB_VENDOR_ANCHOR, USB_PRODUCT_ANCHOR_EZLINK, 0)},
{USB_VPI(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL620USB, 0)},
 };

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsSun Oct 22 10:35:29 2017(r324857)
+++ head/sys/dev/usb/usbdevsSun Oct 22 11:15:58 2017(r324858)
@@ -3679,6 +3679,7 @@ product PROLIFIC PL2305   0x2305  Parallel printer
 product PROLIFIC ATAPI40x2307  ATAPI-4 Controller
 product PROLIFIC PL25010x2501  PL2501 Host-Host interface
 product PROLIFIC PL25060x2506  PL2506 USB to IDE Bridge
+product PROLIFIC PL27A10x27A1  PL27A1 USB 3.0 Host-Host 
interface
 product PROLIFIC HCR3310x331a  HCR331 Hybrid Card Reader
 product PROLIFIC PHAROS0xaaa0  Prolific Pharos
 product PROLIFIC RSAQ3 0xaaa2  PL2303 Serial Adapter (IODATA USB-RSAQ3)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314345 - head/sys/dev/usb/controller

2017-02-27 Thread Bruce M Simpson
Author: bms
Date: Mon Feb 27 17:04:35 2017
New Revision: 314345
URL: https://svnweb.freebsd.org/changeset/base/314345

Log:
  Add ID for NEC uPD720202 xHCI controller.
  
  MFC after:1 month

Modified:
  head/sys/dev/usb/controller/xhci_pci.c

Modified: head/sys/dev/usb/controller/xhci_pci.c
==
--- head/sys/dev/usb/controller/xhci_pci.c  Mon Feb 27 16:55:09 2017
(r314344)
+++ head/sys/dev/usb/controller/xhci_pci.c  Mon Feb 27 17:04:35 2017
(r314345)
@@ -100,6 +100,8 @@ xhci_pci_match(device_t self)
 
case 0x01941033:
return ("NEC uPD720200 USB 3.0 controller");
+   case 0x00151912:
+   return ("NEC uPD720202 USB 3.0 controller");
 
case 0x10001b73:
return ("Fresco Logic FL1000G USB 3.0 controller");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r311987 - head/sys/dev/uart

2017-01-12 Thread Bruce M Simpson
Author: bms
Date: Thu Jan 12 16:30:27 2017
New Revision: 311987
URL: https://svnweb.freebsd.org/changeset/base/311987

Log:
  Allow uart(4) to use MSI interrupts on single-port PCI instances.
  
  Do this here as puc(4) disallows single-port instances; at least
  one multi-port PCIe UART chip (in this case, the ASIX MCS9922)
  present separate PCI configuration space (functions) for each UART.
  
  Tested using lrzsz and a null-modem cable. The ExpressCard/34
  variants containing the MCS9922 should also use MSI with this change.
  
  Reviewed by:  jhb, imp, rpokala
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D9123

Modified:
  head/sys/dev/uart/uart_bus_pci.c
  head/sys/dev/uart/uart_core.c

Modified: head/sys/dev/uart/uart_bus_pci.c
==
--- head/sys/dev/uart/uart_bus_pci.cThu Jan 12 16:24:10 2017
(r311986)
+++ head/sys/dev/uart/uart_bus_pci.cThu Jan 12 16:30:27 2017
(r311987)
@@ -45,12 +45,14 @@ __FBSDID("$FreeBSD$");
 #defineDEFAULT_RCLK1843200
 
 static int uart_pci_probe(device_t dev);
+static int uart_pci_attach(device_t dev);
+static int uart_pci_detach(device_t dev);
 
 static device_method_t uart_pci_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, uart_pci_probe),
-   DEVMETHOD(device_attach,uart_bus_attach),
-   DEVMETHOD(device_detach,uart_bus_detach),
+   DEVMETHOD(device_attach,uart_pci_attach),
+   DEVMETHOD(device_detach,uart_pci_detach),
DEVMETHOD(device_resume,uart_bus_resume),
DEVMETHOD_END
 };
@@ -209,4 +211,40 @@ uart_pci_probe(device_t dev)
return (result);
 }
 
+static int
+uart_pci_attach(device_t dev)
+{
+   struct uart_softc *sc;
+   int count;
+
+   sc = device_get_softc(dev);
+
+   /*
+* Use MSI in preference to legacy IRQ if available.
+* Whilst some PCIe UARTs support >1 MSI vector, use only the first.
+*/
+   if (pci_msi_count(dev) > 0) {
+   count = 1;
+   if (pci_alloc_msi(dev, ) == 0) {
+   sc->sc_irid = 1;
+   device_printf(dev, "Using %d MSI message\n", count);
+   }
+   }
+
+   return (uart_bus_attach(dev));
+}
+
+static int
+uart_pci_detach(device_t dev)
+{
+   struct uart_softc *sc;
+
+   sc = device_get_softc(dev);
+
+   if (sc->sc_irid != 0)
+   pci_release_msi(dev);
+
+   return (uart_bus_detach(dev));
+}
+
 DRIVER_MODULE(uart, pci, uart_pci_driver, uart_devclass, NULL, NULL);

Modified: head/sys/dev/uart/uart_core.c
==
--- head/sys/dev/uart/uart_core.c   Thu Jan 12 16:24:10 2017
(r311986)
+++ head/sys/dev/uart/uart_core.c   Thu Jan 12 16:30:27 2017
(r311987)
@@ -677,7 +677,6 @@ uart_bus_attach(device_t dev)
 * safest thing to do.
 */
if (filt != FILTER_SCHEDULE_THREAD && !uart_force_poll) {
-   sc->sc_irid = 0;
sc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ,
>sc_irid, RF_ACTIVE | RF_SHAREABLE);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r311847 - head/sys/dev/usb/misc

2017-01-09 Thread Bruce M Simpson
Author: bms
Date: Tue Jan 10 01:31:26 2017
New Revision: 311847
URL: https://svnweb.freebsd.org/changeset/base/311847

Log:
  Allow udbp(4) to claim Belkin "Windows Easy Transfer Cable" for Netgraph use.
  
  These have been tested back-to-back with Linux 3.x and a similar attachment
  at the other end; a CDC EEM-like encapsulation can be used for emulated
  Ethernet over udbp(4) with ng_ether.

Modified:
  head/sys/dev/usb/misc/udbp.c

Modified: head/sys/dev/usb/misc/udbp.c
==
--- head/sys/dev/usb/misc/udbp.cTue Jan 10 01:30:41 2017
(r311846)
+++ head/sys/dev/usb/misc/udbp.cTue Jan 10 01:31:26 2017
(r311847)
@@ -259,6 +259,7 @@ static driver_t udbp_driver = {
 };
 
 static const STRUCT_USB_HOST_ID udbp_devs[] = {
+   {USB_VPI(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U258, 0)},
{USB_VPI(USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_TURBOCONNECT, 0)},
{USB_VPI(USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_GADGETZERO, 0)},
{USB_VPI(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2301, 0)},
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r311844 - head/sys/dev/usb

2017-01-09 Thread Bruce M Simpson
Author: bms
Date: Tue Jan 10 00:28:01 2017
New Revision: 311844
URL: https://svnweb.freebsd.org/changeset/base/311844

Log:
  Add PID for Belkin F5U258 "Windows Easy Transfer Cable", a udbp-like device.

Modified:
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsTue Jan 10 00:03:43 2017(r311843)
+++ head/sys/dev/usb/usbdevsTue Jan 10 00:28:01 2017(r311844)
@@ -1318,6 +1318,7 @@ product BELKIN RTL8188CU  0x1102  RTL8188
 product BELKIN F9L1103 0x1103  F9L1103 Wireless Adapter
 product BELKIN RTL8192CU   0x2102  RTL8192CU Wireless Adapter
 product BELKIN F7D2102 0x2103  F7D2102 Wireless Adapter
+product BELKIN F5U258  0x258A  F5U258 Host to Host cable
 product BELKIN ZD1211B 0x4050  ZD1211B
 product BELKIN F5D5055 0x5055  F5D5055
 product BELKIN F5D7050 0x7050  F5D7050 Wireless Adapter
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r264323 - head/sys/net

2014-04-10 Thread Bruce M Simpson
Author: bms
Date: Thu Apr 10 18:43:02 2014
New Revision: 264323
URL: http://svnweb.freebsd.org/changeset/base/264323

Log:
  In if_freemulti(), relax the paranoid KASSERT() on ifma-ifma_protospec.
  
  This KASSERT() existed as a sanity check that upper layers in the network
  stack (e.g. inet, inet6) had released their reference to the underlying
  driver's multicast memberships (ifmultiaddr{}). However it assumes the
  lifecycle of the driver membership corresponds to the lifecycle of the
  network layer membership.
  
  In the submitter's case, ieee80211_ioctl_updatemulti() attempts to
  reprogram the (parent, physical) ifnet{} memberships in response
  to a change in membership on the (child, virtual) VAP ifnet, using
  a batched update mechanism. These updates happen independently from
  the network layer, causing a false negative assertion failure.
  
  There are possibly other use cases where this KASSERT() may be triggered
  by other networking stack activity (e.g. where a nesting relationship
  exists between multiple ifnet{} instances). This suggests that further
  review of FreeBSD's approach to nested ifnet relationships is needed.
  
  MFC after:6 weeks
  Submitted by: adrian@

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Thu Apr 10 18:34:26 2014(r264322)
+++ head/sys/net/if.c   Thu Apr 10 18:43:02 2014(r264323)
@@ -2937,8 +2937,6 @@ if_freemulti(struct ifmultiaddr *ifma)
 
KASSERT(ifma-ifma_refcount == 0, (if_freemulti: refcount %d,
ifma-ifma_refcount));
-   KASSERT(ifma-ifma_protospec == NULL,
-   (if_freemulti: protospec not NULL));
 
if (ifma-ifma_lladdr != NULL)
free(ifma-ifma_lladdr, M_IFMADDR);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r257921 - head/share/man/man3

2013-11-10 Thread Bruce M Simpson
Author: bms
Date: Sun Nov 10 19:41:04 2013
New Revision: 257921
URL: http://svnweb.freebsd.org/changeset/base/257921

Log:
  Document the RB_FOREACH_FROM() and RB_FOREACH_REVERSE_FROM() macros.
  
  These are largely syntactic sugar. However, they improve code
  readability where an RB_FOREACH() or RB_FOREACH_REVERSE()
  traversal has been interrupted and must be resumed. Performance
  is improved by avoiding unnecessary traversal from the head node.

Modified:
  head/share/man/man3/tree.3

Modified: head/share/man/man3/tree.3
==
--- head/share/man/man3/tree.3  Sun Nov 10 18:46:59 2013(r257920)
+++ head/share/man/man3/tree.3  Sun Nov 10 19:41:04 2013(r257921)
@@ -30,7 +30,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd November 4, 2013
+.Dd November 10, 2013
 .Dt TREE 3
 .Os
 .Sh NAME
@@ -70,8 +70,10 @@
 .Nm RB_RIGHT ,
 .Nm RB_PARENT ,
 .Nm RB_FOREACH ,
+.Nm RB_FOREACH_FROM ,
 .Nm RB_FOREACH_SAFE ,
 .Nm RB_FOREACH_REVERSE ,
+.Nm RB_FOREACH_REVERSE_FROM ,
 .Nm RB_FOREACH_REVERSE_SAFE ,
 .Nm RB_INIT ,
 .Nm RB_INSERT ,
@@ -137,8 +139,10 @@
 .Ft struct TYPE *
 .Fn RB_PARENT struct TYPE *elm RB_ENTRY NAME
 .Fn RB_FOREACH VARNAME NAME RB_HEAD *head
+.Fn RB_FOREACH_FROM VARNAME NAME RB_HEAD *head POS_VARNAME
 .Fn RB_FOREACH_SAFE VARNAME NAME RB_HEAD *head TEMP_VARNAME
 .Fn RB_FOREACH_REVERSE VARNAME NAME RB_HEAD *head
+.Fn RB_FOREACH_REVERSE_FROM VARNAME NAME RB_HEAD *head POS_VARNAME
 .Fn RB_FOREACH_REVERSE_SAFE VARNAME NAME RB_HEAD *head TEMP_VARNAME
 .Ft void
 .Fn RB_INIT RB_HEAD *head
@@ -470,6 +474,15 @@ they permit both the removal of np
 as well as freeing it from within the loop safely
 without interfering with the traversal.
 .Pp
+Both
+.Fn RB_FOREACH_FROM
+and
+.Fn RB_FOREACH_REVERSE_FROM
+may be used to continue an interrupted traversal
+in a forward or reverse direction respectively.
+The resume point should be passed as their last argument,
+and will be overwritten to provide safe traversal.
+.Pp
 The
 .Fn RB_EMPTY
 macro should be used to check whether a red-black tree is empty.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r257922 - head/share/man/man3

2013-11-10 Thread Bruce M Simpson
Author: bms
Date: Sun Nov 10 19:49:18 2013
New Revision: 257922
URL: http://svnweb.freebsd.org/changeset/base/257922

Log:
  RB_FOREACH_[REVERSE_]FROM() do not require the head pointer. Reword.

Modified:
  head/share/man/man3/tree.3

Modified: head/share/man/man3/tree.3
==
--- head/share/man/man3/tree.3  Sun Nov 10 19:41:04 2013(r257921)
+++ head/share/man/man3/tree.3  Sun Nov 10 19:49:18 2013(r257922)
@@ -139,10 +139,10 @@
 .Ft struct TYPE *
 .Fn RB_PARENT struct TYPE *elm RB_ENTRY NAME
 .Fn RB_FOREACH VARNAME NAME RB_HEAD *head
-.Fn RB_FOREACH_FROM VARNAME NAME RB_HEAD *head POS_VARNAME
+.Fn RB_FOREACH_FROM VARNAME NAME POS_VARNAME
 .Fn RB_FOREACH_SAFE VARNAME NAME RB_HEAD *head TEMP_VARNAME
 .Fn RB_FOREACH_REVERSE VARNAME NAME RB_HEAD *head
-.Fn RB_FOREACH_REVERSE_FROM VARNAME NAME RB_HEAD *head POS_VARNAME
+.Fn RB_FOREACH_REVERSE_FROM VARNAME NAME POS_VARNAME
 .Fn RB_FOREACH_REVERSE_SAFE VARNAME NAME RB_HEAD *head TEMP_VARNAME
 .Ft void
 .Fn RB_INIT RB_HEAD *head
@@ -480,7 +480,9 @@ and
 .Fn RB_FOREACH_REVERSE_FROM
 may be used to continue an interrupted traversal
 in a forward or reverse direction respectively.
-The resume point should be passed as their last argument,
+The head pointer is not required.
+The pointer to the node from where to resume the traversal
+should be passed as their last argument,
 and will be overwritten to provide safe traversal.
 .Pp
 The
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r252506 - head/sbin/dhclient

2013-07-02 Thread Bruce M Simpson
Author: bms
Date: Tue Jul  2 13:24:37 2013
New Revision: 252506
URL: http://svnweb.freebsd.org/changeset/base/252506

Log:
  When acquiring a lease, record the value of the BOOTP siaddr field
  contained in the DHCP offer, and write it out to the lease file
  as an unquoted value of the next-server keyword. The value is ignored
  when the lease is read back by dhclient, however other applications
  are free to parse it.
  
  The intent behind this change is to allow easier interoperability
  with automated installation systems e.g. Cobbler, Foreman, Razor;
  FreeBSD installation kernels can automatically probe the network
  to discover deployment servers.  There are no plans to MFC this
  change unless a backport is specifically requested.
  
  The syntax of the next-server ip lease keyword is intended to be
  identical to that used by the ISC DHCPD server in its configuration files.
  The required defines are already present in dhclient but were unused before
  this change. (Note: This is NOT the same as Option 66, tftp-server-name).
  
  It has been exercised in a university protocol testbed environment, with
  Cobbler and an mfsBSD image containing pc-sysinstall (driven by Cobbler
  Cheetah templates). The SYSLINUX memdisk driver is used to boot mfsBSD.
  Currently this approach requires that a dedicated system profile has
  been created for the node where FreeBSD is to be deployed. If this
  is not present, the pc-sysinstall wrapper will be unable to obtain
  a node configuration. There is code in progress to allow mfsBSD images
  to obtain the required hints from the memdisk environment by parsing
  the MBFT ACPI chunk.  This is non-standard as it is not linked into
  the platform's ACPI RSDT.
  
  Reviewed by:  des

Modified:
  head/sbin/dhclient/clparse.c
  head/sbin/dhclient/dhclient.c
  head/sbin/dhclient/dhcpd.h

Modified: head/sbin/dhclient/clparse.c
==
--- head/sbin/dhclient/clparse.cTue Jul  2 10:36:57 2013
(r252505)
+++ head/sbin/dhclient/clparse.cTue Jul  2 13:24:37 2013
(r252506)
@@ -642,6 +642,10 @@ parse_client_lease_declaration(FILE *cfi
case FILENAME:
lease-filename = parse_string(cfile);
return;
+   case NEXT_SERVER:
+   if (!parse_ip_addr(cfile, lease-nextserver))
+   return;
+   break;
case SERVER_NAME:
lease-server_name = parse_string(cfile);
return;

Modified: head/sbin/dhclient/dhclient.c
==
--- head/sbin/dhclient/dhclient.c   Tue Jul  2 10:36:57 2013
(r252505)
+++ head/sbin/dhclient/dhclient.c   Tue Jul  2 13:24:37 2013
(r252506)
@@ -1063,6 +1063,9 @@ packet_to_lease(struct packet *packet)
lease-address.len = sizeof(packet-raw-yiaddr);
memcpy(lease-address.iabuf, packet-raw-yiaddr, lease-address.len);
 
+   lease-nextserver.len = sizeof(packet-raw-siaddr);
+   memcpy(lease-nextserver.iabuf, packet-raw-siaddr, 
lease-nextserver.len);
+
/* If the server name was filled out, copy it.
   Do not attempt to validate the server name as a host name.
   RFC 2131 merely states that sname is NUL-terminated (which do
@@ -1874,6 +1877,11 @@ write_client_lease(struct interface_info
fprintf(leaseFile,   bootp;\n);
fprintf(leaseFile,   interface \%s\;\n, ip-name);
fprintf(leaseFile,   fixed-address %s;\n, piaddr(lease-address));
+   if (lease-nextserver.len == sizeof(inaddr_any) 
+   0 != memcmp(lease-nextserver.iabuf, inaddr_any,
+   sizeof(inaddr_any)))
+   fprintf(leaseFile,   next-server %s;\n,
+   piaddr(lease-nextserver));
if (lease-filename)
fprintf(leaseFile,   filename \%s\;\n, lease-filename);
if (lease-server_name)

Modified: head/sbin/dhclient/dhcpd.h
==
--- head/sbin/dhclient/dhcpd.h  Tue Jul  2 10:36:57 2013(r252505)
+++ head/sbin/dhclient/dhcpd.h  Tue Jul  2 13:24:37 2013(r252506)
@@ -121,6 +121,7 @@ struct client_lease {
struct client_lease *next;
time_t   expiry, renewal, rebind;
struct iaddr address;
+   struct iaddr nextserver;
char*server_name;
char*filename;
struct string_list  *medium;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r251502 - head/sys/netinet

2013-06-07 Thread Bruce M Simpson
Author: bms
Date: Fri Jun  7 17:12:08 2013
New Revision: 251502
URL: http://svnweb.freebsd.org/changeset/base/251502

Log:
  Disable IGMPv3 link timers on a transition to IGMPv2.
  
  Submitted by: Alan Smithee

Modified:
  head/sys/netinet/igmp.c

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Fri Jun  7 17:06:08 2013(r251501)
+++ head/sys/netinet/igmp.c Fri Jun  7 17:12:08 2013(r251502)
@@ -2121,6 +2121,7 @@ igmp_v1v2_process_querier_timers(struct 
__func__, igi-igi_version, IGMP_VERSION_2,
igi-igi_ifp, igi-igi_ifp-if_xname);
igi-igi_version = IGMP_VERSION_2;
+   igmp_v3_cancel_link_timers(igi);
}
}
} else if (igi-igi_v1_timer  0) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r237990 - stable/9/sys/netinet6

2012-07-02 Thread Bruce M Simpson
Author: bms
Date: Mon Jul  2 10:06:00 2012
New Revision: 237990
URL: http://svn.freebsd.org/changeset/base/237990

Log:
  Merge r237734 from HEAD:
In MLDv2 general query processing, do not enforce the strict check
on query origins.
  
  Submitted by: Gu Yong

Modified:
  stable/9/sys/netinet6/mld6.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/isp/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/netinet6/mld6.c
==
--- stable/9/sys/netinet6/mld6.cMon Jul  2 10:00:28 2012
(r237989)
+++ stable/9/sys/netinet6/mld6.cMon Jul  2 10:06:00 2012
(r237990)
@@ -866,16 +866,10 @@ mld_v2_input_query(struct ifnet *ifp, co
 */
if (IN6_IS_ADDR_UNSPECIFIED(mld-mld_addr)) {
/*
-* General Queries SHOULD be directed to ff02::1.
 * A general query with a source list has undefined
 * behaviour; discard it.
 */
-   struct in6_addr  dst;
-
-   dst = ip6-ip6_dst;
-   in6_clearscope(dst);
-   if (!IN6_ARE_ADDR_EQUAL(dst, in6addr_linklocal_allnodes) ||
-   nsrc  0)
+   if (nsrc  0)
return (EINVAL);
is_general_query = 1;
} else {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r237992 - stable/9/sys/netinet6

2012-07-02 Thread Bruce M Simpson
Author: bms
Date: Mon Jul  2 10:07:32 2012
New Revision: 237992
URL: http://svn.freebsd.org/changeset/base/237992

Log:
  Merge r237735 from HEAD:
Fix a typo in MLD query exponent processing.
  
  Submitted by: rpaulo@

Modified:
  stable/9/sys/netinet6/mld6.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/isp/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/netinet6/mld6.c
==
--- stable/9/sys/netinet6/mld6.cMon Jul  2 10:06:13 2012
(r237991)
+++ stable/9/sys/netinet6/mld6.cMon Jul  2 10:07:32 2012
(r237992)
@@ -832,7 +832,7 @@ mld_v2_input_query(struct ifnet *ifp, co
mld = (struct mldv2_query *)(mtod(m, uint8_t *) + off);
 
maxdelay = ntohs(mld-mld_maxdelay);/* in 1/10ths of a second */
-   if (maxdelay = 32678) {
+   if (maxdelay = 32768) {
maxdelay = (MLD_MRC_MANT(maxdelay) | 0x1000) 
   (MLD_MRC_EXP(maxdelay) + 3);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r237995 - stable/9/sys/netinet6

2012-07-02 Thread Bruce M Simpson
Author: bms
Date: Mon Jul  2 11:46:47 2012
New Revision: 237995
URL: http://svn.freebsd.org/changeset/base/237995

Log:
  Merge r237736 from HEAD:
Kick the current-state report timer when a V1 group report would
be triggered.
  
  Submitted by: rpaulo@

Modified:
  stable/9/sys/netinet6/mld6.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/isp/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/netinet6/mld6.c
==
--- stable/9/sys/netinet6/mld6.cMon Jul  2 10:16:14 2012
(r237994)
+++ stable/9/sys/netinet6/mld6.cMon Jul  2 11:46:47 2012
(r237995)
@@ -2196,6 +2196,7 @@ mld_final_leave(struct in6_multi *inm, s
 #endif
mld_v1_transmit_report(inm, MLD_LISTENER_DONE);
inm-in6m_state = MLD_NOT_MEMBER;
+   V_current_state_timers_running6 = 1;
} else if (mli-mli_version == MLD_VERSION_2) {
/*
 * Stop group timer and all pending reports.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r237734 - head/sys/netinet6

2012-06-28 Thread Bruce M Simpson
Author: bms
Date: Thu Jun 28 23:44:47 2012
New Revision: 237734
URL: http://svn.freebsd.org/changeset/base/237734

Log:
  In MLDv2 general query processing, do not enforce the strict check
  on query origins.
  
  Submitted by: Gu Yong
  MFC after:3 days

Modified:
  head/sys/netinet6/mld6.c

Modified: head/sys/netinet6/mld6.c
==
--- head/sys/netinet6/mld6.cThu Jun 28 22:03:59 2012(r237733)
+++ head/sys/netinet6/mld6.cThu Jun 28 23:44:47 2012(r237734)
@@ -867,16 +867,10 @@ mld_v2_input_query(struct ifnet *ifp, co
 */
if (IN6_IS_ADDR_UNSPECIFIED(mld-mld_addr)) {
/*
-* General Queries SHOULD be directed to ff02::1.
 * A general query with a source list has undefined
 * behaviour; discard it.
 */
-   struct in6_addr  dst;
-
-   dst = ip6-ip6_dst;
-   in6_clearscope(dst);
-   if (!IN6_ARE_ADDR_EQUAL(dst, in6addr_linklocal_allnodes) ||
-   nsrc  0)
+   if (nsrc  0)
return (EINVAL);
is_general_query = 1;
} else {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r237735 - head/sys/netinet6

2012-06-28 Thread Bruce M Simpson
Author: bms
Date: Thu Jun 28 23:45:37 2012
New Revision: 237735
URL: http://svn.freebsd.org/changeset/base/237735

Log:
  Fix a typo in MLD query exponent processing.
  
  Submitted by: rpaulo@
  MFC after:3 days

Modified:
  head/sys/netinet6/mld6.c

Modified: head/sys/netinet6/mld6.c
==
--- head/sys/netinet6/mld6.cThu Jun 28 23:44:47 2012(r237734)
+++ head/sys/netinet6/mld6.cThu Jun 28 23:45:37 2012(r237735)
@@ -833,7 +833,7 @@ mld_v2_input_query(struct ifnet *ifp, co
mld = (struct mldv2_query *)(mtod(m, uint8_t *) + off);
 
maxdelay = ntohs(mld-mld_maxdelay);/* in 1/10ths of a second */
-   if (maxdelay = 32678) {
+   if (maxdelay = 32768) {
maxdelay = (MLD_MRC_MANT(maxdelay) | 0x1000) 
   (MLD_MRC_EXP(maxdelay) + 3);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r237736 - head/sys/netinet6

2012-06-28 Thread Bruce M Simpson
Author: bms
Date: Thu Jun 28 23:48:40 2012
New Revision: 237736
URL: http://svn.freebsd.org/changeset/base/237736

Log:
  Kick the current-state report timer when a V1 group report would
  be triggered.
  
  Submitted by: rpaulo@
  MFC after:3 days

Modified:
  head/sys/netinet6/mld6.c

Modified: head/sys/netinet6/mld6.c
==
--- head/sys/netinet6/mld6.cThu Jun 28 23:45:37 2012(r237735)
+++ head/sys/netinet6/mld6.cThu Jun 28 23:48:40 2012(r237736)
@@ -2197,6 +2197,7 @@ mld_final_leave(struct in6_multi *inm, s
 #endif
mld_v1_transmit_report(inm, MLD_LISTENER_DONE);
inm-in6m_state = MLD_NOT_MEMBER;
+   V_current_state_timers_running6 = 1;
} else if (mli-mli_version == MLD_VERSION_2) {
/*
 * Stop group timer and all pending reports.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221719 - head/sbin/devd

2011-05-09 Thread Bruce M Simpson
Author: bms
Date: Tue May 10 02:34:11 2011
New Revision: 221719
URL: http://svn.freebsd.org/changeset/base/221719

Log:
  Typo. For USB devices, 'serial' should be 'sernum'.
  See sys/dev/usb/usb_device.c for what devctl_notify() gets.

Modified:
  head/sbin/devd/devd.conf.5

Modified: head/sbin/devd/devd.conf.5
==
--- head/sbin/devd/devd.conf.5  Tue May 10 01:05:41 2011(r221718)
+++ head/sbin/devd/devd.conf.5  Tue May 10 02:34:11 2011(r221719)
@@ -283,7 +283,7 @@ Hub port number (USB)
 Product ID (pccard/USB).
 .It Li release
 Hardware revision (USB)
-.It Li serial
+.It Li sernum
 Serial Number (USB).
 .It Li slot
 Card slot.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r221720 - head/sys/dev/usb

2011-05-09 Thread Bruce M Simpson
Author: bms
Date: Tue May 10 02:38:44 2011
New Revision: 221720
URL: http://svn.freebsd.org/changeset/base/221720

Log:
  Add VID for Simtec Electronics.
  Add PID for Simtec Electronics EntropyKey, a hardware random number generator.

Modified:
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsTue May 10 02:34:11 2011(r221719)
+++ head/sys/dev/usb/usbdevsTue May 10 02:38:44 2011(r221720)
@@ -681,6 +681,7 @@ vendor HAUPPAUGE2   0x2040  Hauppauge Compu
 vendor TLAYTECH0x20b9  Tlay Tech
 vendor ENCORE  0x203d  Encore
 vendor PARA0x20b8  PARA Industrial
+vendor SIMTEC  0x20df  Simtec Electronics
 vendor ERICSSON0x2282  Ericsson
 vendor MOTOROLA2   0x22b8  Motorola
 vendor TRIPPLITE   0x2478  Tripp-Lite
@@ -2513,6 +2514,9 @@ product PANASONIC TYTP50P6S   0x3900  TY-TP
 /* PARA Industrial products */
 product PARA RT30700x  RT3070
 
+/* Simtec Electronics products */
+product SIMTEC ENTROPYKEY  0x0001  Entropy Key
+
 /* Pegatron products */
 product PEGATRON RT28700x0002  RT2870
 product PEGATRON RT30700x000c  RT3070
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r207558 - stable/8/sys/netinet

2010-05-03 Thread Bruce M Simpson
Author: bms
Date: Mon May  3 09:31:51 2010
New Revision: 207558
URL: http://svn.freebsd.org/changeset/base/207558

Log:
  MFC r207275:
Fix a regression where DVMRP diagnostic traffic, such as that used
by mrinfo and mtrace, was dropped by the IGMP TTL check. IGMP control
traffic must always have a TTL of 1.
  
  Submitted by: Matthew Luckie

Modified:
  stable/8/sys/netinet/igmp.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/geom/sched/   (props changed)

Modified: stable/8/sys/netinet/igmp.c
==
--- stable/8/sys/netinet/igmp.c Mon May  3 09:28:10 2010(r207557)
+++ stable/8/sys/netinet/igmp.c Mon May  3 09:31:51 2010(r207558)
@@ -1468,12 +1468,6 @@ igmp_input(struct mbuf *m, int off)
}
ip = mtod(m, struct ip *);
 
-   if (ip-ip_ttl != 1) {
-   IGMPSTAT_INC(igps_rcv_badttl);
-   m_freem(m);
-   return;
-   }
-
/*
 * Validate checksum.
 */
@@ -1488,6 +1482,17 @@ igmp_input(struct mbuf *m, int off)
m-m_data -= iphlen;
m-m_len += iphlen;
 
+   /*
+* IGMP control traffic is link-scope, and must have a TTL of 1.
+* DVMRP traffic (e.g. mrinfo, mtrace) is an exception;
+* probe packets may come from beyond the LAN.
+*/
+   if (igmp-igmp_type != IGMP_DVMRP  ip-ip_ttl != 1) {
+   IGMPSTAT_INC(igps_rcv_badttl);
+   m_freem(m);
+   return;
+   }
+
switch (igmp-igmp_type) {
case IGMP_HOST_MEMBERSHIP_QUERY:
if (igmplen == IGMP_MINLEN) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r207273 - stable/8/sys/netinet6

2010-04-27 Thread Bruce M Simpson
Author: bms
Date: Tue Apr 27 13:27:51 2010
New Revision: 207273
URL: http://svn.freebsd.org/changeset/base/207273

Log:
  MFC 206454:
When embedding the scope ID in MLDv1 output, check if the scope of the 
address
being embedded is in fact link-local, before attempting to embed it.
  
Note that this operation is a side-effect of trying to avoid recursion on
the IN6 scope lock.
  
  PR:   144560
  Submitted by: Petr Lampa

Modified:
  stable/8/sys/netinet6/mld6.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/geom/sched/   (props changed)

Modified: stable/8/sys/netinet6/mld6.c
==
--- stable/8/sys/netinet6/mld6.cTue Apr 27 12:50:42 2010
(r207272)
+++ stable/8/sys/netinet6/mld6.cTue Apr 27 13:27:51 2010
(r207273)
@@ -195,8 +195,10 @@ static int sysctl_mld_ifinfo(SYSCTL_HAND
 static struct mtx   mld_mtx;
 MALLOC_DEFINE(M_MLD, mld, mld state);
 
-#defineMLD_EMBEDSCOPE(pin6, zoneid) \
-   (pin6)-s6_addr16[1] = htons((zoneid)  0x)
+#defineMLD_EMBEDSCOPE(pin6, zoneid)
\
+   if (IN6_IS_SCOPE_LINKLOCAL(pin6) || \
+   IN6_IS_ADDR_MC_INTFACELOCAL(pin6))  \
+   (pin6)-s6_addr16[1] = htons((zoneid)  0x) \
 
 /*
  * VIMAGE-wide globals.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r207274 - stable/8/sys/netinet

2010-04-27 Thread Bruce M Simpson
Author: bms
Date: Tue Apr 27 13:50:15 2010
New Revision: 207274
URL: http://svn.freebsd.org/changeset/base/207274

Log:
  MFC 206452:
Fix a few issues related to the legacy 4.4 BSD multicast APIs.
  
IPv4 addresses can and do change during normal operation. Testing by
pfSense developers exposed an issue where OpenOSPFD was using the IPv4
address to leave the OSPF link-scope multicast groups on a dynamic
OpenVPN tun interface, rather than using RFC 3678 with the interface
index, which won't be raced when the interface's addresses change.
  
In inp_join_group():
 If we are already a member of an ASM group, and IP_ADD_MEMBERSHIP or
 MCAST_JOIN_GROUP ioctls are re-issued, return EADDRINUSE as per the
 legacy 4.4BSD multicast API. This bends RFC 3678 slightly, but does
 not violate POLA for apps using the old API.
 It also stops us falling through to kicking IGMP state transactions
 in what is otherwise a no-op case.
 [This has already been dealt with in HEAD, but make it explicit before
  we MFC the change to 8.]
  
In inp_leave_group():
 Fix a bogus conditional.
 Move the ifp null check to ioctls MCAST_LEAVE* in the switch..case
 where it actually belongs.
 If an interface was specified, by primary IPv4 address, for ioctl
 IP_DROP_MEMBERSHIP or MCAST_LEAVE_GROUP (an ASM full leave operation),
 then and only then should we look up the ifp from the IPv4 address in
 mreqs.imr_interface.
 If not, we fall through to imo_match_group() as before, but only in
 the IP_DROP_MEMBERSHIP case.
  
With these changes, the legacy 4.4BSD multicast API idempotence should
be mostly preserved in the SSM enabled IPv4 stack.
  
[Note: this is not a straight svn merge as head and 8 differ slightly]
  
  Found by: ermal (with pfSense)

Modified:
  stable/8/sys/netinet/in_mcast.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/geom/sched/   (props changed)

Modified: stable/8/sys/netinet/in_mcast.c
==
--- stable/8/sys/netinet/in_mcast.c Tue Apr 27 13:27:51 2010
(r207273)
+++ stable/8/sys/netinet/in_mcast.c Tue Apr 27 13:50:15 2010
(r207274)
@@ -1991,6 +1991,17 @@ inp_join_group(struct inpcb *inp, struct
error = EINVAL;
goto out_inp_locked;
}
+   /*
+* MCAST_JOIN_GROUP on an existing exclusive
+* membership is an error; return EADDRINUSE
+* to preserve 4.4BSD API idempotence, and
+* avoid tedious detour to code below.
+* NOTE: This is bending RFC 3678 a bit.
+*/
+   if (imf-imf_st[1] == MCAST_EXCLUDE) {
+   error = EADDRINUSE;
+   goto out_inp_locked;
+   }
}
}
 
@@ -2161,7 +2172,14 @@ inp_leave_group(struct inpcb *inp, struc
ssa-sin.sin_addr = mreqs.imr_sourceaddr;
}
 
-   if (!in_nullhost(gsa-sin.sin_addr))
+   /*
+* Attempt to look up hinted ifp from interface address.
+* Fallthrough with null ifp iff lookup fails, to
+* preserve 4.4BSD mcast API idempotence.
+* XXX NOTE WELL: The RFC 3678 API is preferred because
+* using an IPv4 address as a key is racy.
+*/
+   if (!in_nullhost(mreqs.imr_interface))
INADDR_TO_IFP(mreqs.imr_interface, ifp);
 
CTR3(KTR_IGMPV3, %s: imr_interface = %s, ifp = %p,
@@ -2197,6 +2215,9 @@ inp_leave_group(struct inpcb *inp, struc
return (EADDRNOTAVAIL);
 
ifp = ifnet_byindex(gsr.gsr_interface);
+
+   if (ifp == NULL)
+   return (EADDRNOTAVAIL);
break;
 
default:
@@ -2209,9 +2230,6 @@ inp_leave_group(struct inpcb *inp, struc
if (!IN_MULTICAST(ntohl(gsa-sin.sin_addr.s_addr)))
return (EINVAL);
 
-   if (ifp == NULL)
-   return (EADDRNOTAVAIL);
-
/*
 * Find the membership in the membership array.
 */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r207275 - head/sys/netinet

2010-04-27 Thread Bruce M Simpson
Author: bms
Date: Tue Apr 27 14:14:21 2010
New Revision: 207275
URL: http://svn.freebsd.org/changeset/base/207275

Log:
  Fix a regression where DVMRP diagnostic traffic, such as that used
  by mrinfo and mtrace, was dropped by the IGMP TTL check. IGMP control
  traffic must always have a TTL of 1.
  
  Submitted by: Matthew Luckie
  MFC after:3 days

Modified:
  head/sys/netinet/igmp.c

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Tue Apr 27 13:50:15 2010(r207274)
+++ head/sys/netinet/igmp.c Tue Apr 27 14:14:21 2010(r207275)
@@ -1468,12 +1468,6 @@ igmp_input(struct mbuf *m, int off)
}
ip = mtod(m, struct ip *);
 
-   if (ip-ip_ttl != 1) {
-   IGMPSTAT_INC(igps_rcv_badttl);
-   m_freem(m);
-   return;
-   }
-
/*
 * Validate checksum.
 */
@@ -1488,6 +1482,17 @@ igmp_input(struct mbuf *m, int off)
m-m_data -= iphlen;
m-m_len += iphlen;
 
+   /*
+* IGMP control traffic is link-scope, and must have a TTL of 1.
+* DVMRP traffic (e.g. mrinfo, mtrace) is an exception;
+* probe packets may come from beyond the LAN.
+*/
+   if (igmp-igmp_type != IGMP_DVMRP  ip-ip_ttl != 1) {
+   IGMPSTAT_INC(igps_rcv_badttl);
+   m_freem(m);
+   return;
+   }
+
switch (igmp-igmp_type) {
case IGMP_HOST_MEMBERSHIP_QUERY:
if (igmplen == IGMP_MINLEN) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r206452 - head/sys/netinet

2010-04-10 Thread Bruce M Simpson
Author: bms
Date: Sat Apr 10 12:05:31 2010
New Revision: 206452
URL: http://svn.freebsd.org/changeset/base/206452

Log:
  Fix a few issues related to the legacy 4.4 BSD multicast APIs.
  
  IPv4 addresses can and do change during normal operation. Testing by
  pfSense developers exposed an issue where OpenOSPFD was using the IPv4
  address to leave the OSPF link-scope multicast groups on a dynamic
  OpenVPN tun interface, rather than using RFC 3678 with the interface
  index, which won't be raced when the interface's addresses change.
  
  In inp_join_group():
   If we are already a member of an ASM group, and IP_ADD_MEMBERSHIP or
   MCAST_JOIN_GROUP ioctls are re-issued, return EADDRINUSE as per the
   legacy 4.4BSD multicast API. This bends RFC 3678 slightly, but does
   not violate POLA for apps using the old API.
   It also stops us falling through to kicking IGMP state transactions
   in what is otherwise a no-op case.
   [This has already been dealt with in HEAD, but make it explicit before
we MFC the change to 8.]
  
  In inp_leave_group():
   Fix a bogus conditional.
   Move the ifp null check to ioctls MCAST_LEAVE* in the switch..case
   where it actually belongs.
   If an interface was specified, by primary IPv4 address, for ioctl
   IP_DROP_MEMBERSHIP or MCAST_LEAVE_GROUP (an ASM full leave operation),
   then and only then should we look up the ifp from the IPv4 address in
   mreqs.imr_interface.
   If not, we fall through to imo_match_group() as before, but only in
   the IP_DROP_MEMBERSHIP case.
  
  With these changes, the legacy 4.4BSD multicast API idempotence should
  be mostly preserved in the SSM enabled IPv4 stack.
  
  Found by: ermal (with pfSense)
  MFC after:3 days

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Sat Apr 10 11:52:12 2010(r206451)
+++ head/sys/netinet/in_mcast.c Sat Apr 10 12:05:31 2010(r206452)
@@ -1999,9 +1999,12 @@ inp_join_group(struct inpcb *inp, struct
}
} else {
/*
-* MCAST_JOIN_GROUP alone, on any existing membership,
-* is rejected, to stop the same inpcb tying up
-* multiple refs to the in_multi.
+* MCAST_JOIN_GROUP on an existing exclusive
+* membership is an error; return EADDRINUSE
+* to preserve 4.4BSD API idempotence, and
+* avoid tedious detour to code below.
+* NOTE: This is bending RFC 3678 a bit.
+*
 * On an existing inclusive membership, this is also
 * an error; if you want to change filter mode,
 * you must use the userland API setsourcefilter().
@@ -2010,6 +2013,8 @@ inp_join_group(struct inpcb *inp, struct
 * is atomic with allocation of a membership.
 */
error = EINVAL;
+   if (imf-imf_st[1] == MCAST_EXCLUDE)
+   error = EADDRINUSE;
goto out_inp_locked;
}
}
@@ -2186,7 +2191,14 @@ inp_leave_group(struct inpcb *inp, struc
ssa-sin.sin_addr = mreqs.imr_sourceaddr;
}
 
-   if (!in_nullhost(gsa-sin.sin_addr))
+   /*
+* Attempt to look up hinted ifp from interface address.
+* Fallthrough with null ifp iff lookup fails, to
+* preserve 4.4BSD mcast API idempotence.
+* XXX NOTE WELL: The RFC 3678 API is preferred because
+* using an IPv4 address as a key is racy.
+*/
+   if (!in_nullhost(mreqs.imr_interface))
INADDR_TO_IFP(mreqs.imr_interface, ifp);
 
CTR3(KTR_IGMPV3, %s: imr_interface = %s, ifp = %p,
@@ -,6 +2234,9 @@ inp_leave_group(struct inpcb *inp, struc
return (EADDRNOTAVAIL);
 
ifp = ifnet_byindex(gsr.gsr_interface);
+
+   if (ifp == NULL)
+   return (EADDRNOTAVAIL);
break;
 
default:
@@ -2234,9 +2249,6 @@ inp_leave_group(struct inpcb *inp, struc
if (!IN_MULTICAST(ntohl(gsa-sin.sin_addr.s_addr)))
return (EINVAL);
 
-   if (ifp == NULL)
-   return (EADDRNOTAVAIL);
-
/*
 * Find the membership in the membership array.
 */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r206454 - head/sys/netinet6

2010-04-10 Thread Bruce M Simpson
Author: bms
Date: Sat Apr 10 12:24:21 2010
New Revision: 206454
URL: http://svn.freebsd.org/changeset/base/206454

Log:
  When embedding the scope ID in MLDv1 output, check if the scope of the address
  being embedded is in fact link-local, before attempting to embed it.
  
  Note that this operation is a side-effect of trying to avoid recursion on
  the IN6 scope lock.
  
  PR:   144560
  Submitted by: Petr Lampa
  MFC after:3 days

Modified:
  head/sys/netinet6/mld6.c

Modified: head/sys/netinet6/mld6.c
==
--- head/sys/netinet6/mld6.cSat Apr 10 12:10:11 2010(r206453)
+++ head/sys/netinet6/mld6.cSat Apr 10 12:24:21 2010(r206454)
@@ -195,8 +195,10 @@ static int sysctl_mld_ifinfo(SYSCTL_HAND
 static struct mtx   mld_mtx;
 MALLOC_DEFINE(M_MLD, mld, mld state);
 
-#defineMLD_EMBEDSCOPE(pin6, zoneid) \
-   (pin6)-s6_addr16[1] = htons((zoneid)  0x)
+#defineMLD_EMBEDSCOPE(pin6, zoneid)
\
+   if (IN6_IS_SCOPE_LINKLOCAL(pin6) || \
+   IN6_IS_ADDR_MC_INTFACELOCAL(pin6))  \
+   (pin6)-s6_addr16[1] = htons((zoneid)  0x) \
 
 /*
  * VIMAGE-wide globals.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r206455 - head

2010-04-10 Thread Bruce M Simpson
Author: bms
Date: Sat Apr 10 12:29:09 2010
New Revision: 206455
URL: http://svn.freebsd.org/changeset/base/206455

Log:
  Add a comment to MAINTAINERS indicating that sbin/routed is in fact
  vendor branch code from before contrib existed in FreeBSD's history.
  
  Changes should be run by Vernon Schryver at Rhyolite first.

Modified:
  head/MAINTAINERS

Modified: head/MAINTAINERS
==
--- head/MAINTAINERSSat Apr 10 12:24:21 2010(r206454)
+++ head/MAINTAINERSSat Apr 10 12:29:09 2010(r206455)
@@ -125,6 +125,7 @@ lib/libc/stdtimeedwin   Heads-up apprec
is maintained by a third party source.
 sysinstall randi   Please contact about any major changes so that
they can be co-ordinated.
+sbin/routedbms Pre-commit review; notify vendor at rhyolite.com
 
 Following are the entries from the Makefiles, and a few other sources.
 Please remove stale entries from both their origin, and this file.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r203715 - stable/8/etc

2010-02-09 Thread Bruce M Simpson
Author: bms
Date: Tue Feb  9 18:43:50 2010
New Revision: 203715
URL: http://svn.freebsd.org/changeset/base/203715

Log:
  MFC Revision: 203574
Add sane-port (Scanner Access Now Easy) as port 6566.
  
  Obtained from:  http://www.iana.org/assignments/port-numbers

Modified:
  stable/8/etc/services   (contents, props changed)
Directory Properties:
  stable/8/etc/   (props changed)

Modified: stable/8/etc/services
==
--- stable/8/etc/services   Tue Feb  9 18:43:20 2010(r203714)
+++ stable/8/etc/services   Tue Feb  9 18:43:50 2010(r203715)
@@ -2338,6 +2338,8 @@ sge_execd 6445/tcp   #Grid Engine Execut
 sge_execd  6445/udp   #Grid Engine Execution Service
 xdsxdm 6558/tcp
 xdsxdm 6558/udp
+sane-port  6566/tcp   #Scanner Access Now Easy (SANE) Control Port
+sane-port  6566/udp   #Scanner Access Now Easy (SANE) Control Port
 ircd   6667/tcp   #Internet Relay Chat (unoffical)
 acmsoda6969/tcp
 acmsoda6969/udp
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r203574 - head/etc

2010-02-06 Thread Bruce M Simpson
Author: bms
Date: Sat Feb  6 21:22:01 2010
New Revision: 203574
URL: http://svn.freebsd.org/changeset/base/203574

Log:
  Add sane-port (Scanner Access Now Easy) as port 6566.
  
  Obtained from:  http://www.iana.org/assignments/port-numbers
  MFC after:  3 days

Modified:
  head/etc/services

Modified: head/etc/services
==
--- head/etc/services   Sat Feb  6 21:12:27 2010(r203573)
+++ head/etc/services   Sat Feb  6 21:22:01 2010(r203574)
@@ -2340,6 +2340,8 @@ sge_execd 6445/tcp   #Grid Engine Execut
 sge_execd  6445/udp   #Grid Engine Execution Service
 xdsxdm 6558/tcp
 xdsxdm 6558/udp
+sane-port  6566/tcp   #Scanner Access Now Easy (SANE) Control Port
+sane-port  6566/udp   #Scanner Access Now Easy (SANE) Control Port
 ircd   6667/tcp   #Internet Relay Chat (unoffical)
 acmsoda6969/tcp
 acmsoda6969/udp
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r200869 - stable/8/sys/netinet6

2009-12-22 Thread Bruce M Simpson
Author: bms
Date: Tue Dec 22 20:33:27 2009
New Revision: 200869
URL: http://svn.freebsd.org/changeset/base/200869

Log:
  MFC r200572:
   Add missing #include sys/ktr.h.
  
  Submitted by: Hideki Yamamoto

Modified:
  stable/8/sys/netinet6/mld6.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet6/mld6.c
==
--- stable/8/sys/netinet6/mld6.cTue Dec 22 20:24:06 2009
(r200868)
+++ stable/8/sys/netinet6/mld6.cTue Dec 22 20:33:27 2009
(r200869)
@@ -79,6 +79,7 @@ __FBSDID($FreeBSD$);
 #include sys/callout.h
 #include sys/malloc.h
 #include sys/module.h
+#include sys/ktr.h
 
 #include net/if.h
 #include net/route.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r200871 - head/sys/netinet6

2009-12-22 Thread Bruce M Simpson
Author: bms
Date: Tue Dec 22 20:40:22 2009
New Revision: 200871
URL: http://svn.freebsd.org/changeset/base/200871

Log:
  Use ALLOW_NEW_SOURCES and BLOCK_OLD_SOURCES to signal a join or leave
  with SSM MLDv2 by default.
  This is current practice and complies with RFC 4604, as well as being
  required by production IPv6 networks in Japan.
  The behaviour may be disabled by setting the net.inet6.mld.use_allow
  sysctl/tunable to 0.
  
  Requested by: Hideki Yamamoto
  MFC after:1 week

Modified:
  head/sys/netinet6/mld6.c
  head/sys/netinet6/mld6_var.h

Modified: head/sys/netinet6/mld6.c
==
--- head/sys/netinet6/mld6.cTue Dec 22 20:37:40 2009(r200870)
+++ head/sys/netinet6/mld6.cTue Dec 22 20:40:22 2009(r200871)
@@ -132,7 +132,8 @@ static struct mbuf *
 static int mld_v2_enqueue_filter_change(struct ifqueue *,
struct in6_multi *);
 static int mld_v2_enqueue_group_record(struct ifqueue *,
-   struct in6_multi *, const int, const int, const int);
+   struct in6_multi *, const int, const int, const int,
+   const int);
 static int mld_v2_input_query(struct ifnet *, const struct ip6_hdr *,
struct mbuf *, const int, const int);
 static int mld_v2_merge_state_changes(struct in6_multi *,
@@ -236,6 +237,11 @@ SYSCTL_INT(_net_inet6_mld, OID_AUTO, v1e
 mld_v1enable, 0, Enable fallback to MLDv1);
 TUNABLE_INT(net.inet6.mld.v1enable, mld_v1enable);
 
+static int mld_use_allow = 1;
+SYSCTL_INT(_net_inet6_mld, OID_AUTO, use_allow, CTLFLAG_RW,
+mld_use_allow, 0, Use ALLOW/BLOCK for RFC 4604 SSM joins/leaves);
+TUNABLE_INT(net.inet6.mld.use_allow, mld_use_allow);
+
 /*
  * Packed Router Alert option structure declaration.
  */
@@ -461,6 +467,8 @@ mld_domifattach(struct ifnet *ifp)
mli = mli_alloc_locked(ifp);
if (!(ifp-if_flags  IFF_MULTICAST))
mli-mli_flags |= MLIF_SILENT;
+   if (mld_use_allow)
+   mli-mli_flags |= MLIF_USEALLOW;
 
MLD_UNLOCK();
 
@@ -1550,7 +1558,8 @@ mld_v2_process_group_timers(struct mld_i
int retval;
 
retval = mld_v2_enqueue_group_record(qrq, inm, 0, 1,
-   (inm-in6m_state == MLD_SG_QUERY_PENDING_MEMBER));
+   (inm-in6m_state == MLD_SG_QUERY_PENDING_MEMBER),
+   0);
CTR2(KTR_MLD, %s: enqueue record = %d,
__func__, retval);
inm-in6m_state = MLD_REPORTING_MEMBER;
@@ -2025,7 +2034,7 @@ mld_initial_join(struct in6_multi *inm, 
ifq = inm-in6m_scq;
_IF_DRAIN(ifq);
retval = mld_v2_enqueue_group_record(ifq, inm, 1,
-   0, 0);
+   0, 0, (mli-mli_flags  MLIF_USEALLOW));
CTR2(KTR_MLD, %s: enqueue record = %d,
__func__, retval);
if (retval = 0) {
@@ -2118,7 +2127,8 @@ mld_handle_state_change(struct in6_multi
 
_IF_DRAIN(inm-in6m_scq);
 
-   retval = mld_v2_enqueue_group_record(inm-in6m_scq, inm, 1, 0, 0);
+   retval = mld_v2_enqueue_group_record(inm-in6m_scq, inm, 1, 0, 0,
+   (mli-mli_flags  MLIF_USEALLOW));
CTR2(KTR_MLD, %s: enqueue record = %d, __func__, retval);
if (retval = 0)
return (-retval);
@@ -2203,7 +2213,8 @@ mld_final_leave(struct in6_multi *inm, s
in6m_acquire_locked(inm);
 
retval = mld_v2_enqueue_group_record(
-   inm-in6m_scq, inm, 1, 0, 0);
+   inm-in6m_scq, inm, 1, 0, 0,
+   (mli-mli_flags  MLIF_USEALLOW));
KASSERT(retval != 0,
(%s: enqueue record = %d, __func__,
 retval));
@@ -2250,6 +2261,10 @@ mld_final_leave(struct in6_multi *inm, s
  * it was recorded for a Group-Source query, and will be omitted if
  * it is not both in-mode and recorded.
  *
+ * If use_block_allow is non-zero, state change reports for initial join
+ * and final leave, on an inclusive mode group with a source list, will be
+ * rewritten to use the ALLOW_NEW and BLOCK_OLD record types, respectively.
+ *
  * The function will attempt to allocate leading space in the packet
  * for the IPv6+ICMP headers to be prepended without fragmenting the chain.
  *
@@ -2260,7 +2275,7 @@ mld_final_leave(struct in6_multi *inm, s
 static int
 mld_v2_enqueue_group_record(struct ifqueue *ifq, struct in6_multi *inm,
 const int is_state_change, const int is_group_query,
-const int is_source_query)
+const int is_source_query, const int use_block_allow)
 {
 

svn commit: r200572 - head/sys/netinet6

2009-12-15 Thread Bruce M Simpson
Author: bms
Date: Tue Dec 15 10:40:40 2009
New Revision: 200572
URL: http://svn.freebsd.org/changeset/base/200572

Log:
  Add missing #include sys/ktr.h.
  
  Submitted by: Hideki Yamamoto
  MFC after:1 week

Modified:
  head/sys/netinet6/mld6.c

Modified: head/sys/netinet6/mld6.c
==
--- head/sys/netinet6/mld6.cTue Dec 15 10:36:08 2009(r200571)
+++ head/sys/netinet6/mld6.cTue Dec 15 10:40:40 2009(r200572)
@@ -79,6 +79,7 @@ __FBSDID($FreeBSD$);
 #include sys/callout.h
 #include sys/malloc.h
 #include sys/module.h
+#include sys/ktr.h
 
 #include net/if.h
 #include net/route.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r199577 - stable/8/sys/netinet6

2009-11-20 Thread Bruce M Simpson
Author: bms
Date: Fri Nov 20 11:58:04 2009
New Revision: 199577
URL: http://svn.freebsd.org/changeset/base/199577

Log:
  MFC r199518:
Adapt the fix for IGMPv2 in r199287 for the IPv6 stack.
Only multicast routing is affected by the issue.

Modified:
  stable/8/sys/netinet6/raw_ip6.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/arm/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/bsm/   (props changed)
  stable/8/sys/cddl/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/compat/   (props changed)
  stable/8/sys/contrib/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/crypto/   (props changed)
  stable/8/sys/ddb/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/fs/   (props changed)
  stable/8/sys/gdb/   (props changed)
  stable/8/sys/geom/   (props changed)
  stable/8/sys/gnu/   (props changed)
  stable/8/sys/i386/acpica/   (props changed)
  stable/8/sys/i386/bios/   (props changed)
  stable/8/sys/i386/compile/   (props changed)
  stable/8/sys/i386/cpufreq/   (props changed)
  stable/8/sys/i386/i386/   (props changed)
  stable/8/sys/i386/ibcs2/   (props changed)
  stable/8/sys/i386/include/   (props changed)
  stable/8/sys/i386/isa/   (props changed)
  stable/8/sys/i386/linux/   (props changed)
  stable/8/sys/i386/pci/   (props changed)
  stable/8/sys/i386/svr4/   (props changed)
  stable/8/sys/i386/xbox/   (props changed)
  stable/8/sys/i386/xen/   (props changed)
  stable/8/sys/ia64/   (props changed)
  stable/8/sys/isa/   (props changed)
  stable/8/sys/kern/   (props changed)
  stable/8/sys/kgssapi/   (props changed)
  stable/8/sys/libkern/   (props changed)
  stable/8/sys/mips/   (props changed)
  stable/8/sys/modules/   (props changed)
  stable/8/sys/net80211/   (props changed)
  stable/8/sys/netatalk/   (props changed)
  stable/8/sys/netgraph/   (props changed)
  stable/8/sys/netinet/   (props changed)
  stable/8/sys/netipsec/   (props changed)
  stable/8/sys/netipx/   (props changed)
  stable/8/sys/netnatm/   (props changed)
  stable/8/sys/netncp/   (props changed)
  stable/8/sys/netsmb/   (props changed)
  stable/8/sys/nfs/   (props changed)
  stable/8/sys/nfsclient/   (props changed)
  stable/8/sys/nfsserver/   (props changed)
  stable/8/sys/nlm/   (props changed)
  stable/8/sys/opencrypto/   (props changed)
  stable/8/sys/pc98/   (props changed)
  stable/8/sys/pci/   (props changed)
  stable/8/sys/powerpc/   (props changed)
  stable/8/sys/rpc/   (props changed)
  stable/8/sys/security/   (props changed)
  stable/8/sys/sparc64/   (props changed)
  stable/8/sys/sun4v/   (props changed)
  stable/8/sys/sys/   (props changed)
  stable/8/sys/tools/   (props changed)
  stable/8/sys/ufs/   (props changed)
  stable/8/sys/vm/   (props changed)
  stable/8/sys/xdr/   (props changed)
  stable/8/sys/xen/   (props changed)

Modified: stable/8/sys/netinet6/raw_ip6.c
==
--- stable/8/sys/netinet6/raw_ip6.c Fri Nov 20 09:00:38 2009
(r199576)
+++ stable/8/sys/netinet6/raw_ip6.c Fri Nov 20 11:58:04 2009
(r199577)
@@ -213,17 +213,39 @@ rip6_input(struct mbuf **mp, int *offp, 
 */
if (in6p-in6p_moptions 
IN6_IS_ADDR_MULTICAST(ip6-ip6_dst)) {
-   struct sockaddr_in6 mcaddr;
+   /*
+* If the incoming datagram is for MLD, allow it
+* through unconditionally to the raw socket.
+*
+* Use the M_RTALERT_MLD flag to check for MLD
+* traffic without having to inspect the mbuf chain
+* more deeply, as all MLDv1/v2 host messages MUST
+* contain the Router Alert option.
+*
+* In the case of MLDv1, we may not have explicitly
+* joined the group, and may have set IFF_ALLMULTI
+* on the interface. im6o_mc_filter() may discard
+* control traffic we actually need to see.
+*
+* Userland multicast routing daemons should continue
+* filter the control traffic appropriately.
+*/
int blocked;
 
-   bzero(mcaddr, sizeof(struct sockaddr_in6));
-   mcaddr.sin6_len = sizeof(struct sockaddr_in6);
-   mcaddr.sin6_family = AF_INET6;
-   mcaddr.sin6_addr = ip6-ip6_dst;
-
-   blocked = im6o_mc_filter(in6p-in6p_moptions, ifp,
-   

svn commit: r199518 - head/sys/netinet6

2009-11-19 Thread Bruce M Simpson
Author: bms
Date: Thu Nov 19 11:55:19 2009
New Revision: 199518
URL: http://svn.freebsd.org/changeset/base/199518

Log:
  Adapt the fix for IGMPv2 in r199287 for the IPv6 stack.
  Only multicast routing is affected by the issue.
  
  MFC after:1 day

Modified:
  head/sys/netinet6/raw_ip6.c

Modified: head/sys/netinet6/raw_ip6.c
==
--- head/sys/netinet6/raw_ip6.c Thu Nov 19 11:16:37 2009(r199517)
+++ head/sys/netinet6/raw_ip6.c Thu Nov 19 11:55:19 2009(r199518)
@@ -213,17 +213,39 @@ rip6_input(struct mbuf **mp, int *offp, 
 */
if (in6p-in6p_moptions 
IN6_IS_ADDR_MULTICAST(ip6-ip6_dst)) {
-   struct sockaddr_in6 mcaddr;
+   /*
+* If the incoming datagram is for MLD, allow it
+* through unconditionally to the raw socket.
+*
+* Use the M_RTALERT_MLD flag to check for MLD
+* traffic without having to inspect the mbuf chain
+* more deeply, as all MLDv1/v2 host messages MUST
+* contain the Router Alert option.
+*
+* In the case of MLDv1, we may not have explicitly
+* joined the group, and may have set IFF_ALLMULTI
+* on the interface. im6o_mc_filter() may discard
+* control traffic we actually need to see.
+*
+* Userland multicast routing daemons should continue
+* filter the control traffic appropriately.
+*/
int blocked;
 
-   bzero(mcaddr, sizeof(struct sockaddr_in6));
-   mcaddr.sin6_len = sizeof(struct sockaddr_in6);
-   mcaddr.sin6_family = AF_INET6;
-   mcaddr.sin6_addr = ip6-ip6_dst;
-
-   blocked = im6o_mc_filter(in6p-in6p_moptions, ifp,
-   (struct sockaddr *)mcaddr,
-   (struct sockaddr *)fromsa);
+   blocked = MCAST_PASS;
+   if ((m-m_flags  M_RTALERT_MLD) == 0) {
+   struct sockaddr_in6 mcaddr;
+
+   bzero(mcaddr, sizeof(struct sockaddr_in6));
+   mcaddr.sin6_len = sizeof(struct sockaddr_in6);
+   mcaddr.sin6_family = AF_INET6;
+   mcaddr.sin6_addr = ip6-ip6_dst;
+
+   blocked = im6o_mc_filter(in6p-in6p_moptions,
+   ifp,
+   (struct sockaddr *)mcaddr,
+   (struct sockaddr *)fromsa);
+   }
if (blocked != MCAST_PASS) {
IP6STAT_INC(ip6s_notmember);
continue;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r199522 - head/sys/netinet6

2009-11-19 Thread Bruce M Simpson
Author: bms
Date: Thu Nov 19 12:18:30 2009
New Revision: 199522
URL: http://svn.freebsd.org/changeset/base/199522

Log:
  Adapt r197130 to IPv6 stack:
Fix an obvious logic error in the IPv4 multicast leave processing,
where the filter mode vector was not updated correctly after the leave.
  
  MFC after:1 day

Modified:
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet6/in6_mcast.c
==
--- head/sys/netinet6/in6_mcast.c   Thu Nov 19 12:10:34 2009
(r199521)
+++ head/sys/netinet6/in6_mcast.c   Thu Nov 19 12:18:30 2009
(r199522)
@@ -2272,8 +2272,10 @@ out_im6f_rollback:
 
if (is_final) {
/* Remove the gap in the membership array. */
-   for (++idx; idx  imo-im6o_num_memberships; ++idx)
+   for (++idx; idx  imo-im6o_num_memberships; ++idx) {
imo-im6o_membership[idx-1] = imo-im6o_membership[idx];
+   imo-im6o_mfilters[idx-1] = imo-im6o_mfilters[idx];
+   }
imo-im6o_num_memberships--;
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r199523 - head/sys/netinet6

2009-11-19 Thread Bruce M Simpson
Author: bms
Date: Thu Nov 19 12:21:20 2009
New Revision: 199523
URL: http://svn.freebsd.org/changeset/base/199523

Log:
  Adapt r197314 to IPv6 stack:
Return ENOBUFS consistently if user attempts to exceed
in_mcast_maxsocksrc resource limit.
  
  MFC after:1 day

Modified:
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet6/in6_mcast.c
==
--- head/sys/netinet6/in6_mcast.c   Thu Nov 19 12:18:30 2009
(r199522)
+++ head/sys/netinet6/in6_mcast.c   Thu Nov 19 12:21:20 2009
(r199523)
@@ -2342,9 +2342,11 @@ in6p_set_source_filters(struct inpcb *in
if (error)
return (error);
 
-   if (msfr.msfr_nsrcs  in6_mcast_maxsocksrc ||
-   (msfr.msfr_fmode != MCAST_EXCLUDE 
-msfr.msfr_fmode != MCAST_INCLUDE))
+   if (msfr.msfr_nsrcs  in6_mcast_maxsocksrc)
+   return (ENOBUFS);
+
+   if (msfr.msfr_fmode != MCAST_EXCLUDE 
+   msfr.msfr_fmode != MCAST_INCLUDE)
return (EINVAL);
 
if (msfr.msfr_group.ss_family != AF_INET6 ||
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r199525 - head/sys/netinet

2009-11-19 Thread Bruce M Simpson
Author: bms
Date: Thu Nov 19 13:21:37 2009
New Revision: 199525
URL: http://svn.freebsd.org/changeset/base/199525

Log:
  Correct a comment.
  
  MFC after:1 day

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Thu Nov 19 12:51:19 2009(r199524)
+++ head/sys/netinet/in_mcast.c Thu Nov 19 13:21:37 2009(r199525)
@@ -1967,7 +1967,7 @@ inp_join_group(struct inpcb *inp, struct
imf = imo-imo_mfilters[idx];
if (ssa-ss.ss_family != AF_UNSPEC) {
/*
-* MCAST_JOIN_SOURCE on an exclusive membership
+* MCAST_JOIN_SOURCE_GROUP on an exclusive membership
 * is an error. On an existing inclusive membership,
 * it just adds the source to the filter list.
 */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r199526 - head/sys/netinet6

2009-11-19 Thread Bruce M Simpson
Author: bms
Date: Thu Nov 19 13:30:06 2009
New Revision: 199526
URL: http://svn.freebsd.org/changeset/base/199526

Log:
  Adapt r197132 to IPv6 stack:
Tighten input checking in in6p_join_group():
 * Don't try to use the source address, when its family is unspecified.
 * If we get a join without a source, on an existing inclusive
   mode group, this is an error, as it would change the filter mode.
  
Fix a problem with the handling of in6_mfilter for new memberships:
 * Do not rely on im6f being NULL; it is explicitly initialized to a
   non-NULL pointer when constructing a membership.
 * Explicitly initialize *im6f to EX mode when the source address
   is unspecified.
  
This fixes a problem with in_mfilter slot recycling in the join path.
  
  MFC after:1 day

Modified:
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet6/in6_mcast.c
==
--- head/sys/netinet6/in6_mcast.c   Thu Nov 19 13:21:37 2009
(r199525)
+++ head/sys/netinet6/in6_mcast.c   Thu Nov 19 13:30:06 2009
(r199526)
@@ -1917,11 +1917,6 @@ in6p_join_group(struct inpcb *inp, struc
 */
(void)in6_setscope(gsa-sin6.sin6_addr, ifp, NULL);
 
-   /*
-* MCAST_JOIN_SOURCE on an exclusive membership is an error.
-* On an existing inclusive membership, it just adds the
-* source to the filter list.
-*/
imo = in6p_findmoptions(inp);
idx = im6o_match_group(imo, ifp, gsa-sa);
if (idx == -1) {
@@ -1929,15 +1924,33 @@ in6p_join_group(struct inpcb *inp, struc
} else {
inm = imo-im6o_membership[idx];
imf = imo-im6o_mfilters[idx];
-   if (ssa-ss.ss_family != AF_UNSPEC 
-   imf-im6f_st[1] != MCAST_INCLUDE) {
-   error = EINVAL;
-   goto out_in6p_locked;
-   }
-   lims = im6o_match_source(imo, idx, ssa-sa);
-   if (lims != NULL) {
-   error = EADDRNOTAVAIL;
-   goto out_in6p_locked;
+   if (ssa-ss.ss_family != AF_UNSPEC) {
+   /*
+* MCAST_JOIN_SOURCE_GROUP on an exclusive membership
+* is an error. On an existing inclusive membership,
+* it just adds the source to the filter list.
+*/
+   if (imf-im6f_st[1] != MCAST_INCLUDE) {
+   error = EINVAL;
+   goto out_in6p_locked;
+   }
+   /* Throw out duplicates. */
+   lims = im6o_match_source(imo, idx, ssa-sa);
+   if (lims != NULL) {
+   error = EADDRNOTAVAIL;
+   goto out_in6p_locked;
+   }
+   } else {
+   /*
+* MCAST_JOIN_GROUP on an existing inclusive
+* membership is an error; if you want to change
+* filter mode, you must use the userland API
+* setsourcefilter().
+*/
+   if (imf-im6f_st[1] == MCAST_INCLUDE) {
+   error = EINVAL;
+   goto out_in6p_locked;
+   }
}
}
 
@@ -1970,7 +1983,8 @@ in6p_join_group(struct inpcb *inp, struc
/*
 * Graft new source into filter list for this inpcb's
 * membership of the group. The in6_multi may not have
-* been allocated yet if this is a new membership.
+* been allocated yet if this is a new membership, however,
+* the in_mfilter slot will be allocated and must be initialized.
 */
if (ssa-ss.ss_family != AF_UNSPEC) {
/* Membership starts in IN mode */
@@ -1987,6 +2001,12 @@ in6p_join_group(struct inpcb *inp, struc
error = ENOMEM;
goto out_im6o_free;
}
+   } else {
+   /* No address specified; Membership starts in EX mode */
+   if (is_new) {
+   CTR1(KTR_MLD, %s: new join w/o source, __func__);
+   im6f_init(imf, MCAST_UNDEFINED, MCAST_EXCLUDE);
+   }
}
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r199527 - head/sys/netinet6

2009-11-19 Thread Bruce M Simpson
Author: bms
Date: Thu Nov 19 13:33:23 2009
New Revision: 199527
URL: http://svn.freebsd.org/changeset/base/199527

Log:
  Adapt r197135 to IPv6 stack:
Don't allow joins w/o source on an existing group.
This is almost always pilot error.
  
We don't need to check for group filter UNDEFINED state at t1,
because we only ever allocate filters with their groups, so we
unconditionally reject such calls with EINVAL.
Trying to change the active filter mode w/o going through IPV6_MSFILTER
is also disallowed.
  
  MFC after:1 day

Modified:
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet6/in6_mcast.c
==
--- head/sys/netinet6/in6_mcast.c   Thu Nov 19 13:30:06 2009
(r199526)
+++ head/sys/netinet6/in6_mcast.c   Thu Nov 19 13:33:23 2009
(r199527)
@@ -1942,15 +1942,18 @@ in6p_join_group(struct inpcb *inp, struc
}
} else {
/*
-* MCAST_JOIN_GROUP on an existing inclusive
-* membership is an error; if you want to change
-* filter mode, you must use the userland API
-* setsourcefilter().
+* MCAST_JOIN_GROUP alone, on any existing membership,
+* is rejected, to stop the same inpcb tying up
+* multiple refs to the in_multi.
+* On an existing inclusive membership, this is also
+* an error; if you want to change filter mode,
+* you must use the userland API setsourcefilter().
+* XXX We don't reject this for imf in UNDEFINED
+* state at t1, because allocation of a filter
+* is atomic with allocation of a membership.
 */
-   if (imf-im6f_st[1] == MCAST_INCLUDE) {
-   error = EINVAL;
-   goto out_in6p_locked;
-   }
+   error = EINVAL;
+   goto out_in6p_locked;
}
}
 
@@ -1985,6 +1988,9 @@ in6p_join_group(struct inpcb *inp, struc
 * membership of the group. The in6_multi may not have
 * been allocated yet if this is a new membership, however,
 * the in_mfilter slot will be allocated and must be initialized.
+*
+* Note: Grafting of exclusive mode filters doesn't happen
+* in this path.
 */
if (ssa-ss.ss_family != AF_UNSPEC) {
/* Membership starts in IN mode */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r199528 - head/sys/netinet6

2009-11-19 Thread Bruce M Simpson
Author: bms
Date: Thu Nov 19 13:39:07 2009
New Revision: 199528
URL: http://svn.freebsd.org/changeset/base/199528

Log:
  Adapt r197136 to IPv6 stack:
Comment some flawed assumptions in in6p_join_group() about
mixing SSM full-state and delta-based APIs.
  
  MFC after:1 day

Modified:
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet6/in6_mcast.c
==
--- head/sys/netinet6/in6_mcast.c   Thu Nov 19 13:33:23 2009
(r199527)
+++ head/sys/netinet6/in6_mcast.c   Thu Nov 19 13:39:07 2009
(r199528)
@@ -1814,6 +1814,7 @@ in6p_join_group(struct inpcb *inp, struc
 
ifp = NULL;
imf = NULL;
+   lims = NULL;
error = 0;
is_new = 0;
 
@@ -1934,9 +1935,25 @@ in6p_join_group(struct inpcb *inp, struc
error = EINVAL;
goto out_in6p_locked;
}
-   /* Throw out duplicates. */
+   /*
+* Throw out duplicates.
+*
+* XXX FIXME: This makes a naive assumption that
+* even if entries exist for *ssa in this imf,
+* they will be rejected as dupes, even if they
+* are not valid in the current mode (in-mode).
+*
+* in6_msource is transactioned just as for anything
+* else in SSM -- but note naive use of in6m_graft()
+* below for allocating new filter entries.
+*
+* This is only an issue if someone mixes the
+* full-state SSM API with the delta-based API,
+* which is discouraged in the relevant RFCs.
+*/
lims = im6o_match_source(imo, idx, ssa-sa);
-   if (lims != NULL) {
+   if (lims != NULL /*
+   lims-im6sl_st[1] == MCAST_INCLUDE*/) {
error = EADDRNOTAVAIL;
goto out_in6p_locked;
}
@@ -1991,6 +2008,8 @@ in6p_join_group(struct inpcb *inp, struc
 *
 * Note: Grafting of exclusive mode filters doesn't happen
 * in this path.
+* XXX: Should check for non-NULL lims (node exists but may
+* not be in-mode) for interop with full-state API.
 */
if (ssa-ss.ss_family != AF_UNSPEC) {
/* Membership starts in IN mode */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r199354 - stable/8/sys/netinet

2009-11-17 Thread Bruce M Simpson
Author: bms
Date: Tue Nov 17 10:59:51 2009
New Revision: 199354
URL: http://svn.freebsd.org/changeset/base/199354

Log:
  MFC r199287:
Fix a functional regression in multicast.
  
Userland daemons need to see IGMP traffic regardless of the group;
omit the imo filter check if the proto is IGMP. The kernel part
of IGMP will have already filtered appropriately at this point.
  
  Submitted by:   Franz Struwig
  Reported by:Ivor Prebeg, Franz Struwig

Modified:
  stable/8/sys/netinet/raw_ip.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/netinet6/   (props changed)

Modified: stable/8/sys/netinet/raw_ip.c
==
--- stable/8/sys/netinet/raw_ip.c   Tue Nov 17 09:37:43 2009
(r199353)
+++ stable/8/sys/netinet/raw_ip.c   Tue Nov 17 10:59:51 2009
(r199354)
@@ -343,17 +343,35 @@ rip_input(struct mbuf *m, int off)
 */
if (inp-inp_moptions != NULL 
IN_MULTICAST(ntohl(ip-ip_dst.s_addr))) {
-   struct sockaddr_in group;
+   /*
+* If the incoming datagram is for IGMP, allow it
+* through unconditionally to the raw socket.
+*
+* In the case of IGMPv2, we may not have explicitly
+* joined the group, and may have set IFF_ALLMULTI
+* on the interface. imo_multi_filter() may discard
+* control traffic we actually need to see.
+*
+* Userland multicast routing daemons should continue
+* filter the control traffic appropriately.
+*/
int blocked;
 
-   bzero(group, sizeof(struct sockaddr_in));
-   group.sin_len = sizeof(struct sockaddr_in);
-   group.sin_family = AF_INET;
-   group.sin_addr = ip-ip_dst;
-
-   blocked = imo_multi_filter(inp-inp_moptions, ifp,
-   (struct sockaddr *)group,
-   (struct sockaddr *)ripsrc);
+   blocked = MCAST_PASS;
+   if (proto != IPPROTO_IGMP) {
+   struct sockaddr_in group;
+
+   bzero(group, sizeof(struct sockaddr_in));
+   group.sin_len = sizeof(struct sockaddr_in);
+   group.sin_family = AF_INET;
+   group.sin_addr = ip-ip_dst;
+
+   blocked = imo_multi_filter(inp-inp_moptions,
+   ifp,
+   (struct sockaddr *)group,
+   (struct sockaddr *)ripsrc);
+   }
+
if (blocked != MCAST_PASS) {
IPSTAT_INC(ips_notmember);
continue;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r199287 - head/sys/netinet

2009-11-15 Thread Bruce M Simpson
Author: bms
Date: Sun Nov 15 11:07:22 2009
New Revision: 199287
URL: http://svn.freebsd.org/changeset/base/199287

Log:
  Fix a functional regression in multicast.
  
  Userland daemons need to see IGMP traffic regardless of the group;
  omit the imo filter check if the proto is IGMP. The kernel part
  of IGMP will have already filtered appropriately at this point.
  
  MFC after:  ASAP
  Submitted by:   Franz Struwig
  Reported by:Ivor Prebeg, Franz Struwig

Modified:
  head/sys/netinet/raw_ip.c

Modified: head/sys/netinet/raw_ip.c
==
--- head/sys/netinet/raw_ip.c   Sun Nov 15 07:28:37 2009(r199286)
+++ head/sys/netinet/raw_ip.c   Sun Nov 15 11:07:22 2009(r199287)
@@ -343,17 +343,35 @@ rip_input(struct mbuf *m, int off)
 */
if (inp-inp_moptions != NULL 
IN_MULTICAST(ntohl(ip-ip_dst.s_addr))) {
-   struct sockaddr_in group;
+   /*
+* If the incoming datagram is for IGMP, allow it
+* through unconditionally to the raw socket.
+*
+* In the case of IGMPv2, we may not have explicitly
+* joined the group, and may have set IFF_ALLMULTI
+* on the interface. imo_multi_filter() may discard
+* control traffic we actually need to see.
+*
+* Userland multicast routing daemons should continue
+* filter the control traffic appropriately.
+*/
int blocked;
 
-   bzero(group, sizeof(struct sockaddr_in));
-   group.sin_len = sizeof(struct sockaddr_in);
-   group.sin_family = AF_INET;
-   group.sin_addr = ip-ip_dst;
-
-   blocked = imo_multi_filter(inp-inp_moptions, ifp,
-   (struct sockaddr *)group,
-   (struct sockaddr *)ripsrc);
+   blocked = MCAST_PASS;
+   if (proto != IPPROTO_IGMP) {
+   struct sockaddr_in group;
+
+   bzero(group, sizeof(struct sockaddr_in));
+   group.sin_len = sizeof(struct sockaddr_in);
+   group.sin_family = AF_INET;
+   group.sin_addr = ip-ip_dst;
+
+   blocked = imo_multi_filter(inp-inp_moptions,
+   ifp,
+   (struct sockaddr *)group,
+   (struct sockaddr *)ripsrc);
+   }
+
if (blocked != MCAST_PASS) {
IPSTAT_INC(ips_notmember);
continue;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r197314 - head/sys/netinet

2009-09-18 Thread Bruce M Simpson
Author: bms
Date: Fri Sep 18 15:12:31 2009
New Revision: 197314
URL: http://svn.freebsd.org/changeset/base/197314

Log:
  Return ENOBUFS consistently if user attempts to exceed
  in_mcast_maxsocksrc resource limit.
  
  Submitted by: syrinx
  MFC after:3 days

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Fri Sep 18 14:53:01 2009(r197313)
+++ head/sys/netinet/in_mcast.c Fri Sep 18 15:12:31 2009(r197314)
@@ -2427,8 +2427,10 @@ inp_set_source_filters(struct inpcb *inp
if (error)
return (error);
 
-   if (msfr.msfr_nsrcs  in_mcast_maxsocksrc ||
-   (msfr.msfr_fmode != MCAST_EXCLUDE 
+   if (msfr.msfr_nsrcs  in_mcast_maxsocksrc)
+   return (ENOBUFS);
+
+   if ((msfr.msfr_fmode != MCAST_EXCLUDE 
 msfr.msfr_fmode != MCAST_INCLUDE))
return (EINVAL);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r197280 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ciss dev/xen/xenpci netinet

2009-09-17 Thread Bruce M Simpson
Author: bms
Date: Thu Sep 17 13:41:59 2009
New Revision: 197280
URL: http://svn.freebsd.org/changeset/base/197280

Log:
  MFC revs 197129,197130,197132:
   Fixes to mcast userland API.
  --
Fix an API issue in leave processing for IPv4 multicast groups.
 * Do not assume that the group lookup performed by imo_match_group()
   is valid when ifp is NULL in this case.
 * Instead, return EADDRNOTAVAIL if the ifp cannot be resolved for the
   membership we are being asked to leave.
  
Caveat user:
 * The way IPv4 multicast memberships are implemented in the inpcb layer
   at the moment, has the side-effect that struct ip_moptions will
   still hold the membership, under the old ifp, until ip_freemoptions()
   is called for the parent inpcb.
 * The underlying issue is: the inpcb layer does not get notification
   of ifp being detached going away in a thread-safe manner.
   This is non-trivial to fix.
  --
Fix an obvious logic error in the IPv4 multicast leave processing,
where the filter mode vector was not updated correctly after the leave.
  --
Tighten input checking in inp_join_group():
 * Don't try to use the source address, when its family is unspecified.
 * If we get a join without a source, on an existing inclusive
   mode group, this is an error, as it would change the filter mode.
  
Fix a problem with the handling of in_mfilter for new memberships:
 * Do not rely on imf being NULL; it is explicitly initialized to a
   non-NULL pointer when constructing a membership.
 * Explicitly initialize *imf to EX mode when the source address
   is unspecified.
This fixes a problem with in_mfilter slot recycling in the join path.
  --
Don't allow joins w/o source on an existing group.
This is almost always pilot error.
  
We don't need to check for group filter UNDEFINED state at t1,
because we only ever allocate filters with their groups, so we
unconditionally reject such calls with EINVAL.
Trying to change the active filter mode w/o going through IP_MSFILTER
is also disallowed.
  
Deals with the case described in PR 137164 upfront, cumulative
with the fix in svn rev 197132 which only calls imo_match_source()
if the source address family was not unspecified.
  --
  
  Revision 197136 has a text conflict, however it is a comment only change.
  
  PR:   137164, 138689, 138690, 138691
  Submitted by: Stef Walter (with fixups)
  Approved by:  re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/ciss/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/netinet/in_mcast.c

Modified: stable/8/sys/netinet/in_mcast.c
==
--- stable/8/sys/netinet/in_mcast.c Thu Sep 17 13:33:40 2009
(r197279)
+++ stable/8/sys/netinet/in_mcast.c Thu Sep 17 13:41:59 2009
(r197280)
@@ -1957,11 +1957,6 @@ inp_join_group(struct inpcb *inp, struct
if (ifp == NULL || (ifp-if_flags  IFF_MULTICAST) == 0)
return (EADDRNOTAVAIL);
 
-   /*
-* MCAST_JOIN_SOURCE on an exclusive membership is an error.
-* On an existing inclusive membership, it just adds the
-* source to the filter list.
-*/
imo = inp_findmoptions(inp);
idx = imo_match_group(imo, ifp, gsa-sa);
if (idx == -1) {
@@ -1969,15 +1964,33 @@ inp_join_group(struct inpcb *inp, struct
} else {
inm = imo-imo_membership[idx];
imf = imo-imo_mfilters[idx];
-   if (ssa-ss.ss_family != AF_UNSPEC 
-   imf-imf_st[1] != MCAST_INCLUDE) {
-   error = EINVAL;
-   goto out_inp_locked;
-   }
-   lims = imo_match_source(imo, idx, ssa-sa);
-   if (lims != NULL) {
-   error = EADDRNOTAVAIL;
-   goto out_inp_locked;
+   if (ssa-ss.ss_family != AF_UNSPEC) {
+   /*
+* MCAST_JOIN_SOURCE on an exclusive membership
+* is an error. On an existing inclusive membership,
+* it just adds the source to the filter list.
+*/
+   if (imf-imf_st[1] != MCAST_INCLUDE) {
+   error = EINVAL;
+   goto out_inp_locked;
+   }
+   /* Throw out duplicates. */
+   lims = imo_match_source(imo, idx, ssa-sa);
+   if (lims != NULL) {
+   error = EADDRNOTAVAIL;
+  

svn commit: r197129 - head/sys/netinet

2009-09-12 Thread Bruce M Simpson
Author: bms
Date: Sat Sep 12 18:55:15 2009
New Revision: 197129
URL: http://svn.freebsd.org/changeset/base/197129

Log:
  Fix an API issue in leave processing for IPv4 multicast groups.
   * Do not assume that the group lookup performed by imo_match_group()
 is valid when ifp is NULL in this case.
   * Instead, return EADDRNOTAVAIL if the ifp cannot be resolved for the
 membership we are being asked to leave.
  
  Caveat user:
   * The way IPv4 multicast memberships are implemented in the inpcb layer
 at the moment, has the side-effect that struct ip_moptions will
 still hold the membership, under the old ifp, until ip_freemoptions()
 is called for the parent inpcb.
   * The underlying issue is: the inpcb layer does not get notification
 of ifp being detached going away in a thread-safe manner.
 This is non-trivial to fix.
  
  But hey, at least the kernel should't panic when you unplug a card.
  
  PR:   138689
  Submitted by: Stef Walter
  MFC after:5 days

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Sat Sep 12 18:24:31 2009(r197128)
+++ head/sys/netinet/in_mcast.c Sat Sep 12 18:55:15 2009(r197129)
@@ -2189,6 +2189,9 @@ inp_leave_group(struct inpcb *inp, struc
if (!IN_MULTICAST(ntohl(gsa-sin.sin_addr.s_addr)))
return (EINVAL);
 
+   if (ifp == NULL)
+   return (EADDRNOTAVAIL);
+
/*
 * Find the membership in the membership array.
 */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r197130 - head/sys/netinet

2009-09-12 Thread Bruce M Simpson
Author: bms
Date: Sat Sep 12 19:07:03 2009
New Revision: 197130
URL: http://svn.freebsd.org/changeset/base/197130

Log:
  Fix an obvious logic error in the IPv4 multicast leave processing,
  where the filter mode vector was not updated correctly after the leave.
  
  PR:   138691
  Submitted by: Stef Walter
  MFC after:5 days

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Sat Sep 12 18:55:15 2009(r197129)
+++ head/sys/netinet/in_mcast.c Sat Sep 12 19:07:03 2009(r197130)
@@ -2278,9 +2278,11 @@ out_imf_rollback:
imf_reap(imf);
 
if (is_final) {
-   /* Remove the gap in the membership array. */
-   for (++idx; idx  imo-imo_num_memberships; ++idx)
+   /* Remove the gap in the membership and filter array. */
+   for (++idx; idx  imo-imo_num_memberships; ++idx) {
imo-imo_membership[idx-1] = imo-imo_membership[idx];
+   imo-imo_mfilters[idx-1] = imo-imo_mfilters[idx];
+   }
imo-imo_num_memberships--;
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r197132 - head/sys/netinet

2009-09-12 Thread Bruce M Simpson
Author: bms
Date: Sat Sep 12 19:45:55 2009
New Revision: 197132
URL: http://svn.freebsd.org/changeset/base/197132

Log:
  Tighten input checking in inp_join_group():
   * Don't try to use the source address, when its family is unspecified.
   * If we get a join without a source, on an existing inclusive
 mode group, this is an error, as it would change the filter mode.
  
  Fix a problem with the handling of in_mfilter for new memberships:
   * Do not rely on imf being NULL; it is explicitly initialized to a
 non-NULL pointer when constructing a membership.
   * Explicitly initialize *imf to EX mode when the source address
 is unspecified.
  
  This fixes a problem with in_mfilter slot recycling in the join path.
  
  PR:   138690
  Submitted by: Stef Walter
  MFC after:5 days

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Sat Sep 12 19:27:54 2009(r197131)
+++ head/sys/netinet/in_mcast.c Sat Sep 12 19:45:55 2009(r197132)
@@ -1957,11 +1957,6 @@ inp_join_group(struct inpcb *inp, struct
if (ifp == NULL || (ifp-if_flags  IFF_MULTICAST) == 0)
return (EADDRNOTAVAIL);
 
-   /*
-* MCAST_JOIN_SOURCE on an exclusive membership is an error.
-* On an existing inclusive membership, it just adds the
-* source to the filter list.
-*/
imo = inp_findmoptions(inp);
idx = imo_match_group(imo, ifp, gsa-sa);
if (idx == -1) {
@@ -1969,15 +1964,33 @@ inp_join_group(struct inpcb *inp, struct
} else {
inm = imo-imo_membership[idx];
imf = imo-imo_mfilters[idx];
-   if (ssa-ss.ss_family != AF_UNSPEC 
-   imf-imf_st[1] != MCAST_INCLUDE) {
-   error = EINVAL;
-   goto out_inp_locked;
-   }
-   lims = imo_match_source(imo, idx, ssa-sa);
-   if (lims != NULL) {
-   error = EADDRNOTAVAIL;
-   goto out_inp_locked;
+   if (ssa-ss.ss_family != AF_UNSPEC) {
+   /*
+* MCAST_JOIN_SOURCE on an exclusive membership
+* is an error. On an existing inclusive membership,
+* it just adds the source to the filter list.
+*/
+   if (imf-imf_st[1] != MCAST_INCLUDE) {
+   error = EINVAL;
+   goto out_inp_locked;
+   }
+   /* Throw out duplicates. */
+   lims = imo_match_source(imo, idx, ssa-sa);
+   if (lims != NULL) {
+   error = EADDRNOTAVAIL;
+   goto out_inp_locked;
+   }
+   } else {
+   /*
+* MCAST_JOIN_GROUP on an existing inclusive
+* membership is an error; if you want to change
+* filter mode, you must use the userland API
+* setsourcefilter().
+*/
+   if (imf-imf_st[1] == MCAST_INCLUDE) {
+   error = EINVAL;
+   goto out_inp_locked;
+   }
}
}
 
@@ -2010,7 +2023,8 @@ inp_join_group(struct inpcb *inp, struct
/*
 * Graft new source into filter list for this inpcb's
 * membership of the group. The in_multi may not have
-* been allocated yet if this is a new membership.
+* been allocated yet if this is a new membership, however,
+* the in_mfilter slot will be allocated and must be initialized.
 */
if (ssa-ss.ss_family != AF_UNSPEC) {
/* Membership starts in IN mode */
@@ -2027,6 +2041,12 @@ inp_join_group(struct inpcb *inp, struct
error = ENOMEM;
goto out_imo_free;
}
+   } else {
+   /* No address specified; Membership starts in EX mode */
+   if (is_new) {
+   CTR1(KTR_IGMPV3, %s: new join w/o source, __func__);
+   imf_init(imf, MCAST_UNDEFINED, MCAST_EXCLUDE);
+   }
}
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r197135 - head/sys/netinet

2009-09-12 Thread Bruce M Simpson
Author: bms
Date: Sat Sep 12 20:18:23 2009
New Revision: 197135
URL: http://svn.freebsd.org/changeset/base/197135

Log:
  Don't allow joins w/o source on an existing group.
  This is almost always pilot error.
  
  We don't need to check for group filter UNDEFINED state at t1,
  because we only ever allocate filters with their groups, so we
  unconditionally reject such calls with EINVAL.
  Trying to change the active filter mode w/o going through IP_MSFILTER
  is also disallowed.
  
  Deals with the case described in PR 137164 upfront, cumulative
  with the fix in svn rev 197132 which only calls imo_match_source()
  if the source address family was not unspecified.
  
  PR:   137164
  MFC after:5 days

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Sat Sep 12 20:03:45 2009(r197134)
+++ head/sys/netinet/in_mcast.c Sat Sep 12 20:18:23 2009(r197135)
@@ -1982,15 +1982,18 @@ inp_join_group(struct inpcb *inp, struct
}
} else {
/*
-* MCAST_JOIN_GROUP on an existing inclusive
-* membership is an error; if you want to change
-* filter mode, you must use the userland API
-* setsourcefilter().
+* MCAST_JOIN_GROUP alone, on any existing membership,
+* is rejected, to stop the same inpcb tying up
+* multiple refs to the in_multi.
+* On an existing inclusive membership, this is also
+* an error; if you want to change filter mode,
+* you must use the userland API setsourcefilter().
+* XXX We don't reject this for imf in UNDEFINED
+* state at t1, because allocation of a filter
+* is atomic with allocation of a membership.
 */
-   if (imf-imf_st[1] == MCAST_INCLUDE) {
-   error = EINVAL;
-   goto out_inp_locked;
-   }
+   error = EINVAL;
+   goto out_inp_locked;
}
}
 
@@ -2025,6 +2028,9 @@ inp_join_group(struct inpcb *inp, struct
 * membership of the group. The in_multi may not have
 * been allocated yet if this is a new membership, however,
 * the in_mfilter slot will be allocated and must be initialized.
+*
+* Note: Grafting of exclusive mode filters doesn't happen
+* in this path.
 */
if (ssa-ss.ss_family != AF_UNSPEC) {
/* Membership starts in IN mode */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r197136 - head/sys/netinet

2009-09-12 Thread Bruce M Simpson
Author: bms
Date: Sat Sep 12 20:37:44 2009
New Revision: 197136
URL: http://svn.freebsd.org/changeset/base/197136

Log:
  Comment some flawed assumptions in inp_join_group() about
  mixing SSM full-state and delta-based APIs.
  
  ENOTIME to fix right now.  No functional changes.
  
  MFC after:5 days

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Sat Sep 12 20:18:23 2009(r197135)
+++ head/sys/netinet/in_mcast.c Sat Sep 12 20:37:44 2009(r197136)
@@ -1857,6 +1857,7 @@ inp_join_group(struct inpcb *inp, struct
 
ifp = NULL;
imf = NULL;
+   lims = NULL;
error = 0;
is_new = 0;
 
@@ -1974,9 +1975,25 @@ inp_join_group(struct inpcb *inp, struct
error = EINVAL;
goto out_inp_locked;
}
-   /* Throw out duplicates. */
+   /*
+* Throw out duplicates.
+*
+* XXX FIXME: This makes a naive assumption that
+* even if entries exist for *ssa in this imf,
+* they will be rejected as dupes, even if they
+* are not valid in the current mode (in-mode).
+*
+* in_msource is transactioned just as for anything
+* else in SSM -- but note naive use of inm_graft()
+* below for allocating new filter entries.
+*
+* This is only an issue if someone mixes the
+* full-state SSM API with the delta-based API,
+* which is discouraged in the relevant RFCs.
+*/
lims = imo_match_source(imo, idx, ssa-sa);
-   if (lims != NULL) {
+   if (lims != NULL /*
+   lims-imsl_st[1] == MCAST_INCLUDE*/) {
error = EADDRNOTAVAIL;
goto out_inp_locked;
}
@@ -2031,6 +2048,8 @@ inp_join_group(struct inpcb *inp, struct
 *
 * Note: Grafting of exclusive mode filters doesn't happen
 * in this path.
+* XXX: Should check for non-NULL lims (node exists but may
+* not be in-mode) for interop with full-state API.
 */
if (ssa-ss.ss_family != AF_UNSPEC) {
/* Membership starts in IN mode */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r197148 - head/sys/netinet

2009-09-12 Thread Bruce M Simpson
Author: bms
Date: Sun Sep 13 01:00:24 2009
New Revision: 197148
URL: http://svn.freebsd.org/changeset/base/197148

Log:
  In expire_mfc(), add an assert on the multicast forwarding cache mutex.
  
  PR:   138666

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cSat Sep 12 23:01:36 2009
(r197147)
+++ head/sys/netinet/ip_mroute.cSun Sep 13 01:00:24 2009
(r197148)
@@ -1025,6 +1025,8 @@ expire_mfc(struct mfc *rt)
 {
struct rtdetq *rte, *nrte;
 
+   MFC_LOCK_ASSERT();
+
free_bw_list(rt-mfc_bw_meter);
 
TAILQ_FOREACH_SAFE(rte, rt-mfc_stall, rte_link, nrte) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196541 - stable/7/etc

2009-08-25 Thread Bruce M Simpson
Author: bms
Date: Tue Aug 25 13:39:14 2009
New Revision: 196541
URL: http://svn.freebsd.org/changeset/base/196541

Log:
  MFC r179014:
   Add support for /conf/T/M/remount_optional.
  
   The rc.initdiskless functionality is used by NanoBSD to allow configuration
   files to live on a separate configuration slice, which acts as NVRAM, whilst
   the system image is mounted read-only.
  
   Normally, if the remount command fails during boot, this is regarded as
   a fatal error. If /conf/T/M/remount_optional is present, this error is
   non-fatal. If the file is not present, the default behaviour is unchanged.
  
   This is very useful for people building live CD images using FreeBSD,
   where the NVRAM lives somewhere completely differently from the system image,
   and may be present on removable media which is not present during the
   initial boot.

Modified:
  stable/7/etc/   (props changed)
  stable/7/etc/rc.initdiskless
  stable/7/etc/termcap.small   (props changed)

Modified: stable/7/etc/rc.initdiskless
==
--- stable/7/etc/rc.initdisklessTue Aug 25 13:04:13 2009
(r196540)
+++ stable/7/etc/rc.initdisklessTue Aug 25 13:39:14 2009
(r196541)
@@ -69,6 +69,10 @@
 #  /conf/1.2.3.4/foo/remount contains mount -o ro /dev/ad0s3,
 #  then /dev/ad0s3 will be be mounted on /conf/1.2.3.4/foo/
 #
+# /conf/T/M/remount_optional
+#  If this file exists, then failure to execute the mount
+#  command contained in /conf/T/M/remount is non-fatal.
+#
 # /conf/T/M/diskless_remount
 #  The contents of the file points to an NFS filesystem,
 #  possibly followed by mount_nfs options. If the server name
@@ -147,8 +151,12 @@ log() {
 #
 #  checks error code and drops into shell on failure.
 #  if shell exits, terminates script as well as /etc/rc.
+#  if remount_optional exists under the mountpoint, skip this check.
 #
 chkerr() {
+lastitem () ( n=$(($# - 1)) ; shift $n ; echo $1 )
+mountpoint=$(lastitem $2)
+[ -r $mountpoint/remount_optional ]  ( echo $2 failed: ignoring due to 
remount_optional ; return )
 case $1 in
 0)
;;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196542 - stable/7/etc

2009-08-25 Thread Bruce M Simpson
Author: bms
Date: Tue Aug 25 13:40:46 2009
New Revision: 196542
URL: http://svn.freebsd.org/changeset/base/196542

Log:
  MFC r182895:
   Add support to rc.initdiskless for /conf/T/M/remount_subdir.
   This allows the location of the configuration data to be relocated
   within the filesystem containing it. A nullfs mount is used in order
   to achieve this.
  
  Obtained from:XORP, Inc.

Modified:
  stable/7/etc/   (props changed)
  stable/7/etc/rc.initdiskless
  stable/7/etc/termcap.small   (props changed)

Modified: stable/7/etc/rc.initdiskless
==
--- stable/7/etc/rc.initdisklessTue Aug 25 13:39:14 2009
(r196541)
+++ stable/7/etc/rc.initdisklessTue Aug 25 13:40:46 2009
(r196542)
@@ -73,6 +73,16 @@
 #  If this file exists, then failure to execute the mount
 #  command contained in /conf/T/M/remount is non-fatal.
 #
+# /conf/T/M/remount_subdir
+#  If this file exists, then the behaviour of /conf/T/M/remount
+#  changes as follows:
+#   1. /conf/T/M/remount is invoked to mount the root of the
+#  filesystem where the configuration data exists on a
+#  temporary mountpoint.
+#   2. /conf/T/M/remount_subdir is then invoked to mount a
+#  *subdirectory* of the filesystem mounted by
+#  /conf/T/M/remount on /conf/T/M/.
+#
 # /conf/T/M/diskless_remount
 #  The contents of the file points to an NFS filesystem,
 #  possibly followed by mount_nfs options. If the server name
@@ -296,10 +306,33 @@ for i in ${templates} ; do
 
# remount. Beware, the command is in the file itself!
if [ -f $j/remount ]; then
-   nfspt=`/bin/cat $j/remount`
-   $nfspt $j
-   chkerr $? $nfspt $j
-   to_umount=$j ${to_umount} # XXX hope it is really a mount!
+   if [ -f $j/remount_subdir ]; then
+   k=/conf.tmp/$i/$subdir
+   [ -d $k ] || continue
+
+   # Mount the filesystem root where the config data is
+   # on the temporary mount point.
+   nfspt=`/bin/cat $j/remount`
+   $nfspt $k
+   chkerr $? $nfspt $k
+
+   # Now use a nullfs mount to get the data where we
+   # really want to see it.
+   remount_subdir=`/bin/cat $j/remount_subdir`
+   remount_subdir_cmd=mount -t nullfs $k/$remount_subdir
+
+   $remount_subdir_cmd $j
+   chkerr $? $remount_subdir_cmd $j
+
+   # XXX check order -- we must force $k to be unmounted
+   # after j, as j depends on k.
+   to_umount=$j $k ${to_umount}
+   else
+   nfspt=`/bin/cat $j/remount`
+   $nfspt $j
+   chkerr $? $nfspt $j
+   to_umount=$j ${to_umount} # XXX hope it is really a mount!
+   fi
fi
 
# NFS remount
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r195835 - in stable/7/sys: . contrib/pf

2009-07-23 Thread Bruce M Simpson
Author: bms
Date: Thu Jul 23 19:03:04 2009
New Revision: 195835
URL: http://svn.freebsd.org/changeset/base/195835

Log:
  Update mergeinfo for merge of r182138 to sys/dev/usb/uipaq.c.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r195823 - stable/7/contrib/gcc

2009-07-22 Thread Bruce M Simpson
Author: bms
Date: Wed Jul 22 15:26:19 2009
New Revision: 195823
URL: http://svn.freebsd.org/changeset/base/195823

Log:
  Mark the dwarf2out.c bug fix, r195815 as integrated;
  using --record-only.
  
  Pointy hat to:bms
  Requested by: kib

Modified:
  stable/7/contrib/gcc/   (props changed)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r195829 - stable/7/sys/dev/usb

2009-07-22 Thread Bruce M Simpson
Author: bms
Date: Thu Jul 23 01:35:13 2009
New Revision: 195829
URL: http://svn.freebsd.org/changeset/base/195829

Log:
  MFC r182138:
   Greatly expand the devices listed as being supported. This list was
   taken from PR/121184 which was mechanically generated from similar
   lists in the Linux ipaq driver. I then took the numbers we had in
   usbdevs and filled in the right symbols and eliminated duplicates.
  
  PR:   usb/121184

Modified:
  stable/7/sys/dev/usb/uipaq.c

Modified: stable/7/sys/dev/usb/uipaq.c
==
--- stable/7/sys/dev/usb/uipaq.cWed Jul 22 22:13:42 2009
(r195828)
+++ stable/7/sys/dev/usb/uipaq.cThu Jul 23 01:35:13 2009
(r195829)
@@ -119,16 +119,465 @@ struct uipaq_type {
u_int16_t   uv_flags;
 };
 
-static const struct uipaq_type uipaq_devs[] = {
-   {{ USB_VENDOR_HP, USB_PRODUCT_HP_2215 }, 0 },
-   {{ USB_VENDOR_HP, USB_PRODUCT_HP_568J }, 0},
-   {{ USB_VENDOR_HTC, USB_PRODUCT_HTC_WINMOBILE }, 0},
-   {{ USB_VENDOR_HTC, USB_PRODUCT_HTC_PPC6700MODEM }, 0},
-   {{ USB_VENDOR_HTC, USB_PRODUCT_HTC_SMARTPHONE }, 0},
-   {{ USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQPOCKETPC } , 0},
-   {{ USB_VENDOR_CASIO, USB_PRODUCT_CASIO_BE300 } , 0},
-   {{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_WZERO3ES }, 0},
-   {{ USB_VENDOR_ASUS, USB_PRODUCT_ASUS_P535 }, 0},
+/*
+ * Much of this list is generated from lists of other drivers that support
+ * the same hardware.  Numeric values are used where no usbdevs entries
+ * exist.
+ */
+ static const struct uipaq_type uipaq_devs[] = {
+   {{ 0x0104, 0x00be }, 0}, /* Socket USB Sync */
+   {{ 0x04ad, 0x0301 }, 0}, /* USB Sync 0301 */
+   {{ 0x04ad, 0x0302 }, 0}, /* USB Sync 0302 */
+   {{ 0x04ad, 0x0303 }, 0}, /* USB Sync 0303 */
+   {{ 0x04ad, 0x0306 }, 0}, /* GPS Pocket PC USB Sync */
+   {{ 0x0536, 0x01a0 }, 0}, /* HHP PDT */
+   {{ 0x067e, 0x1001 }, 0}, /* Intermec Mobile Computer */
+   {{ 0x094b, 0x0001 }, 0}, /* Linkup Systems USB Sync */
+   {{ 0x0960, 0x0065 }, 0}, /* BCOM USB Sync 0065 */
+   {{ 0x0960, 0x0066 }, 0}, /* BCOM USB Sync 0066 */
+   {{ 0x0960, 0x0067 }, 0}, /* BCOM USB Sync 0067 */
+   {{ 0x0961, 0x0010 }, 0}, /* Portatec USB Sync */
+   {{ 0x099e, 0x0052 }, 0}, /* Trimble GeoExplorer */
+   {{ 0x099e, 0x4000 }, 0}, /* TDS Data Collector */
+   {{ 0x0c44, 0x03a2 }, 0}, /* Motorola iDEN Smartphone */
+   {{ 0x0c8e, 0x6000 }, 0}, /* Cesscom Luxian Series */
+   {{ 0x0cad, 0x9001 }, 0}, /* Motorola PowerPad Pocket PCDevice */
+   {{ 0x0f4e, 0x0200 }, 0}, /* Freedom Scientific USB Sync */
+   {{ 0x0f98, 0x0201 }, 0}, /* Cyberbank USB Sync */
+   {{ 0x0fb8, 0x3001 }, 0}, /* Wistron USB Sync */
+   {{ 0x0fb8, 0x3002 }, 0}, /* Wistron USB Sync */
+   {{ 0x0fb8, 0x3003 }, 0}, /* Wistron USB Sync */
+   {{ 0x0fb8, 0x4001 }, 0}, /* Wistron USB Sync */
+   {{ 0x1066, 0x00ce }, 0}, /* E-TEN USB Sync */
+   {{ 0x1066, 0x0300 }, 0}, /* E-TEN P3XX Pocket PC */
+   {{ 0x1066, 0x0500 }, 0}, /* E-TEN P5XX Pocket PC */
+   {{ 0x1066, 0x0600 }, 0}, /* E-TEN P6XX Pocket PC */
+   {{ 0x1066, 0x0700 }, 0}, /* E-TEN P7XX Pocket PC */
+   {{ 0x1114, 0x0001 }, 0}, /* Psion Teklogix Sync 753x */
+   {{ 0x1114, 0x0004 }, 0}, /* Psion Teklogix Sync netBookPro */
+   {{ 0x1114, 0x0006 }, 0}, /* Psion Teklogix Sync 7525 */
+   {{ 0x1182, 0x1388 }, 0}, /* VES USB Sync */
+   {{ 0x11d9, 0x1002 }, 0}, /* Rugged Pocket PC 2003 */
+   {{ 0x11d9, 0x1003 }, 0}, /* Rugged Pocket PC 2003 */
+   {{ 0x1231, 0xce01 }, 0}, /* USB Sync 03 */
+   {{ 0x1231, 0xce02 }, 0}, /* USB Sync 03 */
+   {{ 0x3340, 0x011c }, 0}, /* Mio DigiWalker PPC StrongARM */
+   {{ 0x3340, 0x0326 }, 0}, /* Mio DigiWalker 338 */
+   {{ 0x3340, 0x0426 }, 0}, /* Mio DigiWalker 338 */
+   {{ 0x3340, 0x043a }, 0}, /* Mio DigiWalker USB Sync */
+   {{ 0x3340, 0x051c }, 0}, /* MiTAC USB Sync 528 */
+   {{ 0x3340, 0x053a }, 0}, /* Mio DigiWalker SmartPhone USB Sync */
+   {{ 0x3340, 0x071c }, 0}, /* MiTAC USB Sync */
+   {{ 0x3340, 0x0b1c }, 0}, /* Generic PPC StrongARM */
+   {{ 0x3340, 0x0e3a }, 0}, /* Generic PPC USB Sync */
+   {{ 0x3340, 0x0f1c }, 0}, /* Itautec USB Sync */
+   {{ 0x3340, 0x0f3a }, 0}, /* Generic SmartPhone USB Sync */
+   {{ 0x3340, 0x1326 }, 0}, /* Itautec USB Sync */
+   {{ 0x3340, 0x191c }, 0}, /* YAKUMO USB Sync */
+   {{ 0x3340, 0x2326 }, 0}, /* Vobis USB Sync */
+   {{ 0x3340, 0x3326 }, 0}, /* MEDION Winodws Moble USB Sync */
+   {{ 0x3708, 0x20ce }, 0}, /* Legend USB Sync */
+   {{ 0x3708, 0x21ce }, 0}, /* Lenovo USB Sync */
+   {{ 0x4113, 0x0210 }, 0}, /* Mobile Media Technology USB Sync */
+   {{ 0x4113, 0x0211 }, 0}, /* Mobile Media Technology USB Sync */
+   {{ 0x4113, 0x0400 }, 0}, /* Mobile 

svn commit: r195816 - stable/7/contrib/gcc

2009-07-21 Thread Bruce M Simpson
Author: bms
Date: Wed Jul 22 01:07:49 2009
New Revision: 195816
URL: http://svn.freebsd.org/changeset/base/195816

Log:
  Output DWARF debug information for global 'using' declarations, instead
  of just blowing up. A very similar change to this exists which is
  GPLv3 licensed, this is my own change.
  
  This problem was triggered by running the Boost regression tests.
  
  See also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31899
  Reviewed by:  luigi

Modified:
  stable/7/contrib/gcc/dwarf2out.c

Modified: stable/7/contrib/gcc/dwarf2out.c
==
--- stable/7/contrib/gcc/dwarf2out.cWed Jul 22 01:07:11 2009
(r195815)
+++ stable/7/contrib/gcc/dwarf2out.cWed Jul 22 01:07:49 2009
(r195816)
@@ -10007,7 +10007,7 @@ reference_to_unused (tree * tp, int * wa
 return NULL_TREE;
   else if (!cgraph_global_info_ready
(TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL))
-gcc_unreachable ();
+return *tp;
   else if (DECL_P (*tp)  TREE_CODE (*tp) == VAR_DECL)
 {
   struct cgraph_varpool_node *node = cgraph_varpool_node (*tp);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r195815 - head/contrib/gcc

2009-07-21 Thread Bruce M Simpson
Author: bms
Date: Wed Jul 22 01:07:11 2009
New Revision: 195815
URL: http://svn.freebsd.org/changeset/base/195815

Log:
  Output DWARF debug information for global 'using' declarations, instead
  of just blowing up. A very similar change to this exists which is
  GPLv3 licensed, this is my own change.
  
  This problem was triggered by running the Boost regression tests.
  
  See also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31899
  Reviewed by:  luigi
  Approved by:  re (kib)

Modified:
  head/contrib/gcc/dwarf2out.c

Modified: head/contrib/gcc/dwarf2out.c
==
--- head/contrib/gcc/dwarf2out.cTue Jul 21 21:58:55 2009
(r195814)
+++ head/contrib/gcc/dwarf2out.cWed Jul 22 01:07:11 2009
(r195815)
@@ -10007,7 +10007,7 @@ reference_to_unused (tree * tp, int * wa
 return NULL_TREE;
   else if (!cgraph_global_info_ready
(TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL))
-gcc_unreachable ();
+return *tp;
   else if (DECL_P (*tp)  TREE_CODE (*tp) == VAR_DECL)
 {
   struct cgraph_varpool_node *node = cgraph_varpool_node (*tp);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r195764 - stable/7/contrib/gcc

2009-07-19 Thread Bruce M Simpson
Author: bms
Date: Sun Jul 19 16:50:48 2009
New Revision: 195764
URL: http://svn.freebsd.org/changeset/base/195764

Log:
  Output debug information for global 'using' declarations, instead
  of just blowing up. A very similar change to this exists which is
  GPLv3 licensed, this is my own change.
  
  See also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31899
  Reviewed by:  luigi

Modified:
  stable/7/contrib/gcc/dwarf2out.c

Modified: stable/7/contrib/gcc/dwarf2out.c
==
--- stable/7/contrib/gcc/dwarf2out.cSun Jul 19 16:48:25 2009
(r195763)
+++ stable/7/contrib/gcc/dwarf2out.cSun Jul 19 16:50:48 2009
(r195764)
@@ -10007,7 +10007,7 @@ reference_to_unused (tree * tp, int * wa
 return NULL_TREE;
   else if (!cgraph_global_info_ready
(TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL))
-gcc_unreachable ();
+return *tp;
   else if (DECL_P (*tp)  TREE_CODE (*tp) == VAR_DECL)
 {
   struct cgraph_varpool_node *node = cgraph_varpool_node (*tp);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r195766 - stable/7/contrib/gcc

2009-07-19 Thread Bruce M Simpson
Author: bms
Date: Sun Jul 19 17:13:16 2009
New Revision: 195766
URL: http://svn.freebsd.org/changeset/base/195766

Log:
  Revert previous change.
  
  Requested by: kib

Modified:
  stable/7/contrib/gcc/dwarf2out.c

Modified: stable/7/contrib/gcc/dwarf2out.c
==
--- stable/7/contrib/gcc/dwarf2out.cSun Jul 19 16:54:24 2009
(r195765)
+++ stable/7/contrib/gcc/dwarf2out.cSun Jul 19 17:13:16 2009
(r195766)
@@ -10007,7 +10007,7 @@ reference_to_unused (tree * tp, int * wa
 return NULL_TREE;
   else if (!cgraph_global_info_ready
(TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL))
-return *tp;
+gcc_unreachable ();
   else if (DECL_P (*tp)  TREE_CODE (*tp) == VAR_DECL)
 {
   struct cgraph_varpool_node *node = cgraph_varpool_node (*tp);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r195770 - stable/7/sys/netinet

2009-07-19 Thread Bruce M Simpson
Author: bms
Date: Sun Jul 19 18:36:54 2009
New Revision: 195770
URL: http://svn.freebsd.org/changeset/base/195770

Log:
  Fix two typos in sctp_send_initiate(); these corrupt the INIT chunk on
  64-bit platforms, in the 7.x SCTP stack.
  
  Observed on 7.2-STABLE/amd64.
  
  Submitted by:   Michael Tuexen
  Reviewed by:rrs

Modified:
  stable/7/sys/netinet/sctp_output.c

Modified: stable/7/sys/netinet/sctp_output.c
==
--- stable/7/sys/netinet/sctp_output.c  Sun Jul 19 17:40:45 2009
(r195769)
+++ stable/7/sys/netinet/sctp_output.c  Sun Jul 19 18:36:54 2009
(r195770)
@@ -6087,7 +6087,7 @@ sctp_send_initiate(struct sctp_inpcb *in
ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m));
ph-param_type = htons(SCTP_HAS_NAT_SUPPORT);
ph-param_length = htons(sizeof(struct sctp_paramhdr));
-   SCTP_BUF_LEN(m) += sizeof(sizeof(struct sctp_paramhdr));
+   SCTP_BUF_LEN(m) += sizeof(struct sctp_paramhdr);
}
/* add authentication parameters */
if (!SCTP_BASE_SYSCTL(sctp_auth_disable)) {
@@ -7198,7 +7198,7 @@ do_a_abort:
ph = (struct sctp_paramhdr *)(mtod(m, caddr_t)+SCTP_BUF_LEN(m));
ph-param_type = htons(SCTP_HAS_NAT_SUPPORT);
ph-param_length = htons(sizeof(struct sctp_paramhdr));
-   SCTP_BUF_LEN(m) += sizeof(sizeof(struct sctp_paramhdr));
+   SCTP_BUF_LEN(m) += sizeof(struct sctp_paramhdr);
}
/* And now tell the peer we do all the extensions */
pr_supported = (struct sctp_supported_chunk_types_param *)(mtod(m, 
caddr_t)+SCTP_BUF_LEN(m));
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r195771 - stable/7/sys/netinet

2009-07-19 Thread Bruce M Simpson
Author: bms
Date: Sun Jul 19 18:37:20 2009
New Revision: 195771
URL: http://svn.freebsd.org/changeset/base/195771

Log:
  When moving an SCTP association from one hash table to another,
  make sure the association's link entry in the hash table is updated.
  This fixes a panic on closing an association in the 7.x SCTP stack.
  
  Observed on 7.2-STABLE/amd64.
  
  Submitted by:   Michael Tuexen
  Reviewed by:rrs

Modified:
  stable/7/sys/netinet/sctp_pcb.c

Modified: stable/7/sys/netinet/sctp_pcb.c
==
--- stable/7/sys/netinet/sctp_pcb.c Sun Jul 19 18:36:54 2009
(r195770)
+++ stable/7/sys/netinet/sctp_pcb.c Sun Jul 19 18:37:20 2009
(r195771)
@@ -2504,7 +2504,9 @@ sctp_move_pcb_and_assoc(struct sctp_inpc
/* Pull the tcb from the old association */
LIST_REMOVE(stcb, sctp_tcbhash);
LIST_REMOVE(stcb, sctp_tcblist);
-
+   if (stcb-asoc.in_asocid_hash) {
+   LIST_REMOVE(stcb, sctp_tcbasocidhash);
+   }
/* Now insert the new_inp into the TCP connected hash */
head = SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR((lport),
SCTP_BASE_INFO(hashtcpmark))];
@@ -2520,7 +2522,12 @@ sctp_move_pcb_and_assoc(struct sctp_inpc
 * only have one connection? Probably not : so lets get rid of it
 * and not suck up any kernel memory in that.
 */
-
+   if (stcb-asoc.in_asocid_hash) {
+   struct sctpasochead *lhd;
+   lhd = 
new_inp-sctp_asocidhash[SCTP_PCBHASH_ASOC(stcb-asoc.assoc_id,
+new_inp-hashasocidmark)];
+   LIST_INSERT_HEAD(lhd, stcb, sctp_tcbasocidhash);
+   }
/* Ok. Let's restart timer. */
TAILQ_FOREACH(net, stcb-asoc.nets, sctp_next) {
sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, new_inp,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r195755 - head/sys/netinet6

2009-07-18 Thread Bruce M Simpson
Author: bms
Date: Sat Jul 18 17:38:18 2009
New Revision: 195755
URL: http://svn.freebsd.org/changeset/base/195755

Log:
  Fix a problem, whereby misbehaving IPv6 applications, which don't include
  a valid zone ID or interface identifier in a v6 multicast leave, would
  trigger a fairly paranoid KASSERT().
  
  Observed with Boost++ regression tests on ref8.freebsd.org.
  
  Approved by:  re (kib)

Modified:
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet6/in6_mcast.c
==
--- head/sys/netinet6/in6_mcast.c   Sat Jul 18 16:33:27 2009
(r195754)
+++ head/sys/netinet6/in6_mcast.c   Sat Jul 18 17:38:18 2009
(r195755)
@@ -2160,14 +2160,24 @@ in6p_leave_group(struct inpcb *inp, stru
if (error)
return (EADDRNOTAVAIL);
/*
+* Some badly behaved applications don't pass an ifindex
+* or a scope ID, which is an API violation. In this case,
+* perform a lookup as per a v6 join.
+*
 * XXX For now, stomp on zone ID for the corner case.
 * This is not the 'KAME way', but we need to see the ifp
 * directly until such time as this implementation is
 * refactored, assuming the scope IDs are the way to go.
 */
ifindex = ntohs(gsa-sin6.sin6_addr.s6_addr16[1]);
-   KASSERT(ifindex != 0, (%s: bad zone ID, __func__));
-   ifp = ifnet_byindex(ifindex);
+   if (ifindex == 0) {
+   CTR2(KTR_MLD, %s: warning: no ifindex, looking up 
+   ifp for group %s., __func__,
+   ip6_sprintf(ip6tbuf, gsa-sin6.sin6_addr));
+   ifp = in6p_lookup_mcast_ifp(inp, gsa-sin6);
+   } else {
+   ifp = ifnet_byindex(ifindex);
+   }
if (ifp == NULL)
return (EADDRNOTAVAIL);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r193231 - head/sys/netinet

2009-06-01 Thread Bruce M Simpson
Author: bms
Date: Mon Jun  1 15:30:18 2009
New Revision: 193231
URL: http://svn.freebsd.org/changeset/base/193231

Log:
  Merge fixes from p4:
   * Tighten v1 query input processing.
   * Borrow changes from MLDv2 for how general queries are processed.
 * Do address field validation upfront before accepting input.
 * Do NOT switch protocol version if old querier present timer active.
   * Always clear IGMPv3 state in igmp_v3_cancel_link_timers().
   * Update comments.
  
  Tested by:deeptech71 at gmail dot com

Modified:
  head/sys/netinet/igmp.c

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Mon Jun  1 15:03:58 2009(r193230)
+++ head/sys/netinet/igmp.c Mon Jun  1 15:30:18 2009(r193231)
@@ -98,7 +98,8 @@ static void   igmp_final_leave(struct in_m
 static int igmp_handle_state_change(struct in_multi *,
struct igmp_ifinfo *);
 static int igmp_initial_join(struct in_multi *, struct igmp_ifinfo *);
-static int igmp_input_v1_query(struct ifnet *, const struct ip *);
+static int igmp_input_v1_query(struct ifnet *, const struct ip *,
+   const struct igmp *);
 static int igmp_input_v2_query(struct ifnet *, const struct ip *,
const struct igmp *);
 static int igmp_input_v3_query(struct ifnet *, const struct ip *,
@@ -702,7 +703,8 @@ igi_delete_locked(const struct ifnet *if
  * VIMAGE: The curvnet pointer is derived from the input ifp.
  */
 static int
-igmp_input_v1_query(struct ifnet *ifp, const struct ip *ip)
+igmp_input_v1_query(struct ifnet *ifp, const struct ip *ip,
+const struct igmp *igmp)
 {
INIT_VNET_INET(ifp-if_vnet);
struct ifmultiaddr  *ifma;
@@ -710,20 +712,18 @@ igmp_input_v1_query(struct ifnet *ifp, c
struct in_multi *inm;
 
/*
-* IGMPv1 General Queries SHOULD always addressed to 224.0.0.1.
+* IGMPv1 Host Mmembership Queries SHOULD always be addressed to
+* 224.0.0.1. They are always treated as General Queries.
 * igmp_group is always ignored. Do not drop it as a userland
 * daemon may wish to see it.
+* XXX SMPng: unlocked increments in igmpstat assumed atomic.
 */
-   if (!in_allhosts(ip-ip_dst)) {
+   if (!in_allhosts(ip-ip_dst) || !in_nullhost(igmp-igmp_group)) {
IGMPSTAT_INC(igps_rcv_badqueries);
return (0);
}
-
IGMPSTAT_INC(igps_rcv_gen_queries);
 
-   /*
-* Switch to IGMPv1 host compatibility mode.
-*/
IN_MULTI_LOCK();
IGMP_LOCK();
 
@@ -736,6 +736,9 @@ igmp_input_v1_query(struct ifnet *ifp, c
goto out_locked;
}
 
+   /*
+* Switch to IGMPv1 host compatibility mode.
+*/
igmp_set_version(igi, IGMP_VERSION_1);
 
CTR2(KTR_IGMPV3, process v1 query on ifp %p(%s), ifp, ifp-if_xname);
@@ -793,12 +796,29 @@ igmp_input_v2_query(struct ifnet *ifp, c
struct ifmultiaddr  *ifma;
struct igmp_ifinfo  *igi;
struct in_multi *inm;
+   int  is_general_query;
uint16_t timer;
 
+   is_general_query = 0;
+
/*
-* Perform lazy allocation of IGMP link info if required,
-* and switch to IGMPv2 host compatibility mode.
+* Validate address fields upfront.
+* XXX SMPng: unlocked increments in igmpstat assumed atomic.
 */
+   if (in_nullhost(igmp-igmp_group)) {
+   /*
+* IGMPv2 General Query.
+* If this was not sent to the all-hosts group, ignore it.
+*/
+   if (!in_allhosts(ip-ip_dst))
+   return (0);
+   IGMPSTAT_INC(igps_rcv_gen_queries);
+   is_general_query = 1;
+   } else {
+   /* IGMPv2 Group-Specific Query. */
+   IGMPSTAT_INC(igps_rcv_group_queries);
+   }
+
IN_MULTI_LOCK();
IGMP_LOCK();
 
@@ -811,16 +831,37 @@ igmp_input_v2_query(struct ifnet *ifp, c
goto out_locked;
}
 
+   /*
+* Ignore v2 query if in v1 Compatibility Mode.
+*/
+   if (igi-igi_version == IGMP_VERSION_1)
+   goto out_locked;
+
igmp_set_version(igi, IGMP_VERSION_2);
 
timer = igmp-igmp_code * PR_FASTHZ / IGMP_TIMER_SCALE;
if (timer == 0)
timer = 1;
 
-   if (!in_nullhost(igmp-igmp_group)) {
+   if (is_general_query) {
/*
-* IGMPv2 Group-Specific Query.
-* If this is a group-specific IGMPv2 query, we need only
+* For each reporting group joined on this
+* interface, kick the report timer.
+*/
+   CTR2(KTR_IGMPV3, process v2 general query on ifp %p(%s),
+   

svn commit: r192904 - head/share/man/man4

2009-05-27 Thread Bruce M Simpson
Author: bms
Date: Wed May 27 16:30:33 2009
New Revision: 192904
URL: http://svn.freebsd.org/changeset/base/192904

Log:
  Add mld(4) man page.

Added:
  head/share/man/man4/mld.4   (contents, props changed)

Added: head/share/man/man4/mld.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/mld.4   Wed May 27 16:30:33 2009(r192904)
@@ -0,0 +1,107 @@
+.\
+.\ Copyright (c) 2009 Bruce Simpson.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\ 3. Neither the name of the project nor the names of its contributors
+.\may be used to endorse or promote products derived from this software
+.\without specific prior written permission.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd May 27, 2009
+.Dt MLD 4
+.Os
+.Sh NAME
+.Nm mld
+.Nd Multicast Listener Discovery Protocol
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.In netinet/in_systm.h
+.In netinet/ip6.h
+.In netinet/icmp6.h
+.In netinet6/mld6.h
+.Ft int
+.Fn socket AF_INET6 SOCK_RAW IPPROTO_ICMPV6
+.Sh DESCRIPTION
+.Tn MLD
+is a control plane protocol used by IPv6 hosts and routers to
+propagate multicast group membership information.
+Normally this protocol is not used directly, except by the kernel
+itself, in response to multicast membership requests by user
+applications.
+Multicast routing protocol daemons may open a raw socket to directly
+interact with
+.Nm 
+and receive membership reports.
+.Pp
+As of
+.Fx 8.0 ,
+MLD version 2 is implemented.
+This adds support for Source-Specific Multicast (SSM), whereby
+applications may communicate to upstream multicast routers that
+they are only interested in receiving multicast streams from
+particular sources.
+The retransmission of state-change reports adds some robustness
+to the protocol.
+.\
+.Sh SYSCTL VARIABLES
+.Pp
+.Bl -tag -width indent
+.\
+.It net.inet6.mld.stats
+This opaque read-only variable exposes the stack-wide MLDv2
+protocol statistics to
+.Xr netstat 1 .
+.\
+.It net.inet6.mld.ifinfo
+This opaque read-only variable exposes the per-link MLDv2 status to
+.Xr ifmcstat 8 .
+.\
+.It net.inet6.mld.gsrdelay
+This variable specifies the time threshold, in seconds, for processing
+Group-and-Source Specific Queries (GSR).
+As GSR query processing requires maintaining state on the host,
+it may cause memory to be allocated, and is therefore a potential
+attack point for Denial-of-Service (DoS).
+If more than one GSR query is received within this threshold,
+it will be dropped, to mitigate the potential for DoS.
+.\
+.It net.inet6.mld.v1enable
+If this variable is non-zero, then MLDv1 membership queries (and host
+reports) will be processed by this host, and backwards compatibility
+will be enabled until the v1 'Older Version Querier Present' timer expires.
+This sysctl is normally enabled by default.
+.\
+.El
+.Sh SEE ALSO
+.Xr ifmcstat 8 ,
+.Xr inet 4 ,
+.Xr multicast 4 ,
+.Xr netstat 1 ,
+.Xr sourcefilter 3
+.Sh HISTORY
+The
+.Nm
+manual page appeared in
+.Fx 8.0 .
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r192923 - in head: share/man/man4 sys/netinet6 usr.sbin/ifmcstat

2009-05-27 Thread Bruce M Simpson
Author: bms
Date: Wed May 27 18:57:13 2009
New Revision: 192923
URL: http://svn.freebsd.org/changeset/base/192923

Log:
  Merge final round of MLD changes from p4:
   ip6_input.c, in6.h:
   * Add netinet6-specific mbuf flag M_RTALERT_MLD, shadowing M_PROTO6.
* Always set this flag if HBH Router Alert option is present for MLD,
  even when not forwarding.
  
   icmp6.c:
   * In icmp6_input(), spell m-m_pkthdr.rcvif as ifp to be consistent.
   * Use scope ID for verifying input. Do not apply SSM filters here, no inpcb.
* Check for M_RTALERT_MLD when validating MLD traffic, as we can't see
  IPv6 hop options outside of ip6_input().
  
   in6_mcast.c:
   * Use KAME scope/zone ID in in6_multi.
 * Update net.inet6.ip6.mcast.filters implementation to use scope IDs
   for comparisons.
   * Fix scope ID treatment in multicast socket option processing.
 Scope IDs passed in from userland will be ignored as other less
 ambiguous APIs exist for specifying the link.
   * Tighten userland input checks in IPv6 SSM delta and full-state ops.
 * Source filter embedded scope IDs need to be revisited, for now
   just clear them and ignore them on input.
   * Adapt KAME behaviour of looking up the scope ID in the default zone
 for multicast leaves, when the interface is ambiguous.
  
   mld6.c:
   * Tighten origin checks on MLD traffic as per RFC3810 Section 6.2:
* ip6_src MAY be the unspecified address for MLDv1 reports.
* ip6_src MAY have link-local address scope for MLDv1 reports,
  MLDv1 queries, and MLDv2 queries.
* Perform address field validation *before* accepting queries.
   * Use KAME scope/zone ID in query/report processing.
 * Break const correctness for mld_v1_input_report(), mld_v1_input_query()
   as we temporarily modify the input mbuf chain.
 * Clear the scope ID before handoff to userland MLD daemon.
   * Fix MLDv1 old querier present timer processing.
 With the protocol defaults, hosts should revert to MLDv2 after 260s.
   * Add net.inet6.mld.v1enable sysctl, default to on.
  
   ifmcstat.c:
   * Use sysctl by default; -K requests kvm(3) if so compiled.
  
   mld.4:
   * Connect man page to build.
  
  Tested using PCS.

Modified:
  head/share/man/man4/Makefile
  head/share/man/man4/multicast.4
  head/sys/netinet6/icmp6.c
  head/sys/netinet6/in6.h
  head/sys/netinet6/in6_mcast.c
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/mld6.c
  head/usr.sbin/ifmcstat/ifmcstat.8
  head/usr.sbin/ifmcstat/ifmcstat.c

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileWed May 27 18:54:31 2009
(r192922)
+++ head/share/man/man4/MakefileWed May 27 18:57:13 2009
(r192923)
@@ -191,6 +191,7 @@ MAN=aac.4 \
meteor.4 \
mfi.4 \
miibus.4 \
+   mld.4 \
mlx.4 \
mly.4 \
mmc.4 \

Modified: head/share/man/man4/multicast.4
==
--- head/share/man/man4/multicast.4 Wed May 27 18:54:31 2009
(r192922)
+++ head/share/man/man4/multicast.4 Wed May 27 18:57:13 2009
(r192923)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 13, 2009
+.Dd May 27, 2009
 .Dt MULTICAST 4
 .Os
 .\
@@ -962,6 +962,7 @@ after the previous upcall.
 .Xr intro 4 ,
 .Xr ip 4 ,
 .Xr ip6 4 ,
+.Xr mld 4 ,
 .Xr pim 4
 .\
 .Sh HISTORY
@@ -1002,6 +1003,8 @@ monitoring were implemented by
 in collaboration with
 .An Chris Brown
 (NextHop).
+The IGMPv3 and MLDv2 multicast support was implemented by
+.An Bruce Simpson .
 .Pp
 This manual page was written by
 .An Pavlin Radoslavov

Modified: head/sys/netinet6/icmp6.c
==
--- head/sys/netinet6/icmp6.c   Wed May 27 18:54:31 2009(r192922)
+++ head/sys/netinet6/icmp6.c   Wed May 27 18:57:13 2009(r192923)
@@ -403,6 +403,7 @@ icmp6_input(struct mbuf **mp, int *offp,
INIT_VNET_INET6(curvnet);
INIT_VPROCG(TD_TO_VPROCG(curthread)); /* XXX V_hostname needs this */
struct mbuf *m = *mp, *n;
+   struct ifnet *ifp;
struct ip6_hdr *ip6, *nip6;
struct icmp6_hdr *icmp6, *nicmp6;
int off = *offp;
@@ -410,6 +411,8 @@ icmp6_input(struct mbuf **mp, int *offp,
int code, sum, noff;
char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
 
+   ifp = m-m_pkthdr.rcvif;
+
 #ifndef PULLDOWN_TEST
IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_hdr), IPPROTO_DONE);
/* m might change if M_LOOP.  So, call mtod after this */
@@ -431,10 +434,8 @@ icmp6_input(struct mbuf **mp, int *offp,
 * Note: SSM filters are not applied for ICMPv6 traffic.
 */
if (IN6_IS_ADDR_MULTICAST(ip6-ip6_dst)) {
-   struct ifnet *ifp;
-   struct in6_multi *inm;
+   struct in6_multi

svn commit: r192547 - head/sys/netinet6

2009-05-21 Thread Bruce M Simpson
Author: bms
Date: Thu May 21 17:01:38 2009
New Revision: 192547
URL: http://svn.freebsd.org/changeset/base/192547

Log:
  Pullup svn source to p4 top of tree:
   * Fix LOR in MLDv2 query input path.
   * Strip embedded KAME scope IDs for on-wire IPv6 address comparisons.

Modified:
  head/sys/netinet6/mld6.c

Modified: head/sys/netinet6/mld6.c
==
--- head/sys/netinet6/mld6.cThu May 21 16:48:06 2009(r192546)
+++ head/sys/netinet6/mld6.cThu May 21 17:01:38 2009(r192547)
@@ -629,8 +629,8 @@ mld_v1_input_query(struct ifnet *ifp, co
 #endif
 
IN6_MULTI_LOCK();
-   IF_ADDR_LOCK(ifp);
MLD_LOCK();
+   IF_ADDR_LOCK(ifp);
 
mli = MLD_IFINFO(ifp);
KASSERT(mli != NULL, (%s: no mld_ifinfo for ifp %p, __func__, ifp));
@@ -661,12 +661,12 @@ mld_v1_input_query(struct ifnet *ifp, co
/*
 * MLDv1 General Query.
 * If this was not sent to the all-nodes group, ignore it.
-*
-* XXX Do we need to check for a scope ID in the destination
-* address on input and strip it?
 */
-   if (IN6_ARE_ADDR_EQUAL(ip6-ip6_dst,
-   in6addr_linklocal_allnodes)) {
+   struct in6_addr dst;
+
+   dst = ip6-ip6_dst;
+   in6_clearscope(dst);
+   if (IN6_ARE_ADDR_EQUAL(dst, in6addr_linklocal_allnodes)) {
/*
 * For each reporting group joined on this
 * interface, kick the report timer.
@@ -685,8 +685,8 @@ mld_v1_input_query(struct ifnet *ifp, co
}
}
 
-   MLD_UNLOCK();
IF_ADDR_UNLOCK(ifp);
+   MLD_UNLOCK();
IN6_MULTI_UNLOCK();
 
return (0);
@@ -807,8 +807,8 @@ mld_v2_input_query(struct ifnet *ifp, co
return (EMSGSIZE);
 
IN6_MULTI_LOCK();
-   IF_ADDR_LOCK(ifp);
MLD_LOCK();
+   IF_ADDR_LOCK(ifp);
 
mli = MLD_IFINFO(ifp);
KASSERT(mli != NULL, (%s: no mld_ifinfo for ifp %p, __func__, ifp));
@@ -819,17 +819,25 @@ mld_v2_input_query(struct ifnet *ifp, co
mli-mli_qi = qqi;
mli-mli_qri = maxdelay;
 
-   CTR4(KTR_MLD, %s: qrv %d qi %d qri %d, __func__, qrv, qqi,
+   CTR4(KTR_MLD, %s: qrv %d qi %d maxdelay %d, __func__, qrv, qqi,
maxdelay);
 
if (IN6_IS_ADDR_UNSPECIFIED(mld-mld_addr)) {
/*
 * MLDv2 General Query.
+*
 * Schedule a current-state report on this ifp for
 * all groups, possibly containing source lists.
+*
+* Strip scope ID embedded by ip6_input(). We do not need
+* to do this for the MLD payload.
 */
-   if (!IN6_ARE_ADDR_EQUAL(in6addr_linklocal_allnodes,
-   ip6-ip6_dst) || nsrc  0) {
+   struct in6_addr dst;
+
+   dst = ip6-ip6_dst;
+   in6_clearscope(dst);
+   if (!IN6_ARE_ADDR_EQUAL(dst, in6addr_linklocal_allnodes) ||
+   nsrc  0) {
/*
 * General Queries SHOULD be directed to ff02::1.
 * A general query with a source list has undefined
@@ -885,8 +893,8 @@ mld_v2_input_query(struct ifnet *ifp, co
}
 
 out_locked:
-   MLD_UNLOCK();
IF_ADDR_UNLOCK(ifp);
+   MLD_UNLOCK();
IN6_MULTI_UNLOCK();
 
return (0);
@@ -1016,15 +1024,19 @@ mld_v1_input_report(struct ifnet *ifp, c
 {
struct in6_ifaddr   *ia;
struct in6_multi*inm;
+   struct in6_addr  src, dst;
 #ifdef KTR
char ip6tbuf[INET6_ADDRSTRLEN];
 #endif
 
if (ifp-if_flags  IFF_LOOPBACK)
return (0);
+   if (!IN6_IS_ADDR_MULTICAST(mld-mld_addr))
+   return (EINVAL);
 
-   if (!IN6_IS_ADDR_MULTICAST(mld-mld_addr) ||
-   !IN6_ARE_ADDR_EQUAL(mld-mld_addr, ip6-ip6_dst))
+   dst = ip6-ip6_dst;
+   in6_clearscope(dst);
+   if (!IN6_ARE_ADDR_EQUAL(mld-mld_addr, dst))
return (EINVAL);
 
/*
@@ -1032,16 +1044,23 @@ mld_v1_input_report(struct ifnet *ifp, c
 * leave requires knowing that we are the only member of a
 * group. Assume we used the link-local address if available,
 * otherwise look for ::.
+*
+* XXX Note that scope ID comparison is needed for the address
+* returned by in6ifa_ifpforlinklocal(), but SHOULD NOT be
+* performed for the on-wire address.
 */
ia = in6ifa_ifpforlinklocal(ifp, IN6_IFF_NOTREADY|IN6_IFF_ANYCAST);
+   src = ip6-ip6_src;
+   in6_clearscope(src);
if ((ia  IN6_ARE_ADDR_EQUAL(ip6-ip6_src, IA6_IN6(ia))) ||
-   (ia == NULL  

svn commit: r192562 - head/sys/netinet6

2009-05-21 Thread Bruce M Simpson
Author: bms
Date: Thu May 21 18:05:17 2009
New Revision: 192562
URL: http://svn.freebsd.org/changeset/base/192562

Log:
  Pullup from p4 tip:
   * Fix MLDv2 general query timer (fallout from automated refactoring).
   * Refactor MLDv1 timer.
  MLDv2 query processing is now working.

Modified:
  head/sys/netinet6/mld6.c

Modified: head/sys/netinet6/mld6.c
==
--- head/sys/netinet6/mld6.cThu May 21 17:56:00 2009(r192561)
+++ head/sys/netinet6/mld6.cThu May 21 18:05:17 2009(r192562)
@@ -855,8 +855,8 @@ mld_v2_input_query(struct ifnet *ifp, co
 * not schedule any other reports.
 * Otherwise, reset the interface timer.
 */
-   if (mli-mli_v1_timer == 0 || mli-mli_v2_timer = timer) {
-   mli-mli_v1_timer = MLD_RANDOM_DELAY(timer);
+   if (mli-mli_v2_timer == 0 || mli-mli_v2_timer = timer) {
+   mli-mli_v2_timer = MLD_RANDOM_DELAY(timer);
V_interface_timers_running6 = 1;
}
} else {
@@ -888,7 +888,7 @@ mld_v2_input_query(struct ifnet *ifp, co
 * Otherwise, prepare to respond to the
 * group-specific or group-and-source query.
 */
-   if (mli-mli_v1_timer == 0 || mli-mli_v2_timer = timer)
+   if (mli-mli_v2_timer == 0 || mli-mli_v2_timer = timer)
mld_v2_process_group_query(inm, mli, timer, m, off);
}
 
@@ -1498,6 +1498,7 @@ mld_v2_process_group_timers(struct mld_i
 static void
 mld_set_version(struct mld_ifinfo *mli, const int version)
 {
+   int old_version_timer;
 
MLD_LOCK_ASSERT();
 
@@ -1505,24 +1506,18 @@ mld_set_version(struct mld_ifinfo *mli, 
version, mli-mli_ifp, mli-mli_ifp-if_xname);
 
if (version == MLD_VERSION_1) {
-   int old_version_timer;
/*
 * Compute the Older Version Querier Present timer as per
 * Section 9.12.
 */
old_version_timer = mli-mli_rv * mli-mli_qi + mli-mli_qri;
old_version_timer *= PR_SLOWHZ;
-
-   if (version == MLD_VERSION_1) {
-   mli-mli_v1_timer = old_version_timer;
-   }
+   mli-mli_v1_timer = old_version_timer;
}
 
-   if (mli-mli_v1_timer  0) {
-   if (mli-mli_version != MLD_VERSION_1) {
-   mli-mli_version = MLD_VERSION_1;
-   mld_v2_cancel_link_timers(mli);
-   }
+   if (mli-mli_v1_timer  0  mli-mli_version != MLD_VERSION_1) {
+   mli-mli_version = MLD_VERSION_1;
+   mld_v2_cancel_link_timers(mli);
}
 }
 
@@ -1648,17 +1643,15 @@ mld_v1_process_querier_timers(struct mld
 
MLD_LOCK_ASSERT();
 
-   if (mli-mli_v1_timer == 0) {
+   if (mli-mli_v1_timer == 0  mli-mli_version != MLD_VERSION_2) {
/*
-* MLDv1 Querier Present timers expired; revert to MLDv2.
+* MLDv1 Querier Present timer expired; revert to MLDv2.
 */
-   if (mli-mli_version != MLD_VERSION_2) {
-   CTR5(KTR_MLD,
-   %s: transition from v%d - v%d on %p(%s),
-   __func__, mli-mli_version, MLD_VERSION_2,
-   mli-mli_ifp, mli-mli_ifp-if_xname);
-   mli-mli_version = MLD_VERSION_2;
-   }
+   CTR5(KTR_MLD,
+   %s: transition from v%d - v%d on %p(%s),
+   __func__, mli-mli_version, MLD_VERSION_2,
+   mli-mli_ifp, mli-mli_ifp-if_xname);
+   mli-mli_version = MLD_VERSION_2;
}
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r192251 - stable/7/lib/libc/net

2009-05-17 Thread Bruce M Simpson
Author: bms
Date: Sun May 17 15:42:41 2009
New Revision: 192251
URL: http://svn.freebsd.org/changeset/base/192251

Log:
  MFC rev 191654:
  Fix an obvious bug in getsourcefilter()'s use of struct __msfilterreq;
  the kernel will return in msfr_nsrcs the number of source filters
  in-mode for a given multicast group.
  However, the filters themselves were never copied out, as the libc
  function clobbers this field with zero, causing the kernel to assume
  the provided vector of struct sockaddr_storage has zero length.
  This bug would only affect users of SSM multicast, which is shimmed
  in 7.x.
  Picked up during mtest(8) refactoring.

Modified:
  stable/7/lib/libc/net/sourcefilter.c

Modified: stable/7/lib/libc/net/sourcefilter.c
==
--- stable/7/lib/libc/net/sourcefilter.cSun May 17 12:30:25 2009
(r192250)
+++ stable/7/lib/libc/net/sourcefilter.cSun May 17 15:42:41 2009
(r192251)
@@ -1,6 +1,6 @@
 /*-
- * Copyright (c) 2007 Bruce M. Simpson.
- * All rights reserved
+ * Copyright (c) 2007-2009 Bruce Simpson.
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -10,21 +10,18 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 4. Neither the name of Bruce M. Simpson nor the names of other
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY BRUCE M. SIMPSON AND AFFILIATES
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL BRUCE M. SIMPSON OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #include sys/cdefs.h
@@ -340,7 +337,7 @@ getsourcefilter(int s, uint32_t interfac
 {
struct __msfilterreq msfr;
sockunion_t *psu;
-   int  err, level, optlen, optname;
+   int  err, level, nsrcs, optlen, optname;
 
if (interface == 0 || group == NULL || numsrc == NULL ||
fmode == NULL) {
@@ -348,6 +345,7 @@ getsourcefilter(int s, uint32_t interfac
return (-1);
}
 
+   nsrcs = *numsrc;
*numsrc = 0;
*fmode = 0;
 
@@ -385,7 +383,7 @@ getsourcefilter(int s, uint32_t interfac
memset(msfr, 0, optlen);
msfr.msfr_ifindex = interface;
msfr.msfr_fmode = 0;
-   msfr.msfr_nsrcs = *numsrc;
+   msfr.msfr_nsrcs = nsrcs;
memcpy(msfr.msfr_group, psu-ss, psu-ss.ss_len);
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r191657 - head/sys/netinet

2009-04-29 Thread Bruce M Simpson
Author: bms
Date: Wed Apr 29 10:12:01 2009
New Revision: 191657
URL: http://svn.freebsd.org/changeset/base/191657

Log:
  Fix a problem whereby enqueued IGMPv3 filter list changes would be
  incorrectly output, if the RB-tree enumeration happened to reuse the
  same chain for a mode switch: that is, both ALLOW and BLOCK records
  were appended for the same group, in the same mbuf packet chain.
  
  This was introduced during an mbuf chain layout bug fix involving
  m_getptr(), which obviously cannot count from offset 0 on the
  second pass through the RB-tree when serializing the IGMPv3
  group records into the pending mbuf chain.
  
  Cut over to KTR_INET for IGMPv3 CTR usage.

Modified:
  head/sys/netinet/igmp.c

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Wed Apr 29 10:02:50 2009(r191656)
+++ head/sys/netinet/igmp.c Wed Apr 29 10:12:01 2009(r191657)
@@ -86,7 +86,7 @@ __FBSDID($FreeBSD$);
 #include security/mac/mac_framework.h
 
 #ifndef KTR_IGMPV3
-#define KTR_IGMPV3 KTR_SUBSYS
+#define KTR_IGMPV3 KTR_INET
 #endif
 
 static struct igmp_ifinfo *
@@ -2983,7 +2983,7 @@ igmp_v3_enqueue_filter_change(struct ifq
struct ip_msource   *ims, *nims;
struct mbuf *m, *m0, *md;
in_addr_tnaddr;
-   int  m0srcs, nbytes, off, rsrcs, schanged;
+   int  m0srcs, nbytes, npbytes, off, rsrcs, schanged;
int  nallow, nblock;
uint8_t  mode, now, then;
rectype_tcrt, drt, nrt;
@@ -3001,6 +3001,7 @@ igmp_v3_enqueue_filter_change(struct ifq
nrt = REC_NONE; /* record type for current node */
m0srcs = 0; /* # source which will fit in current mbuf chain */
nbytes = 0; /* # of bytes appended to group's state-change queue */
+   npbytes = 0;/* # of bytes appended this packet */
rsrcs = 0;  /* # sources encoded in current record */
schanged = 0;   /* # nodes encoded in overall filter change */
nallow = 0; /* # of source entries in ALLOW_NEW */
@@ -3047,6 +3048,7 @@ igmp_v3_enqueue_filter_change(struct ifq
m0srcs = (ifp-if_mtu - IGMP_LEADINGSPACE -
sizeof(struct igmp_grouprec)) /
sizeof(in_addr_t);
+   npbytes = 0;
CTR1(KTR_IGMPV3,
%s: allocated new packet, __func__);
}
@@ -3066,15 +3068,19 @@ igmp_v3_enqueue_filter_change(struct ifq
%s: m_append() failed, __func__);
return (-ENOMEM);
}
-   nbytes += sizeof(struct igmp_grouprec);
-   if (m == m0) {
-   md = m_last(m);
+   npbytes += sizeof(struct igmp_grouprec);
+   if (m != m0) {
+   /* new packet; offset in c hain */
+   md = m_getptr(m, npbytes -
+   sizeof(struct igmp_grouprec), off);
pig = (struct igmp_grouprec *)(mtod(md,
-   uint8_t *) + md-m_len - nbytes);
+   uint8_t *) + off);
} else {
-   md = m_getptr(m, 0, off);
+   /* current packet; offset from last append */
+   md = m_last(m);
pig = (struct igmp_grouprec *)(mtod(md,
-   uint8_t *) + off);
+   uint8_t *) + md-m_len -
+   sizeof(struct igmp_grouprec));
}
/*
 * Begin walking the tree for this record type
@@ -3133,7 +3139,7 @@ igmp_v3_enqueue_filter_change(struct ifq
 * pass, back out of allocations.
 */
if (rsrcs == 0) {
-   nbytes -= sizeof(struct igmp_grouprec);
+   npbytes -= sizeof(struct igmp_grouprec);
if (m != m0) {
CTR1(KTR_IGMPV3,
%s: m_free(m), __func__);
@@ -3146,7 +3152,7 @@ igmp_v3_enqueue_filter_change(struct ifq
}
continue;
}
-   nbytes += (rsrcs * sizeof(in_addr_t));
+   npbytes += (rsrcs * sizeof(in_addr_t));
if (crt == REC_ALLOW)
 

svn commit: r191660 - head/sys/netinet

2009-04-29 Thread Bruce M Simpson
Author: bms
Date: Wed Apr 29 10:17:08 2009
New Revision: 191660
URL: http://svn.freebsd.org/changeset/base/191660

Log:
  Use KTR_INET for MROUTING CTRs.

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cWed Apr 29 10:14:16 2009
(r191659)
+++ head/sys/netinet/ip_mroute.cWed Apr 29 10:17:08 2009
(r191660)
@@ -119,7 +119,7 @@ __FBSDID($FreeBSD$);
 #include security/mac/mac_framework.h
 
 #ifndef KTR_IPMF
-#define KTR_IPMF KTR_SUBSYS
+#define KTR_IPMF KTR_INET
 #endif
 
 #defineVIFI_INVALID((vifi_t) -1)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r191661 - head/sys/netinet

2009-04-29 Thread Bruce M Simpson
Author: bms
Date: Wed Apr 29 10:20:17 2009
New Revision: 191661
URL: http://svn.freebsd.org/changeset/base/191661

Log:
  Add MLDv2 prototypes and defines.

Modified:
  head/sys/netinet/icmp6.h

Modified: head/sys/netinet/icmp6.h
==
--- head/sys/netinet/icmp6.hWed Apr 29 10:17:08 2009(r191660)
+++ head/sys/netinet/icmp6.hWed Apr 29 10:20:17 2009(r191661)
@@ -125,6 +125,7 @@ struct icmp6_hdr {
 #define ICMP6_FQDN_REPLY   140 /* FQDN reply */
 #define ICMP6_NI_QUERY 139 /* node information request */
 #define ICMP6_NI_REPLY 140 /* node information reply */
+#define MLDV2_LISTENER_REPORT  143 /* RFC3810 listener report */
 
 /* The definitions below are experimental. TBA */
 #define MLD_MTRACE_RESP200 /* mtrace resp (to 
sender) */
@@ -194,6 +195,8 @@ struct mld_hdr {
 #define mld_cksum  mld_icmp6_hdr.icmp6_cksum
 #define mld_maxdelay   mld_icmp6_hdr.icmp6_data16[0]
 #define mld_reserved   mld_icmp6_hdr.icmp6_data16[1]
+#define mld_v2_reservedmld_icmp6_hdr.icmp6_data16[0]
+#define mld_v2_numrecs mld_icmp6_hdr.icmp6_data16[1]
 
 /*
  * Neighbor Discovery
@@ -644,6 +647,7 @@ voidicmp6_error(struct mbuf *, int, int
 void   icmp6_error2(struct mbuf *, int, int, int, struct ifnet *);
 inticmp6_input(struct mbuf **, int *, int);
 void   icmp6_fasttimo(void);
+void   icmp6_slowtimo(void);
 void   icmp6_reflect(struct mbuf *, size_t);
 void   icmp6_prepare(struct mbuf *);
 void   icmp6_redirect_input(struct mbuf *, int);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r191659 - head/sys/netinet

2009-04-29 Thread Bruce M Simpson
Author: bms
Date: Wed Apr 29 10:14:16 2009
New Revision: 191659
URL: http://svn.freebsd.org/changeset/base/191659

Log:
  Cut over to KTR_INET for CTR.
  For clarity, put pointer incremement/size decrement on own line
  when copying out in-mode source filters to userland.

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Wed Apr 29 10:13:22 2009(r191658)
+++ head/sys/netinet/in_mcast.c Wed Apr 29 10:14:16 2009(r191659)
@@ -65,7 +65,7 @@ __FBSDID($FreeBSD$);
 #include netinet/vinet.h
 
 #ifndef KTR_IGMPV3
-#define KTR_IGMPV3 KTR_SUBSYS
+#define KTR_IGMPV3 KTR_INET
 #endif
 
 #ifndef __SOCKUNION_DECLARED
@@ -1647,11 +1647,14 @@ inp_get_source_filters(struct inpcb *inp
lims-imsl_st[0] != imf-imf_st[0])
continue;
++ncsrcs;
-   if (tss != NULL  nsrcs--  0) {
-   psin = (struct sockaddr_in *)ptss++;
+   if (tss != NULL  nsrcs  0) {
+   psin = (struct sockaddr_in *)ptss;
psin-sin_family = AF_INET;
psin-sin_len = sizeof(struct sockaddr_in);
psin-sin_addr.s_addr = htonl(lims-ims_haddr);
+   psin-sin_port = 0;
+   ++ptss;
+   --nsrcs;
}
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r191654 - head/lib/libc/net

2009-04-29 Thread Bruce M Simpson
Author: bms
Date: Wed Apr 29 09:58:31 2009
New Revision: 191654
URL: http://svn.freebsd.org/changeset/base/191654

Log:
  Fix an obvious bug in getsourcefilter()'s use of struct __msfilterreq;
  the kernel will return in msfr_nsrcs the number of source filters
  in-mode for a given multicast group.
  However, the filters themselves were never copied out, as the libc
  function clobbers this field with zero, causing the kernel to assume
  the provided vector of struct sockaddr_storage has zero length.
  This bug would only affect users of SSM multicast, which is shimmed
  in 7.x.
  Picked up during mtest(8) refactoring.
  
  MFC after:1 day

Modified:
  head/lib/libc/net/sourcefilter.c

Modified: head/lib/libc/net/sourcefilter.c
==
--- head/lib/libc/net/sourcefilter.cWed Apr 29 09:54:33 2009
(r191653)
+++ head/lib/libc/net/sourcefilter.cWed Apr 29 09:58:31 2009
(r191654)
@@ -337,7 +337,7 @@ getsourcefilter(int s, uint32_t interfac
 {
struct __msfilterreq msfr;
sockunion_t *psu;
-   int  err, level, optlen, optname;
+   int  err, level, nsrcs, optlen, optname;
 
if (interface == 0 || group == NULL || numsrc == NULL ||
fmode == NULL) {
@@ -345,6 +345,7 @@ getsourcefilter(int s, uint32_t interfac
return (-1);
}
 
+   nsrcs = *numsrc;
*numsrc = 0;
*fmode = 0;
 
@@ -382,7 +383,7 @@ getsourcefilter(int s, uint32_t interfac
memset(msfr, 0, optlen);
msfr.msfr_ifindex = interface;
msfr.msfr_fmode = 0;
-   msfr.msfr_nsrcs = *numsrc;
+   msfr.msfr_nsrcs = nsrcs;
memcpy(msfr.msfr_group, psu-ss, psu-ss.ss_len);
 
/*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r191663 - head/sys/netipsec

2009-04-29 Thread Bruce M Simpson
Author: bms
Date: Wed Apr 29 11:15:58 2009
New Revision: 191663
URL: http://svn.freebsd.org/changeset/base/191663

Log:
  Stub out IN6_LOOKUP_MULTI() for GETSPI requests, for now.
  
  This has the effect that IPv6 multicast traffic won't trigger
  an SPI allocation when IPSEC is in use, however, this obviously
  needs to stomp on locks, and IN6_LOOKUP_MULTI() is about to go away.
  
  This definitely needs to be revisited before 8.x is branched as
  a release branch.

Modified:
  head/sys/netipsec/key.c

Modified: head/sys/netipsec/key.c
==
--- head/sys/netipsec/key.c Wed Apr 29 10:22:44 2009(r191662)
+++ head/sys/netipsec/key.c Wed Apr 29 11:15:58 2009(r191663)
@@ -3765,13 +3765,16 @@ key_ismyaddr6(sin6)
 {
INIT_VNET_INET6(curvnet);
struct in6_ifaddr *ia;
+#if 0
struct in6_multi *in6m;
+#endif
 
for (ia = V_in6_ifaddr; ia; ia = ia-ia_next) {
if (key_sockaddrcmp((struct sockaddr *)sin6,
(struct sockaddr *)ia-ia_addr, 0) == 0)
return 1;
 
+#if 0
/*
 * XXX Multicast
 * XXX why do we care about multlicast here while we don't care
@@ -3782,6 +3785,7 @@ key_ismyaddr6(sin6)
IN6_LOOKUP_MULTI(sin6-sin6_addr, ia-ia_ifp, in6m);
if (in6m)
return 1;
+#endif
}
 
/* loopback, just for safety */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r191665 - head/sys/netinet6

2009-04-29 Thread Bruce M Simpson
Author: bms
Date: Wed Apr 29 11:26:45 2009
New Revision: 191665
URL: http://svn.freebsd.org/changeset/base/191665

Log:
  Import IPv6 SSM module but do not connect it to the build.

Added:
  head/sys/netinet6/in6_mcast.c   (contents, props changed)

Added: head/sys/netinet6/in6_mcast.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/netinet6/in6_mcast.c   Wed Apr 29 11:26:45 2009
(r191665)
@@ -0,0 +1,2625 @@
+/*
+ * Copyright (c) 2009 Bruce Simpson.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *products derived from this software without specific prior written
+ *permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * IPv6 multicast socket, group, and socket option processing module.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include opt_inet6.h
+#include opt_route.h
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/kernel.h
+#include sys/malloc.h
+#include sys/mbuf.h
+#include sys/protosw.h
+#include sys/socket.h
+#include sys/socketvar.h
+#include sys/protosw.h
+#include sys/sysctl.h
+#include sys/priv.h
+#include sys/ktr.h
+#include sys/tree.h
+#include sys/vimage.h
+
+#include net/if.h
+#include net/if_dl.h
+#include net/route.h
+#include net/vnet.h
+
+#include netinet/in.h
+#include netinet/in_var.h
+#include netinet6/in6_var.h
+#include netinet/ip6.h
+#include netinet/icmp6.h
+#include netinet6/ip6_var.h
+#include netinet/in_pcb.h
+#include netinet/tcp_var.h
+#include netinet6/nd6.h
+#include netinet/vinet.h
+#include netinet6/vinet6.h
+#include netinet6/mld6_var.h
+
+#ifndef KTR_MLD
+#define KTR_MLD KTR_INET6
+#endif
+
+#ifndef __SOCKUNION_DECLARED
+union sockunion {
+   struct sockaddr_storage ss;
+   struct sockaddr sa;
+   struct sockaddr_dl  sdl;
+   struct sockaddr_in6 sin6;
+};
+typedef union sockunion sockunion_t;
+#define __SOCKUNION_DECLARED
+#endif /* __SOCKUNION_DECLARED */
+
+static MALLOC_DEFINE(M_IN6MFILTER, in6_mfilter,
+IPv6 multicast PCB-layer source filter);
+static MALLOC_DEFINE(M_IP6MADDR, in6_multi, IPv6 multicast group);
+static MALLOC_DEFINE(M_IP6MOPTS, ip6_moptions, IPv6 multicast options);
+static MALLOC_DEFINE(M_IP6MSOURCE, ip6_msource,
+IPv6 multicast MLD-layer source filter);
+
+RB_GENERATE(ip6_msource_tree, ip6_msource, im6s_link, ip6_msource_cmp);
+
+/*
+ * Locking:
+ * - Lock order is: Giant, INP_WLOCK, IN6_MULTI_LOCK, MLD_LOCK, IF_ADDR_LOCK.
+ * - The IF_ADDR_LOCK is implicitly taken by in6m_lookup() earlier, however
+ *   it can be taken by code in net/if.c also.
+ * - ip6_moptions and in6_mfilter are covered by the INP_WLOCK.
+ *
+ * struct in6_multi is covered by IN6_MULTI_LOCK. There isn't strictly
+ * any need for in6_multi itself to be virtualized -- it is bound to an ifp
+ * anyway no matter what happens.
+ */
+struct mtx in6_multi_mtx;
+MTX_SYSINIT(in6_multi_mtx, in6_multi_mtx, in6_multi_mtx, MTX_DEF);
+
+static voidim6f_commit(struct in6_mfilter *);
+static int im6f_get_source(struct in6_mfilter *imf,
+   const struct sockaddr_in6 *psin,
+   struct in6_msource **);
+static struct in6_msource *
+   im6f_graft(struct in6_mfilter *, const uint8_t,
+   const struct sockaddr_in6 *);
+static voidim6f_leave(struct in6_mfilter *);
+static int im6f_prune(struct in6_mfilter *, const struct sockaddr_in6 *);
+static voidim6f_purge(struct in6_mfilter *);
+static voidim6f_rollback(struct in6_mfilter *);
+static voidim6f_reap(struct in6_mfilter *);
+static int im6o_grow(struct 

svn commit: r191666 - head/sys/netinet6

2009-04-29 Thread Bruce M Simpson
Author: bms
Date: Wed Apr 29 11:31:23 2009
New Revision: 191666
URL: http://svn.freebsd.org/changeset/base/191666

Log:
  Add MLDv2 protocol header, but do not connect it to the build.

Added:
  head/sys/netinet6/mld6.h   (contents, props changed)

Added: head/sys/netinet6/mld6.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/netinet6/mld6.hWed Apr 29 11:31:23 2009(r191666)
@@ -0,0 +1,112 @@
+/*-
+ * Copyright (c) 2009 Bruce Simpson.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *products derived from this software without specific prior written
+ *permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _NETINET6_MLD6_H_
+#define _NETINET6_MLD6_H_
+
+/*
+ * Multicast Listener Discovery (MLD) definitions.
+ */
+
+/* Minimum length of any MLD protocol message. */
+#define MLD_MINLEN sizeof(struct icmp6_hdr)
+
+/*
+ * MLD v2 query format.
+ * See netinet/icmp6.h for struct mld_hdr
+ * (MLDv1 query and host report format).
+ */
+struct mldv2_query {
+   struct icmp6_hdrmld_icmp6_hdr;  /* ICMPv6 header */
+   struct in6_addr mld_addr;   /* address being queried */
+   uint8_t mld_misc;   /* reserved/suppress/robustness   */
+   uint8_t mld_qqi;/* querier's query interval   */
+   uint16_tmld_numsrc; /* number of sources  */
+   /* followed by 1..numsrc source addresses */
+} __packed;
+#define MLD_V2_QUERY_MINLENsizeof(struct mldv2_query)
+#define MLD_MRC_EXP(x) ((ntohs((x))  12)  0x0007)
+#define MLD_MRC_MANT(x)(ntohs((x))  0x0fff)
+#define MLD_QQIC_EXP(x)(((x)  4)  0x07)
+#define MLD_QQIC_MANT(x)   ((x)  0x0f)
+#define MLD_QRESV(x)   (((x)  4)  0x0f)
+#define MLD_SFLAG(x)   (((x)  3)  0x01)
+#define MLD_QRV(x) ((x)  0x07)
+
+/*
+ * MLDv2 host membership report header.
+ * mld_type: MLDV2_LISTENER_REPORT
+ */
+struct mldv2_report {
+   struct icmp6_hdrmld_icmp6_hdr;
+   /* followed by 1..numgrps records */
+} __packed;
+/* overlaid on struct icmp6_hdr. */
+#define mld_numrecsmld_icmp6_hdr.icmp6_data16[1]
+
+struct mldv2_record {
+   uint8_t mr_type;/* record type */
+   uint8_t mr_datalen; /* length of auxiliary data */
+   uint16_tmr_numsrc;  /* number of sources */
+   struct in6_addr mr_addr;/* address being reported */
+   /* followed by 1..numsrc source addresses */
+} __packed;
+#define MLD_V2_REPORT_MAXRECS  65535
+
+/*
+ * MLDv2 report modes.
+ */
+#define MLD_DO_NOTHING 0   /* don't send a record */
+#define MLD_MODE_IS_INCLUDE1   /* MODE_IN */
+#define MLD_MODE_IS_EXCLUDE2   /* MODE_EX */
+#define MLD_CHANGE_TO_INCLUDE_MODE 3   /* TO_IN */
+#define MLD_CHANGE_TO_EXCLUDE_MODE 4   /* TO_EX */
+#define MLD_ALLOW_NEW_SOURCES  5   /* ALLOW_NEW */
+#define MLD_BLOCK_OLD_SOURCES  6   /* BLOCK_OLD */
+
+/*
+ * MLDv2 query types.
+ */
+#define MLD_V2_GENERAL_QUERY   1
+#define MLD_V2_GROUP_QUERY 2
+#define MLD_V2_GROUP_SOURCE_QUERY  3
+
+/*
+ * Maximum report interval for MLDv1 host membership reports.
+ */
+#define MLD_V1_MAX_RI  10
+
+/*
+ * MLD_TIMER_SCALE denotes that the MLD code field specifies
+ * time in milliseconds.
+ */
+#define MLD_TIMER_SCALE1000
+

svn commit: r191348 - head/sys/netinet

2009-04-21 Thread Bruce M Simpson
Author: bms
Date: Tue Apr 21 09:43:51 2009
New Revision: 191348
URL: http://svn.freebsd.org/changeset/base/191348

Log:
  remove IFF_ASSERTGIANT

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Tue Apr 21 07:22:12 2009(r191347)
+++ head/sys/netinet/in_mcast.c Tue Apr 21 09:43:51 2009(r191348)
@@ -399,9 +399,6 @@ in_getmulti(struct ifnet *ifp, const str
struct in_multi *inm;
int error;
 
-#if defined(INVARIANTS)  defined(IFF_ASSERTGIANT)
-   IFF_ASSERTGIANT(ifp);
-#endif
IN_MULTI_LOCK_ASSERT();
 
ii = (struct in_ifinfo *)ifp-if_afdata[AF_INET];
@@ -511,11 +508,6 @@ inm_release_locked(struct in_multi *inm)
 {
struct ifmultiaddr *ifma;
 
-#if defined(INVARIANTS)  defined(IFF_ASSERTGIANT)
-   if (!inm_is_ifp_detached(inm))
-   IFF_ASSERTGIANT(ifp);
-#endif
-
IN_MULTI_LOCK_ASSERT();
 
CTR2(KTR_IGMPV3, %s: refcount is %d, __func__, inm-inm_refcount);
@@ -1220,11 +1212,6 @@ in_leavegroup_locked(struct in_multi *in
 
error = 0;
 
-#if defined(INVARIANTS)  defined(IFF_ASSERTGIANT)
-   if (!inm_is_ifp_detached(inm))
-   IFF_ASSERTGIANT(inm-inm_ifp);
-#endif
-
IN_MULTI_LOCK_ASSERT();
 
CTR5(KTR_IGMPV3, %s: leave inm %p, %s/%s, imf %p, __func__,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r191356 - in head: sys/netinet usr.bin/netstat

2009-04-21 Thread Bruce M Simpson
Author: bms
Date: Tue Apr 21 12:47:09 2009
New Revision: 191356
URL: http://svn.freebsd.org/changeset/base/191356

Log:
  Bracket struct mfc and struct rtdetq with #ifdef _KERNEL.
  Match the bracketing in netstat.
  Since the cleanup of MROUTING, ports have broken because they
  expect to include netinet/ip_mroute.h without including
  sys/queue.h. Fix breakage at source.
  
  The real fix, of course, is to fix the MROUTING APIs by blowing them
  away and replacing them with something else...

Modified:
  head/sys/netinet/ip_mroute.h
  head/usr.bin/netstat/mroute.c

Modified: head/sys/netinet/ip_mroute.h
==
--- head/sys/netinet/ip_mroute.hTue Apr 21 11:44:40 2009
(r191355)
+++ head/sys/netinet/ip_mroute.hTue Apr 21 12:47:09 2009
(r191356)
@@ -52,7 +52,6 @@
  * bandwidth metering and signaling.
  */
 
-
 /*
  * Multicast Routing set/getsockopt commands.
  */
@@ -85,6 +84,7 @@ typedef u_short vifi_t;   /* type of a vi
 #defineVIFM_COPY(mfrom, mto)   ((mto) = (mfrom))
 #defineVIFM_SAME(m1, m2)   ((m1) == (m2))
 
+struct mfc;
 
 /*
  * Argument structure for MRT_ADD_VIF.
@@ -265,6 +265,7 @@ struct vif {
 struct route   v_route;/* cached route */
 };
 
+#ifdef _KERNEL
 /*
  * The kernel's multicast forwarding cache entry structure
  */
@@ -285,6 +286,7 @@ struct mfc {
u_long  mfc_nstall; /* # of packets awaiting mfc */
TAILQ_HEAD(, rtdetq) mfc_stall; /* q of packets awaiting mfc */
 };
+#endif /* _KERNEL */
 
 /*
  * Struct used to communicate from kernel to multicast router
@@ -304,6 +306,7 @@ struct igmpmsg {
 struct in_addr  im_src, im_dst;
 };
 
+#ifdef _KERNEL
 /*
  * Argument structure used for pkt info. while upcall is made
  */
@@ -314,6 +317,7 @@ struct rtdetq {
 vifi_t xmt_vif;/* Saved copy of imo_multicast_vif  */
 };
 #define MAX_UPQ4   /* max. no of pkts in upcall Q */
+#endif /* _KERNEL */
 
 /*
  * Structure for measuring the bandwidth and sending an upcall if the

Modified: head/usr.bin/netstat/mroute.c
==
--- head/usr.bin/netstat/mroute.c   Tue Apr 21 11:44:40 2009
(r191355)
+++ head/usr.bin/netstat/mroute.c   Tue Apr 21 12:47:09 2009
(r191356)
@@ -59,7 +59,10 @@ __FBSDID($FreeBSD$);
 #include netinet/in.h
 #include netinet/igmp.h
 #include net/route.h
+
+#define _KERNEL 1
 #include netinet/ip_mroute.h
+#undef _KERNEL
 
 #include err.h
 #include stdint.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r191264 - head/sys/netinet

2009-04-19 Thread Bruce M Simpson
Author: bms
Date: Sun Apr 19 08:14:21 2009
New Revision: 191264
URL: http://svn.freebsd.org/changeset/base/191264

Log:
  Now that IFF_NEEDSGIANT has been removed from the network
  stack, catch up with this in IGMPv3 and remove dead code.
  This has the side-effect of not being back-portable to RELENG_7
  w/o further changes.

Modified:
  head/sys/netinet/igmp.c

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Sun Apr 19 07:18:08 2009(r191263)
+++ head/sys/netinet/igmp.c Sun Apr 19 08:14:21 2009(r191264)
@@ -161,8 +161,8 @@ static int  vnet_igmp_idetach(const void 
  *  * The permitted lock order is: IN_MULTI_LOCK, IGMP_LOCK, IF_ADDR_LOCK.
  *Any may be taken independently; if any are held at the same
  *time, the above lock order must be followed.
- *  * All output is delegated to the netisr to handle IFF_NEEDSGIANT.
- *Most of the time, direct dispatch will be fine.
+ *  * All output is delegated to the netisr.
+ *Now that Giant has been eliminated, the netisr may be inlined.
  *  * IN_MULTI_LOCK covers in_multi.
  *  * IGMP_LOCK covers igmp_ifinfo and any global variables in this file,
  *including the output queue.
@@ -190,19 +190,12 @@ static intvnet_igmp_idetach(const void 
  * So check for ifma_protospec being NULL before proceeding.
  */
 struct mtx  igmp_mtx;
-int mpsafe_igmp = 0;
-SYSCTL_INT(_debug, OID_AUTO, mpsafe_igmp, CTLFLAG_RDTUN, mpsafe_igmp, 0,
-Enable SMP-safe IGMPv3);
 
 struct mbuf*m_raopt;/* Router Alert option */
 MALLOC_DEFINE(M_IGMP, igmp, igmp state);
 
 /*
  * Global netisr output queue.
- * This is only used as a last resort if we cannot directly dispatch.
- * As IN_MULTI_LOCK is no longer in the bottom half of IP, we can do
- * this, providing mpsafe_igmp is set. If it is not, we take Giant,
- * and queueing is forced.
  */
 struct ifqueue  igmpoq;
 
@@ -656,32 +649,6 @@ igmp_ifdetach(struct ifnet *ifp)
 
IGMP_UNLOCK();
 
-#ifdef VIMAGE
-   /*
-* Plug the potential race which may occur when a VIMAGE
-* is detached and we are forced to queue pending IGMP output for
-* output netisr processing due to !mpsafe_igmp. In this case it
-* is possible that igmp_intr() is about to see mbuf chains with
-* invalid cached curvnet pointers.
-* This is a rare condition, so just blow them all away.
-* FUTURE: This may in fact not be needed, because IFF_NEEDSGIANT
-* is being removed in 8.x and the netisr may then be eliminated;
-* it is needed only if VIMAGE and IFF_NEEDSGIANT need to co-exist
-*/
-   if (!mpsafe_igmp) {
-   int drops;
-
-   IF_LOCK(igmpoq);
-   drops = igmpoq.ifq_len;
-   _IF_DRAIN(igmpoq);
-   IF_UNLOCK(igmpoq);
-   if (bootverbose  drops) {
-   printf(%s: dropped %d pending IGMP output packets\n,
-   __func__, drops);
-   }
-   }
-#endif /* VIMAGE */
-
CURVNET_RESTORE();
 }
 
@@ -1659,9 +1626,6 @@ igmp_fasttimo_vnet(void)
!V_state_change_timers_running)
return;
 
-   if (!mpsafe_igmp)
-   mtx_lock(Giant);
-
IN_MULTI_LOCK();
IGMP_LOCK();
 
@@ -1754,8 +1718,6 @@ igmp_fasttimo_vnet(void)
 out_locked:
IGMP_UNLOCK();
IN_MULTI_UNLOCK();
-   if (!mpsafe_igmp)
-   mtx_unlock(Giant);
 }
 
 /*
@@ -3580,20 +3542,13 @@ igmp_sysinit(void)
CTR1(KTR_IGMPV3, %s: initializing, __func__);
 
IGMP_LOCK_INIT();
-   TUNABLE_INT_FETCH(debug.mpsafeigmp, mpsafe_igmp);
 
mtx_init(igmpoq.ifq_mtx, igmpoq_mtx, NULL, MTX_DEF);
IFQ_SET_MAXLEN(igmpoq, IFQ_MAXLEN);
 
m_raopt = igmp_ra_alloc();
 
-#if __FreeBSD_version  80
-   netisr_register(NETISR_IGMP, igmp_intr, igmpoq,
-   mpsafe_igmp ? NETISR_MPSAFE : 0);
-#else
-   netisr_register(NETISR_IGMP, igmp_intr, igmpoq,
-   mpsafe_igmp ? 0 : NETISR_FORCEQUEUE);
-#endif
+   netisr_register(NETISR_IGMP, igmp_intr, igmpoq, 0);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190691 - head/sys/netinet

2009-04-04 Thread Bruce M Simpson
Author: bms
Date: Sat Apr  4 15:26:32 2009
New Revision: 190691
URL: http://svn.freebsd.org/changeset/base/190691

Log:
  Do not obliterate QQI with MAXRESP.
  
  Found during MLDv2 port.

Modified:
  head/sys/netinet/igmp.c

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Sat Apr  4 12:19:52 2009(r190690)
+++ head/sys/netinet/igmp.c Sat Apr  4 15:26:32 2009(r190691)
@@ -1004,8 +1004,8 @@ igmp_input_v3_query(struct ifnet *ifp, c
 
qqi = igmpv3-igmp_qqi;
if (qqi = 128) {
-   maxresp = IGMP_MANT(igmpv3-igmp_qqi) 
- (IGMP_EXP(igmpv3-igmp_qqi) + 3);
+   qqi = IGMP_MANT(igmpv3-igmp_qqi) 
+(IGMP_EXP(igmpv3-igmp_qqi) + 3);
}
 
timer = maxresp * PR_FASTHZ / IGMP_TIMER_SCALE;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190692 - head/sys/netinet

2009-04-04 Thread Bruce M Simpson
Author: bms
Date: Sat Apr  4 15:32:23 2009
New Revision: 190692
URL: http://svn.freebsd.org/changeset/base/190692

Log:
  Fix mbuf chain layout pessimization:
   in the case where a single mbuf is allocated due to
   m_getcl() returning NULL, we already call MH_ALIGN,
   so do not increment m-m_data in this case.
  
  Found during MLDv2 port.

Modified:
  head/sys/netinet/igmp.c

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Sat Apr  4 15:26:32 2009(r190691)
+++ head/sys/netinet/igmp.c Sat Apr  4 15:32:23 2009(r190692)
@@ -2784,8 +2784,11 @@ igmp_v3_enqueue_group_record(struct ifqu
m = NULL;
m0srcs = (ifp-if_mtu - IGMP_LEADINGSPACE -
sizeof(struct igmp_grouprec)) / sizeof(in_addr_t);
-   if (!is_state_change  !is_group_query)
+   if (!is_state_change  !is_group_query) {
m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
+   if (m)
+   m-m_data += IGMP_LEADINGSPACE;
+   }
if (m == NULL) {
m = m_gethdr(M_DONTWAIT, MT_DATA);
if (m)
@@ -2793,7 +2796,6 @@ igmp_v3_enqueue_group_record(struct ifqu
}
if (m == NULL)
return (-ENOMEM);
-   m-m_data += IGMP_LEADINGSPACE;
 
igmp_save_context(m, ifp);
 
@@ -2909,6 +2911,8 @@ igmp_v3_enqueue_group_record(struct ifqu
return (-ENOMEM);
}
m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
+   if (m)
+   m-m_data += IGMP_LEADINGSPACE;
if (m == NULL) {
m = m_gethdr(M_DONTWAIT, MT_DATA);
if (m)
@@ -2917,7 +2921,6 @@ igmp_v3_enqueue_group_record(struct ifqu
if (m == NULL)
return (-ENOMEM);
igmp_save_context(m, ifp);
-   m-m_data += IGMP_LEADINGSPACE;
md = m_getptr(m, 0, off);
pig = (struct igmp_grouprec *)(mtod(md, uint8_t *) + off);
CTR1(KTR_IGMPV3, %s: allocated next packet, __func__);
@@ -3063,6 +3066,8 @@ igmp_v3_enqueue_filter_change(struct ifq
%s: use previous packet, __func__);
} else {
m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
+   if (m)
+   m-m_data += IGMP_LEADINGSPACE;
if (m == NULL) {
m = m_gethdr(M_DONTWAIT, MT_DATA);
if (m)
@@ -3075,7 +3080,6 @@ igmp_v3_enqueue_filter_change(struct ifq
}
m-m_pkthdr.PH_vt.vt_nrecs = 0;
igmp_save_context(m, ifp);
-   m-m_data += IGMP_LEADINGSPACE;
m0srcs = (ifp-if_mtu - IGMP_LEADINGSPACE -
sizeof(struct igmp_grouprec)) /
sizeof(in_addr_t);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190354 - head/sys/netinet

2009-03-23 Thread Bruce M Simpson
Author: bms
Date: Tue Mar 24 01:22:12 2009
New Revision: 190354
URL: http://svn.freebsd.org/changeset/base/190354

Log:
  Don't call m_freem() after ip_output(), as it always consumes
  the mbuf chain provided to it.
  
  Found by: Pierre Guinoiseau

Modified:
  head/sys/netinet/igmp.c

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Tue Mar 24 01:18:35 2009(r190353)
+++ head/sys/netinet/igmp.c Tue Mar 24 01:22:12 2009(r190354)
@@ -3451,7 +3451,6 @@ igmp_intr(struct mbuf *m)
error = ip_output(m0, ipopts, NULL, 0, imo, NULL);
if (error) {
CTR3(KTR_IGMPV3, %s: ip_output(%p) = %d, __func__, m0, error);
-   m_freem(m0);
goto out;
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190148 - head/sys/netinet

2009-03-20 Thread Bruce M Simpson
Author: bms
Date: Fri Mar 20 13:13:50 2009
New Revision: 190148
URL: http://svn.freebsd.org/changeset/base/190148

Log:
  Fix brainos introduced during mechanical KTR change.
  
  Pointy hat to:bms

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cFri Mar 20 13:03:33 2009
(r190147)
+++ head/sys/netinet/ip_mroute.cFri Mar 20 13:13:50 2009
(r190148)
@@ -77,6 +77,7 @@ __FBSDID($FreeBSD$);
 
 #include sys/param.h
 #include sys/kernel.h
+#include sys/stddef.h
 #include sys/lock.h
 #include sys/ktr.h
 #include sys/malloc.h
@@ -930,7 +931,7 @@ add_vif(struct vifctl *vifcp)
 VIF_UNLOCK();
 
 CTR4(KTR_IPMF, %s: add vif %d laddr %s thresh %x, __func__,
-   (int)vifcp-vifc_vifi, inet_ntoa(vifcp-vifc_lcl_addr),
+   (int)vifcp-vifc_vifi, inet_ntoa(vifcp-vifc_lcl_addr),
(int)vifcp-vifc_threshold);
 
 return 0;
@@ -1060,7 +1061,7 @@ add_mfc(struct mfcctl2 *mfccp)
 /* If an entry already exists, just update the fields */
 if (rt) {
CTR4(KTR_IPMF, %s: update mfc orig %s group %lx parent %x,
-   __func__, inet_ntoa(mfccp-mfcc_origin),
+   __func__, inet_ntoa(mfccp-mfcc_origin),
(u_long)ntohl(mfccp-mfcc_mcastgrp.s_addr),
mfccp-mfcc_parent);
update_mfc_params(rt, mfccp);
@@ -1080,7 +1081,7 @@ add_mfc(struct mfcctl2 *mfccp)
!TAILQ_EMPTY(rt-mfc_stall)) {
CTR5(KTR_IPMF,
%s: add mfc orig %s group %lx parent %x qh %p,
-   __func__, inet_ntoa(mfccp-mfcc_origin),
+   __func__, inet_ntoa(mfccp-mfcc_origin),
(u_long)ntohl(mfccp-mfcc_mcastgrp.s_addr),
mfccp-mfcc_parent,
TAILQ_FIRST(rt-mfc_stall));
@@ -1225,7 +1226,7 @@ X_ip_mforward(struct ip *ip, struct ifne
 vifi_t vifi;
 
 CTR3(KTR_IPMF, ip_mforward: delete mfc orig %s group %lx ifp %p,
-   inet_ntoa(ip-ip_src), (u_long)ntohl(mcastgrp.s_addr), ifp);
+   inet_ntoa(ip-ip_src), (u_long)ntohl(ip-ip_dst.s_addr), ifp);
 
 if (ip-ip_hl  (sizeof(struct ip) + TUNNEL_LEN)  2 ||
((u_char *)(ip + 1))[1] != IPOPT_LSRR ) {
@@ -2563,7 +2564,7 @@ pim_input(struct mbuf *m, int off)
 if (datalen  PIM_MINLEN) {
pimstat.pims_rcv_tooshort++;
CTR3(KTR_IPMF, %s: short packet (%d) from %s,
-   __func__, datalen, inet_ntoa(ip-ip_src));
+   __func__, datalen, inet_ntoa(ip-ip_src));
m_freem(m);
return;
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190024 - head/usr.bin/netstat

2009-03-19 Thread Bruce M Simpson
Author: bms
Date: Thu Mar 19 10:23:26 2009
New Revision: 190024
URL: http://svn.freebsd.org/changeset/base/190024

Log:
  Fix size_t merge-o.

Modified:
  head/usr.bin/netstat/mroute.c

Modified: head/usr.bin/netstat/mroute.c
==
--- head/usr.bin/netstat/mroute.c   Thu Mar 19 08:36:08 2009
(r190023)
+++ head/usr.bin/netstat/mroute.c   Thu Mar 19 10:23:26 2009
(r190024)
@@ -293,7 +293,7 @@ mroutepr(u_long pmfchashtbl, u_long pmfc
len -= sizeof(*m);
}
if (len != 0)
-   warnx(print_mfc: %d trailing bytes, len);
+   warnx(print_mfc: %lu trailing bytes, (u_long)len);
 
free(mfctable);
} else {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190054 - head/sys/netinet

2009-03-19 Thread Bruce M Simpson
Author: bms
Date: Thu Mar 19 14:14:21 2009
New Revision: 190054
URL: http://svn.freebsd.org/changeset/base/190054

Log:
  Cleanup: Nuke debug.mrtdebug, and replace it with KTR.

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cThu Mar 19 14:13:18 2009
(r190053)
+++ head/sys/netinet/ip_mroute.cThu Mar 19 14:14:21 2009
(r190054)
@@ -59,7 +59,6 @@
  * domain attachment (if_afdata) so we can track consumers of that service.
  * TODO: Deprecate routing socket path for SIOCGETSGCNT and SIOCGETVIFCNT,
  * move it to socket options.
- * TODO: Rototile log_debug to use KTR.
  * TODO: Cleanup LSRR removal further.
  * TODO: Push RSVP stubs into raw_ip.c.
  * TODO: Use bitstring.h for vif set.
@@ -79,6 +78,7 @@ __FBSDID($FreeBSD$);
 #include sys/param.h
 #include sys/kernel.h
 #include sys/lock.h
+#include sys/ktr.h
 #include sys/malloc.h
 #include sys/mbuf.h
 #include sys/module.h
@@ -117,14 +117,9 @@ __FBSDID($FreeBSD$);
 
 #include security/mac/mac_framework.h
 
-#defineDEBUG_MFC   0x02
-#defineDEBUG_FORWARD   0x04
-#defineDEBUG_EXPIRE0x08
-#defineDEBUG_XMIT  0x10
-#defineDEBUG_PIM   0x20
-static u_int   mrtdebug;
-SYSCTL_INT(_debug, OID_AUTO, mrtdebug, CTLFLAG_RW, mrtdebug, 0,
-Enable/disable IPv4 multicast forwarding debugging flags);
+#ifndef KTR_IPMF
+#define KTR_IPMF KTR_SUBSYS
+#endif
 
 #defineVIFI_INVALID((vifi_t) -1)
 #defineM_HASCL(m)  ((m)-m_flags  M_EXT)
@@ -658,9 +653,8 @@ ip_mrouter_init(struct socket *so, int v
 {
 INIT_VNET_INET(curvnet);
 
-if (mrtdebug)
-   log(LOG_DEBUG, ip_mrouter_init: so_type = %d, pr_protocol = %d\n,
-   so-so_type, so-so_proto-pr_protocol);
+CTR3(KTR_IPMF, %s: so_type %d, pr_protocol %d, __func__,
+so-so_type, so-so_proto-pr_protocol);
 
 if (so-so_type != SOCK_RAW || so-so_proto-pr_protocol != IPPROTO_IGMP)
return EOPNOTSUPP;
@@ -694,8 +688,7 @@ ip_mrouter_init(struct socket *so, int v
 
 MROUTER_UNLOCK();
 
-if (mrtdebug)
-   log(LOG_DEBUG, ip_mrouter_init\n);
+CTR1(KTR_IPMF, %s: done, __func__);
 
 return 0;
 }
@@ -782,8 +775,7 @@ X_ip_mrouter_done(void)
 
 MROUTER_UNLOCK();
 
-if (mrtdebug)
-   log(LOG_DEBUG, ip_mrouter_done\n);
+CTR1(KTR_IPMF, %s: done, __func__);
 
 return 0;
 }
@@ -894,14 +886,12 @@ add_vif(struct vifctl *vifcp)
 }
 
 if ((vifcp-vifc_flags  VIFF_TUNNEL) != 0) {
-   log(LOG_ERR, tunnels are no longer supported\n);
+   CTR1(KTR_IPMF, %s: tunnels are no longer supported, __func__);
VIF_UNLOCK();
return EOPNOTSUPP;
 } else if (vifcp-vifc_flags  VIFF_REGISTER) {
ifp = multicast_register_if;
-   if (mrtdebug)
-   log(LOG_DEBUG, Adding a register vif, ifp: %p\n,
-   (void *)multicast_register_if);
+   CTR2(KTR_IPMF, %s: add register vif for ifp %p, __func__, ifp);
if (reg_vif_num == VIFI_INVALID) {
if_initname(multicast_register_if, register_vif, 0);
multicast_register_if.if_flags = IFF_LOOPBACK;
@@ -939,13 +929,9 @@ add_vif(struct vifctl *vifcp)
 
 VIF_UNLOCK();
 
-if (mrtdebug)
-   log(LOG_DEBUG, add_vif #%d, lcladdr %lx, %s %lx, thresh %x\n,
-   vifcp-vifc_vifi,
-   (u_long)ntohl(vifcp-vifc_lcl_addr.s_addr),
-   (vifcp-vifc_flags  VIFF_TUNNEL) ? rmtaddr : mask,
-   (u_long)ntohl(vifcp-vifc_rmt_addr.s_addr),
-   vifcp-vifc_threshold);
+CTR4(KTR_IPMF, %s: add vif %d laddr %s thresh %x, __func__,
+   (int)vifcp-vifc_vifi, inet_ntoa(vifcp-vifc_lcl_addr),
+   (int)vifcp-vifc_threshold);
 
 return 0;
 }
@@ -976,8 +962,7 @@ del_vif_locked(vifi_t vifi)
 
 bzero((caddr_t)vifp, sizeof (*vifp));
 
-if (mrtdebug)
-   log(LOG_DEBUG, del_vif %d, numvifs %d\n, vifi, numvifs);
+CTR2(KTR_IPMF, %s: delete vif %d, __func__, (int)vifi);
 
 /* Adjust numvifs down */
 for (vifi = numvifs; vifi  0; vifi--)
@@ -1074,12 +1059,10 @@ add_mfc(struct mfcctl2 *mfccp)
 
 /* If an entry already exists, just update the fields */
 if (rt) {
-   if (mrtdebug  DEBUG_MFC)
-   log(LOG_DEBUG,add_mfc update o %lx g %lx p %x\n,
-   (u_long)ntohl(mfccp-mfcc_origin.s_addr),
-   (u_long)ntohl(mfccp-mfcc_mcastgrp.s_addr),
-   mfccp-mfcc_parent);
-
+   CTR4(KTR_IPMF, %s: update mfc orig %s group %lx parent %x,
+   __func__, inet_ntoa(mfccp-mfcc_origin),
+   (u_long)ntohl(mfccp-mfcc_mcastgrp.s_addr),
+   mfccp-mfcc_parent);
update_mfc_params(rt, mfccp);
MFC_UNLOCK();
VIF_UNLOCK();
@@ -1095,22 +1078,14 @@ add_mfc(struct mfcctl2 *mfccp)
if (in_hosteq(rt-mfc_origin, mfccp-mfcc_origin) 

svn commit: r189969 - stable/7/sys/dev/ae

2009-03-18 Thread Bruce M Simpson
Author: bms
Date: Wed Mar 18 17:14:44 2009
New Revision: 189969
URL: http://svn.freebsd.org/changeset/base/189969

Log:
  MFC r183567:
   Merge Wake-on-Lan (WOL) support for the Attansic/Atheros L2.
   This was left out of the backport to RELENG_7 as the WOL
   infrastructure had not yet been backported to RELENG_7 when
   the ae(4) driver was merged.
  
  Tested OK on an ASUS EeePC 701 using ports/net/wol.
  
  Submitted by: yongari

Modified:
  stable/7/sys/dev/ae/if_ae.c

Modified: stable/7/sys/dev/ae/if_ae.c
==
--- stable/7/sys/dev/ae/if_ae.c Wed Mar 18 16:24:39 2009(r189968)
+++ stable/7/sys/dev/ae/if_ae.c Wed Mar 18 17:14:44 2009(r189969)
@@ -380,8 +380,10 @@ ae_attach(device_t dev)
ifp-if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
IFQ_SET_MAXLEN(ifp-if_snd, ifp-if_snd.ifq_drv_maxlen);
IFQ_SET_READY(ifp-if_snd);
-   if (pci_find_extcap(dev, PCIY_PMG, pmc) == 0)
+   if (pci_find_extcap(dev, PCIY_PMG, pmc) == 0) {
+   ifp-if_capabilities |= IFCAP_WOL_MAGIC;
sc-flags |= AE_FLAG_PMG;
+   }
ifp-if_capenable = ifp-if_capabilities;
 
/*
@@ -1329,6 +1331,7 @@ ae_pm_init(ae_softc_t *sc)
struct ifnet *ifp;
uint32_t val;
uint16_t pmstat;
+   struct mii_data *mii;
int pmc;
 
AE_LOCK_ASSERT(sc);
@@ -1340,7 +1343,40 @@ ae_pm_init(ae_softc_t *sc)
return;
}
 
-   ae_powersave_enable(sc);
+   /*
+* Configure WOL if enabled.
+*/
+   if ((ifp-if_capenable  IFCAP_WOL) != 0) {
+   mii = device_get_softc(sc-miibus);
+   mii_pollstat(mii);
+   if ((mii-mii_media_status  IFM_AVALID) != 0 
+   (mii-mii_media_status  IFM_ACTIVE) != 0) {
+   AE_WRITE_4(sc, AE_WOL_REG, AE_WOL_MAGIC | \
+   AE_WOL_MAGIC_PME);
+
+   /*
+* Configure MAC.
+*/
+   val = AE_MAC_RX_EN | AE_MAC_CLK_PHY | \
+   AE_MAC_TX_CRC_EN | AE_MAC_TX_AUTOPAD | \
+   ((AE_HALFBUF_DEFAULT  AE_HALFBUF_SHIFT)  \
+   AE_HALFBUF_MASK) | \
+   ((AE_MAC_PREAMBLE_DEFAULT  \
+   AE_MAC_PREAMBLE_SHIFT)  AE_MAC_PREAMBLE_MASK) | \
+   AE_MAC_BCAST_EN | AE_MAC_MCAST_EN;
+   if ((IFM_OPTIONS(mii-mii_media_active)  \
+   IFM_FDX) != 0)
+   val |= AE_MAC_FULL_DUPLEX;
+   AE_WRITE_4(sc, AE_MAC_REG, val);
+   
+   } else {/* No link. */
+   AE_WRITE_4(sc, AE_WOL_REG, AE_WOL_LNKCHG | \
+   AE_WOL_LNKCHG_PME);
+   AE_WRITE_4(sc, AE_MAC_REG, 0);
+   }
+   } else {
+   ae_powersave_enable(sc);
+   }
 
/*
 * PCIE hacks. Magic numbers.
@@ -1358,6 +1394,8 @@ ae_pm_init(ae_softc_t *sc)
pci_find_extcap(sc-dev, PCIY_PMG, pmc);
pmstat = pci_read_config(sc-dev, pmc + PCIR_POWER_STATUS, 2);
pmstat = ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE);
+   if ((ifp-if_capenable  IFCAP_WOL) != 0)
+   pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE;
pci_write_config(sc-dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190011 - head/sys/netinet

2009-03-18 Thread Bruce M Simpson
Author: bms
Date: Thu Mar 19 01:15:26 2009
New Revision: 190011
URL: http://svn.freebsd.org/changeset/base/190011

Log:
  Comment IGMP_PIM as being very historic, as in, don't use.

Modified:
  head/sys/netinet/igmp.h

Modified: head/sys/netinet/igmp.h
==
--- head/sys/netinet/igmp.h Thu Mar 19 01:07:21 2009(r190010)
+++ head/sys/netinet/igmp.h Thu Mar 19 01:15:26 2009(r190011)
@@ -108,7 +108,7 @@ struct igmp_report {
 #define IGMP_HOST_MEMBERSHIP_QUERY 0x11/* membership query */
 #define IGMP_v1_HOST_MEMBERSHIP_REPORT 0x12/* Ver. 1 membership report */
 #define IGMP_DVMRP 0x13/* DVMRP routing message*/
-#define IGMP_PIM   0x14/* PIM routing message */
+#define IGMP_PIM   0x14/* PIMv1 message (historic) */
 #define IGMP_v2_HOST_MEMBERSHIP_REPORT 0x16/* Ver. 2 membership report */
 #define IGMP_HOST_LEAVE_MESSAGE0x17/* Leave-group message  
   */
 #define IGMP_MTRACE_REPLY  0x1e/* mtrace(8) reply */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r190012 - in head: . sys/modules/ip6_mroute_mod sys/modules/ip_mroute_mod sys/netinet sys/netinet6 usr.bin/netstat

2009-03-18 Thread Bruce M Simpson
Author: bms
Date: Thu Mar 19 01:43:03 2009
New Revision: 190012
URL: http://svn.freebsd.org/changeset/base/190012

Log:
  Introduce a number of changes to the MROUTING code.
  This is purely a forwarding plane cleanup; no control plane
  code is involved.
  
  Summary:
   * Split IPv4 and IPv6 MROUTING support. The static compile-time
 kernel option remains the same, however, the modules may now
 be built for IPv4 and IPv6 separately as ip_mroute_mod and
 ip6_mroute_mod.
   * Clean up the IPv4 multicast forwarding code to use BSD queue
 and hash table constructs. Don't build our own timer abstractions
 when ratecheck() and timevalclear() etc will do.
   * Expose the multicast forwarding cache (MFC) and virtual interface
 table (VIF) as sysctls, to reduce netstat's dependence on libkvm
 for this information for running kernels.
 * bandwidth meters however still require libkvm.
   * Make the MFC hash table size a boot/load-time tunable ULONG,
 net.inet.ip.mfchashsize (defaults to 256).
   * Remove unused members from struct vif and struct mfc.
   * Kill RSVP support, as no current RSVP implementation uses it.
 These stubs could be moved to raw_ip.c.
   * Don't share locks or initialization between IPv4 and IPv6.
   * Don't use a static struct route_in6 in ip6_mroute.c.
 The v6 code is still using a cached struct route_in6, this is
 moved to mif6 for the time being.
   * More cleanup remains to be merged from ip_mroute.c to ip6_mroute.c.
  
  v4 path tested using ports/net/mcast-tools.
  v6 changes are mostly mechanical locking and *have not* been tested.
  As these changes partially break some kernel ABIs, they will not
  be MFCed. There is a lot more work to be done here.
  
  Reviewed by:  Pavlin Radoslavov

Added:
  head/sys/modules/ip6_mroute_mod/
  head/sys/modules/ip6_mroute_mod/Makefile   (contents, props changed)
Modified:
  head/UPDATING
  head/sys/modules/ip_mroute_mod/Makefile
  head/sys/netinet/ip_mroute.c
  head/sys/netinet/ip_mroute.h
  head/sys/netinet6/ip6_mroute.c
  head/sys/netinet6/ip6_mroute.h
  head/usr.bin/netstat/main.c
  head/usr.bin/netstat/mroute.c
  head/usr.bin/netstat/netstat.h

Modified: head/UPDATING
==
--- head/UPDATING   Thu Mar 19 01:15:26 2009(r190011)
+++ head/UPDATING   Thu Mar 19 01:43:03 2009(r190012)
@@ -22,6 +22,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
to maximize performance.  (To disable malloc debugging, run
ln -s aj /etc/malloc.conf.)
 
+20090319:
+   The multicast forwarding code has been cleaned up. netstat(1)
+   only relies on KVM now for printing bandwidth upcall meters.
+   The IPv4 and IPv6 modules are split into ip_mroute_mod and
+   ip6_mroute_mod respectively. The config(5) options for statically
+   compiling this code remain the same, i.e. 'options MROUTING'.
+
 20090315:
Support for the IFF_NEEDSGIANT network interface flag has been
removed, which means that non-MPSAFE network device drivers are no

Added: head/sys/modules/ip6_mroute_mod/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/ip6_mroute_mod/MakefileThu Mar 19 01:43:03 2009
(r190012)
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+.include bsd.own.mk
+
+.PATH: ${.CURDIR}/../../netinet6
+
+KMOD=  ip6_mroute
+
+SRCS=  ip6_mroute.c
+SRCS+= opt_inet6.h opt_mac.h opt_mrouting.h
+
+.if !defined(KERNBUILDDIR)
+opt_inet6.h:
+   echo #define INET6 1  ${.TARGET}
+opt_mrouting.h:
+   echo #define MROUTING 1  ${.TARGET}
+.endif
+
+.include bsd.kmod.mk

Modified: head/sys/modules/ip_mroute_mod/Makefile
==
--- head/sys/modules/ip_mroute_mod/Makefile Thu Mar 19 01:15:26 2009
(r190011)
+++ head/sys/modules/ip_mroute_mod/Makefile Thu Mar 19 01:43:03 2009
(r190012)
@@ -8,21 +8,12 @@ KMOD= ip_mroute
 
 SRCS=  ip_mroute.c
 SRCS+= opt_inet.h opt_mac.h opt_mrouting.h opt_route.h
-SRCS+= opt_inet6.h
-
-.if ${MK_INET6_SUPPORT} != no
-SRCS+= ip6_mroute.c
-.endif
 
 .if !defined(KERNBUILDDIR)
 opt_inet.h:
echo #define INET 1  ${.TARGET}
 opt_mrouting.h:
echo #define MROUTING 1  ${.TARGET}
-.if ${MK_INET6_SUPPORT} != no
-opt_inet6.h:
-   echo #define INET6 1  ${.TARGET}
-.endif
 .endif
 
 .include bsd.kmod.mk

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cThu Mar 19 01:15:26 2009
(r190011)
+++ head/sys/netinet/ip_mroute.cThu Mar 19 01:43:03 2009
(r190012)
@@ -53,11 +53,24 @@
  * bandwidth metering and signaling
  */
 
+/*
+ * TODO: Prefix functions with ipmf_.
+ * TODO: Maintain a refcount on if_allmulti() in ifnet or in the protocol

svn commit: r189931 - head/sys/netinet

2009-03-17 Thread Bruce M Simpson
Author: bms
Date: Tue Mar 17 14:41:54 2009
New Revision: 189931
URL: http://svn.freebsd.org/changeset/base/189931

Log:
  Deal with the case where ifma_protospec may be NULL, during
  any IPv4 multicast operations which reference it.
  
  There is a potential race because ifma_protospec is set to NULL
  when we discover the underlying ifnet has gone away. This write
  is not covered by the IF_ADDR_LOCK, and it's difficult to widen
  its scope without making it a recursive lock. It isn't clear why
  this manifests more quickly with 802.11 interfaces, but does not
  seem to manifest at all with wired interfaces.
  
  With this change, the 802.11 related panics reported by sam@
  and cokane@ should go away. It is not the right fix, that requires
  more thought before 8.0.
  
  Idea from:sam
  Tested by:cokane

Modified:
  head/sys/netinet/igmp.c
  head/sys/netinet/in.c
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Tue Mar 17 14:29:25 2009(r189930)
+++ head/sys/netinet/igmp.c Tue Mar 17 14:41:54 2009(r189931)
@@ -183,6 +183,11 @@ static int vnet_igmp_idetach(const void 
  * VIMAGE: Each in_multi corresponds to an ifp, and each ifp corresponds
  * to a vnet in ifp-if_vnet.
  *
+ * SMPng: XXX We may potentially race operations on ifma_protospec.
+ * The problem is that we currently lack a clean way of taking the
+ * IF_ADDR_LOCK() between the ifnet and in layers w/o recursing,
+ * as anything which modifies ifma needs to be covered by that lock.
+ * So check for ifma_protospec being NULL before proceeding.
  */
 struct mtx  igmp_mtx;
 int mpsafe_igmp = 0;
@@ -601,6 +606,7 @@ out:
  * is detached, but also before the link layer does its cleanup.
  *
  * SMPNG: igmp_ifdetach() needs to take IF_ADDR_LOCK().
+ * XXX This is also bitten by unlocked ifma_protospec access.
  *
  * VIMAGE: curvnet should have been set by caller, but let's not assume
  * that for now.
@@ -623,8 +629,13 @@ igmp_ifdetach(struct ifnet *ifp)
if (igi-igi_version == IGMP_VERSION_3) {
IF_ADDR_LOCK(ifp);
TAILQ_FOREACH(ifma, ifp-if_multiaddrs, ifma_link) {
-   if (ifma-ifma_addr-sa_family != AF_INET)
+   if (ifma-ifma_addr-sa_family != AF_INET ||
+   ifma-ifma_protospec == NULL)
continue;
+#if 0
+   KASSERT(ifma-ifma_protospec != NULL,
+   (%s: ifma_protospec is NULL, __func__));
+#endif
inm = (struct in_multi *)ifma-ifma_protospec;
if (inm-inm_state == IGMP_LEAVING_MEMBER) {
SLIST_INSERT_HEAD(igi-igi_relinmhead,
@@ -783,7 +794,8 @@ igmp_input_v1_query(struct ifnet *ifp, c
 */
IF_ADDR_LOCK(ifp);
TAILQ_FOREACH(ifma, ifp-if_multiaddrs, ifma_link) {
-   if (ifma-ifma_addr-sa_family != AF_INET)
+   if (ifma-ifma_addr-sa_family != AF_INET ||
+   ifma-ifma_protospec == NULL)
continue;
inm = (struct in_multi *)ifma-ifma_protospec;
if (inm-inm_timer != 0)
@@ -880,7 +892,8 @@ igmp_input_v2_query(struct ifnet *ifp, c
 
IF_ADDR_LOCK(ifp);
TAILQ_FOREACH(ifma, ifp-if_multiaddrs, ifma_link) {
-   if (ifma-ifma_addr-sa_family != AF_INET)
+   if (ifma-ifma_addr-sa_family != AF_INET ||
+   ifma-ifma_protospec == NULL)
continue;
inm = (struct in_multi *)ifma-ifma_protospec;
igmp_v2_update_group(inm, timer);
@@ -1701,7 +1714,8 @@ igmp_fasttimo_vnet(void)
IF_ADDR_LOCK(ifp);
TAILQ_FOREACH_SAFE(ifma, ifp-if_multiaddrs, ifma_link,
tifma) {
-   if (ifma-ifma_addr-sa_family != AF_INET)
+   if (ifma-ifma_addr-sa_family != AF_INET ||
+   ifma-ifma_protospec == NULL)
continue;
inm = (struct in_multi *)ifma-ifma_protospec;
switch (igi-igi_version) {
@@ -3311,7 +3325,8 @@ igmp_v3_dispatch_general_query(struct ig
 
IF_ADDR_LOCK(ifp);
TAILQ_FOREACH_SAFE(ifma, ifp-if_multiaddrs, ifma_link, tifma) {
-   if (ifma-ifma_addr-sa_family != AF_INET)
+   if (ifma-ifma_addr-sa_family != AF_INET ||
+   ifma-ifma_protospec == NULL)
continue;
 
inm = (struct in_multi *)ifma-ifma_protospec;

Modified: head/sys/netinet/in.c
==
--- 

svn commit: r189735 - head/sys/kern

2009-03-12 Thread Bruce M Simpson
Author: bms
Date: Thu Mar 12 10:34:16 2009
New Revision: 189735
URL: http://svn.freebsd.org/changeset/base/189735

Log:
  Make semaphore debugging output more useful.
  
  PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/127545
  MFC after:  5 days
  Submitted by:   Philip Semanchuk

Modified:
  head/sys/kern/uipc_sem.c

Modified: head/sys/kern/uipc_sem.c
==
--- head/sys/kern/uipc_sem.cThu Mar 12 09:56:15 2009(r189734)
+++ head/sys/kern/uipc_sem.cThu Mar 12 10:34:16 2009(r189735)
@@ -548,6 +548,8 @@ int
 ksem_open(struct thread *td, struct ksem_open_args *uap)
 {
 
+   DP(( ksem_open start, pid=%d\n, (int)td-td_proc-p_pid));
+
if ((uap-oflag  ~(O_CREAT | O_EXCL)) != 0)
return (EINVAL);
return (ksem_create(td, uap-name, uap-idp, uap-mode, uap-value,
@@ -708,12 +710,14 @@ kern_sem_wait(struct thread *td, semid_t
struct ksem *ks;
int error;
 
-   DP(( kern_sem_wait entered!\n));
+   DP(( kern_sem_wait entered! pid=%d\n, (int)td-td_proc-p_pid));
error = ksem_get(td, id, fp);
if (error)
return (error);
ks = fp-f_data;
mtx_lock(sem_lock);
+   DP(( kern_sem_wait critical section entered! pid=%d\n,
+   (int)td-td_proc-p_pid));
 #ifdef MAC
error = mac_posixsem_check_wait(td-td_ucred, fp-f_cred, ks);
if (error) {
@@ -750,11 +754,13 @@ kern_sem_wait(struct thread *td, semid_t
goto err;
}
ks-ks_value--;
+   DP((kern_sem_wait value post-decrement = %d\n, ks-ks_value));
error = 0;
 err:
mtx_unlock(sem_lock);
fdrop(fp, td);
-   DP(( kern_sem_wait leaving, error = %d\n, error));
+   DP(( kern_sem_wait leaving, pid=%d, error = %d\n,
+   (int)td-td_proc-p_pid, error));
return (error);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r189720 - in stable/7: . sys/amd64/conf sys/arm/conf sys/conf sys/dev/ath sys/dev/ath/ath_rate/amrr sys/dev/ath/ath_rate/onoe sys/dev/ath/ath_rate/sample sys/i386/conf sys/modules sys/m...

2009-03-11 Thread Bruce M Simpson
Author: bms
Date: Thu Mar 12 03:09:11 2009
New Revision: 189720
URL: http://svn.freebsd.org/changeset/base/189720

Log:
  Merge the open source Atheros HAL from HEAD to STABLE.
  
  This adds support for the AH_SUPPORT_AR5416 kernel
  configuration option, and removes the ath_rate*
  and ath_hal modules. Their kernel options are not
  however removed -- please see UPDATING.
  
  Tested on an IBM/Lenovo T43 and ASUS EeePC 701 in both
  STA and HostAP modes.
  
  Submitted by: sam

Deleted:
  stable/7/sys/modules/ath_hal/
  stable/7/sys/modules/ath_rate_amrr/
  stable/7/sys/modules/ath_rate_onoe/
  stable/7/sys/modules/ath_rate_sample/
Modified:
  stable/7/UPDATING
  stable/7/sys/amd64/conf/GENERIC
  stable/7/sys/amd64/conf/NOTES
  stable/7/sys/arm/conf/AVILA
  stable/7/sys/conf/files
  stable/7/sys/conf/files.amd64
  stable/7/sys/conf/files.arm
  stable/7/sys/conf/files.i386
  stable/7/sys/conf/files.pc98
  stable/7/sys/conf/files.powerpc
  stable/7/sys/conf/files.sparc64
  stable/7/sys/conf/kern.pre.mk
  stable/7/sys/conf/options
  stable/7/sys/dev/ath/ah_osdep.c
  stable/7/sys/dev/ath/ah_osdep.h
  stable/7/sys/dev/ath/ath_rate/amrr/amrr.c
  stable/7/sys/dev/ath/ath_rate/onoe/onoe.c
  stable/7/sys/dev/ath/ath_rate/sample/sample.c
  stable/7/sys/dev/ath/if_ath.c
  stable/7/sys/dev/ath/if_ath_pci.c
  stable/7/sys/dev/ath/if_athvar.h
  stable/7/sys/i386/conf/GENERIC
  stable/7/sys/i386/conf/NOTES
  stable/7/sys/modules/Makefile
  stable/7/sys/modules/ath/Makefile
  stable/7/sys/pc98/conf/GENERIC
  stable/7/sys/pc98/conf/NOTES
  stable/7/sys/sparc64/conf/GENERIC

Modified: stable/7/UPDATING
==
--- stable/7/UPDATING   Thu Mar 12 02:51:55 2009(r189719)
+++ stable/7/UPDATING   Thu Mar 12 03:09:11 2009(r189720)
@@ -8,6 +8,16 @@ Items affecting the ports and packages s
 /usr/ports/UPDATING.  Please read that file before running
 portupgrade.
 
+20090312:
+   The open-source Atheros HAL has been merged from HEAD
+   to STABLE.
+   The kernel compile-time option AH_SUPPORT_AR5416 has been
+   added to support certain newer Atheros parts, particularly
+   PCI-Express chipsets.
+   The following modules are no longer available, and should be
+   removed from MODULES_OVERRIDE and/or loader.conf:-
+ath_hal ath_rate_amrr ath_rate_onoe ath_rate_sample
+
 20090207:
ZFS users on amd64 machines with 4GB or more of RAM should
reevaluate their need for setting vm.kmem_size_max and

Modified: stable/7/sys/amd64/conf/GENERIC
==
--- stable/7/sys/amd64/conf/GENERIC Thu Mar 12 02:51:55 2009
(r189719)
+++ stable/7/sys/amd64/conf/GENERIC Thu Mar 12 03:09:11 2009
(r189720)
@@ -242,6 +242,7 @@ device  wlan_scan_sta   # 802.11 STA mode 
 device an  # Aironet 4500/4800 802.11 wireless NICs.
 device ath # Atheros pci/cardbus NIC's
 device ath_hal # Atheros HAL (Hardware Access Layer)
+optionsAH_SUPPORT_AR5416   # enable AR5416 tx/rx 
descriptors
 device ath_rate_sample # SampleRate tx rate control for ath
 device awi # BayStack 660 and others
 device ral # Ralink Technology RT2500 wireless NICs.

Modified: stable/7/sys/amd64/conf/NOTES
==
--- stable/7/sys/amd64/conf/NOTES   Thu Mar 12 02:51:55 2009
(r189719)
+++ stable/7/sys/amd64/conf/NOTES   Thu Mar 12 03:09:11 2009
(r189720)
@@ -331,6 +331,7 @@ device  wpi
 
 device ath
 device ath_hal # Atheros HAL (includes binary component)
+optionsAH_SUPPORT_AR5416   # enable AR5416 tx/rx 
descriptors
 #deviceath_rate_amrr   # AMRR rate control for ath driver
 #deviceath_rate_onoe   # Onoe rate control for ath driver
 device ath_rate_sample # SampleRate rate control for the ath driver

Modified: stable/7/sys/arm/conf/AVILA
==
--- stable/7/sys/arm/conf/AVILA Thu Mar 12 02:51:55 2009(r189719)
+++ stable/7/sys/arm/conf/AVILA Thu Mar 12 03:09:11 2009(r189720)
@@ -133,6 +133,7 @@ device  wlan# 802.11 support
 #devicewlan_tkip   # 802.11 TKIP support
 device ath # Atheros pci/cardbus NIC's
 device ath_hal # Atheros HAL (Hardware Access Layer)
+optionsAH_SUPPORT_AR5416   # enable AR5416 tx/rx 
descriptors
 device ath_rate_sample # SampleRate tx rate control for ath
 optionsATH_DEBUG
 

Modified: stable/7/sys/conf/files
==
--- stable/7/sys/conf/files 

svn commit: r189635 - head/sys/netinet

2009-03-10 Thread Bruce M Simpson
Author: bms
Date: Tue Mar 10 17:48:49 2009
New Revision: 189635
URL: http://svn.freebsd.org/changeset/base/189635

Log:
  Don't print inm_print() chatter when KTR_IGMPV3 is not enabled
  in the KTR_COMPILE mask.
  
  Found by: gnn

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Tue Mar 10 17:28:23 2009(r189634)
+++ head/sys/netinet/in_mcast.c Tue Mar 10 17:48:49 2009(r189635)
@@ -2851,6 +2851,9 @@ inm_print(const struct in_multi *inm)
 {
int t;
 
+   if ((KTR_COMPILE  KTR_IGMPV3) == 0)
+   return;
+
printf(%s: --- begin inm %p ---\n, __func__, inm);
printf(addr %s ifp %p(%s) ifma %p\n,
inet_ntoa(inm-inm_addr),
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r189584 - head/share/man/man4

2009-03-09 Thread Bruce M Simpson
Author: bms
Date: Mon Mar  9 16:51:40 2009
New Revision: 189584
URL: http://svn.freebsd.org/changeset/base/189584

Log:
  Add igmp(4) man page, do not connect to build yet.

Added:
  head/share/man/man4/igmp.4   (contents, props changed)

Added: head/share/man/man4/igmp.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/igmp.4  Mon Mar  9 16:51:40 2009(r189584)
@@ -0,0 +1,139 @@
+.\
+.\ Copyright (c) 2009 Bruce Simpson.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\ 3. Neither the name of the project nor the names of its contributors
+.\may be used to endorse or promote products derived from this software
+.\without specific prior written permission.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd March 9, 2009
+.Dt IGMP 4
+.Os
+.Sh NAME
+.Nm igmp
+.Nd Internet Group Management Protocol
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.In netinet/in_systm.h
+.In netinet/ip.h
+.In netinet/igmp.h
+.Ft int
+.Fn socket AF_INET SOCK_RAW IPPROTO_IGMP
+.Sh DESCRIPTION
+.Tn IGMP
+is a control plane protocol used by IPv4 hosts and routers to
+propagate multicast group membership information.
+Normally this protocol is not used directly, except by the kernel
+itself, in response to multicast membership requests by user
+applications.
+Routing protocols may open a raw socket to directly interact with
+.Nm .
+.Pp
+As of
+.Fx 8.0 ,
+IGMP version 3 is implemented.
+This adds support for Source-Specific Multicast (SSM), whereby
+applications may communicate to upstream multicast routers that
+they are only interested in receiving multicast streams from
+particular sources.
+.\
+.Sh SYSCTL VARIABLES
+.Pp
+.Bl -tag -width indent
+.\
+.It net.inet.igmp.stats
+This opaque read-only variable exposes the stack-wide IGMPv3
+protocol statistics to
+.Xr netstat 1 .
+.\
+.It net.inet.igmp.ifinfo
+This opaque read-only variable exposes the per-link IGMPv3 status to
+.Xr ifmcstat 8 .
+.\
+.It net.inet.igmp.gsrdelay
+This variable specifies the time threshold, in seconds, for processing
+Group-and-Source Specific Queries (GSR).
+As GSR query processing requires maintaining state on the host,
+it may cause memory to be allocated, and is therefore a potential
+attack point for Denial-of-Service (DoS).
+If more than one GSR query is received within this threshold,
+it will be dropped, to mitigate the potential for DoS.
+.\
+.It net.inet.igmp.default_version
+This variable controls the default version of IGMP to be used on all links.
+This sysctl is normally set to 3 by default.
+.\
+.It net.inet.igmp.legacysupp
+If this variable is non-zero, then IGMP v1 and v2 membership reports
+received on a link will be allowed to suppress the IGMP v3 state-change
+reports which would otherwise be issued by this host.
+This sysctl is normally enabled by default.
+.\
+.It net.inet.igmp.v2enable
+If this variable is non-zero, then IGMP v2 membership queries will be
+processed by this host, and backwards compatibility will be enabled
+until the v2 'Old Querier Present' timer expires.
+This sysctl is normally enabled by default.
+.\
+.It net.inet.igmp.v1enable
+If this variable is non-zero, then IGMP v1 membership queries will be
+processed by this host, and backwards compatibility will be enabled
+until the v1 'Old Querier Present' timer expires.
+This sysctl is normally enabled by default.
+.\
+.It net.inet.igmp.sendlocal
+If this variable is non-zero, then IGMP state-changes for groups in
+the 224.0.0.0/24 link-scope prefix will be issued.
+This behaviour is recommended if deploying
+.Fx
+in a network environment with layer 2 devices which snoop IGMP traffic
+to mitigate 

svn commit: r189592 - in head: . share/man/man4 sys/netinet sys/sys usr.bin/netstat usr.sbin/ifmcstat

2009-03-09 Thread Bruce M Simpson
Author: bms
Date: Mon Mar  9 17:53:05 2009
New Revision: 189592
URL: http://svn.freebsd.org/changeset/base/189592

Log:
  Merge IGMPv3 and Source-Specific Multicast (SSM) to the FreeBSD
  IPv4 stack.
  
  Diffs are minimized against p4.
  PCS has been used for some protocol verification, more widespread
  testing of recorded sources in Group-and-Source queries is needed.
  sizeof(struct igmpstat) has changed.
  
  __FreeBSD_version is bumped to 800070.

Modified:
  head/UPDATING
  head/share/man/man4/Makefile
  head/share/man/man4/ip.4
  head/share/man/man4/multicast.4
  head/sys/netinet/if_ether.c
  head/sys/netinet/igmp.c
  head/sys/netinet/igmp_var.h
  head/sys/netinet/in.c
  head/sys/netinet/in.h
  head/sys/netinet/in_mcast.c
  head/sys/netinet/in_proto.c
  head/sys/netinet/in_var.h
  head/sys/netinet/ip_input.c
  head/sys/netinet/ip_var.h
  head/sys/netinet/raw_ip.c
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet/vinet.h
  head/sys/sys/param.h
  head/sys/sys/vimage.h
  head/usr.bin/netstat/inet.c
  head/usr.sbin/ifmcstat/Makefile
  head/usr.sbin/ifmcstat/ifmcstat.8
  head/usr.sbin/ifmcstat/ifmcstat.c

Modified: head/UPDATING
==
--- head/UPDATING   Mon Mar  9 17:42:34 2009(r189591)
+++ head/UPDATING   Mon Mar  9 17:53:05 2009(r189592)
@@ -23,6 +23,45 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
ln -s aj /etc/malloc.conf.)
 
 20090309:
+   IGMPv3 and Source-Specific Multicast (SSM) have been merged
+   to the IPv4 stack. VIMAGE hooks are in but not yet used.
+
+   For kernel developers, the most important changes are that the
+   ip_output() and ip_input() paths no longer take the IN_MULTI_LOCK(),
+   and this lock has been downgraded to a non-recursive mutex.
+
+   Transport protocols (UDP, Raw IP) are now responsible for filtering
+   inbound multicast traffic according to group membership and source
+   filters. The imo_multicast_filter() KPI exists for this purpose.
+   Transports which do not use multicast (SCTP, TCP) already reject
+   multicast by default. Forwarding and receive performance may improve
+   as a mutex acquisition is no longer needed in the ip_input()
+   low-level input path.  in_addmulti() and in_delmulti() are shimmed
+   to new KPIs which exist to support SSM in-kernel.
+
+   For application developers, it is recommended that loopback of
+   multicast datagrams be disabled for best performance, as this
+   will still cause the lock to be taken for each looped-back
+   datagram transmission. The net.inet.ip.mcast.loop sysctl may
+   be tuned to 0 to disable loopback by default; it defaults to 1
+   to preserve the existing behaviour.
+
+   For systems administrators, to obtain best performance with
+   multicast reception and multiple groups, it is always recommended
+   that a card with a suitably precise hash filter is used. Hash
+   collisions will still result in the lock being taken within the
+   transport protocol input path to check group membership.
+
+   If deploying FreeBSD in an environment with IGMP snooping switches,
+   it is recommended that the net.inet.igmp.sendlocal sysctl remain
+   enabled; this forces 224.0.0.0/24 group membership to be announced
+   via IGMP.
+
+   The size of 'struct igmpstat' has changed; netstat needs to be
+   recompiled to reflect this.
+   Bump __FreeBSD_version to 800070.
+
+20090309:
libusb20.so.1 is now installed as libusb.so.1 and the ports system
updated to use it. This requires a buildworld/installworld in order to
update the library and dependencies (usbconfig, etc). Its advisable to

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileMon Mar  9 17:42:34 2009
(r189591)
+++ head/share/man/man4/MakefileMon Mar  9 17:53:05 2009
(r189592)
@@ -128,6 +128,7 @@ MAN=aac.4 \
if_bridge.4 \
ifmib.4 \
igb.4 \
+   igmp.4 \
iic.4 \
iicbb.4 \
iicbus.4 \

Modified: head/share/man/man4/ip.4
==
--- head/share/man/man4/ip.4Mon Mar  9 17:42:34 2009(r189591)
+++ head/share/man/man4/ip.4Mon Mar  9 17:53:05 2009(r189592)
@@ -32,7 +32,7 @@
 .\ @(#)ip.4   8.2 (Berkeley) 11/30/93
 .\ $FreeBSD$
 .\
-.Dd February 13, 2009
+.Dd March 9, 2009
 .Dt IP 4
 .Os
 .Sh NAME
@@ -466,13 +466,19 @@ setsockopt(s, IPPROTO_IP, IP_MULTICAST_L
 .Pp
 This option
 improves performance for applications that may have no more than one
-instance on a single host (such as a router daemon), by eliminating
+instance on a single host (such as a routing daemon), by eliminating
 the overhead of receiving their own transmissions.
 It 

svn commit: r189603 - head/sys/netinet

2009-03-09 Thread Bruce M Simpson
Author: bms
Date: Mon Mar  9 22:54:17 2009
New Revision: 189603
URL: http://svn.freebsd.org/changeset/base/189603

Log:
  Fix uninitialized use of ifp for ii.
  
  Found by: Peter Holm

Modified:
  head/sys/netinet/in.c

Modified: head/sys/netinet/in.c
==
--- head/sys/netinet/in.c   Mon Mar  9 22:43:00 2009(r189602)
+++ head/sys/netinet/in.c   Mon Mar  9 22:54:17 2009(r189603)
@@ -223,7 +223,6 @@ in_control(struct socket *so, u_long cmd
int iaIsFirst;
 
ia = NULL;
-   ii = ((struct in_ifinfo *)ifp-if_afdata[AF_INET]);
iaIsFirst = 0;
iaIsNew = 0;
allhosts_addr.s_addr = htonl(INADDR_ALLHOSTS_GROUP);
@@ -428,6 +427,7 @@ in_control(struct socket *so, u_long cmd
if (error != 0  iaIsNew)
break;
if (error == 0) {
+   ii = ((struct in_ifinfo *)ifp-if_afdata[AF_INET]);
if (iaIsFirst 
(ifp-if_flags  IFF_MULTICAST) != 0) {
error = in_joingroup(ifp, allhosts_addr,
@@ -478,6 +478,7 @@ in_control(struct socket *so, u_long cmd
(ifra-ifra_broadaddr.sin_family == AF_INET))
ia-ia_broadaddr = ifra-ifra_broadaddr;
if (error == 0) {
+   ii = ((struct in_ifinfo *)ifp-if_afdata[AF_INET]);
if (iaIsFirst 
(ifp-if_flags  IFF_MULTICAST) != 0) {
error = in_joingroup(ifp, allhosts_addr,
@@ -529,6 +530,7 @@ in_control(struct socket *so, u_long cmd
oia = NULL;
IFP_TO_IA(ifp, oia);
if (oia == NULL) {
+   ii = ((struct in_ifinfo *)ifp-if_afdata[AF_INET]);
IFF_LOCKGIANT(ifp);
IN_MULTI_LOCK();
if (ii-ii_allhosts) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r189335 - head/lib/libc/net

2009-03-03 Thread Bruce M Simpson
Author: bms
Date: Wed Mar  4 01:58:48 2009
New Revision: 189335
URL: http://svn.freebsd.org/changeset/base/189335

Log:
  Update copyright.

Modified:
  head/lib/libc/net/sourcefilter.c

Modified: head/lib/libc/net/sourcefilter.c
==
--- head/lib/libc/net/sourcefilter.cWed Mar  4 01:50:00 2009
(r189334)
+++ head/lib/libc/net/sourcefilter.cWed Mar  4 01:58:48 2009
(r189335)
@@ -1,6 +1,6 @@
 /*-
- * Copyright (c) 2007 Bruce M. Simpson.
- * All rights reserved
+ * Copyright (c) 2007-2009 Bruce Simpson.
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -10,21 +10,18 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 4. Neither the name of Bruce M. Simpson nor the names of other
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY BRUCE M. SIMPSON AND AFFILIATES
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL BRUCE M. SIMPSON OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #include sys/cdefs.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r189336 - head/lib/libc/net

2009-03-03 Thread Bruce M Simpson
Author: bms
Date: Wed Mar  4 01:59:14 2009
New Revision: 189336
URL: http://svn.freebsd.org/changeset/base/189336

Log:
  Considerably improve the wording of this man page.

Modified:
  head/lib/libc/net/sourcefilter.3

Modified: head/lib/libc/net/sourcefilter.3
==
--- head/lib/libc/net/sourcefilter.3Wed Mar  4 01:58:48 2009
(r189335)
+++ head/lib/libc/net/sourcefilter.3Wed Mar  4 01:59:14 2009
(r189336)
@@ -1,15 +1,19 @@
-.\ Copyright (c) 2007 Bruce M. Simpson. All rights reserved.
+.\ Copyright (c) 2007-2009 Bruce Simpson.
+.\ All rights reserved.
 .\
 .\ Redistribution and use in source and binary forms, with or without
 .\ modification, are permitted provided that the following conditions
 .\ are met:
 .\ 1. Redistributions of source code must retain the above copyright
 .\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
 .\
-.\ THIS SOFTWARE IS PROVIDED BY Bruce M. Simpson ``AS IS'' AND
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\ ARE DISCLAIMED.  IN NO EVENT SHALL Bruce M. Simpson BE LIABLE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 .\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 .\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 .\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -20,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd June 12, 2007
+.Dd February 13, 2009
 .Dt SOURCEFILTER 3
 .Os
 .Sh NAME
@@ -78,25 +82,34 @@ retrieve the multicast source address fi
 and a multicast
 .Fa group .
 .Pp
-The protocol-independent functions
-.Fn getsourcefilter
+The functions
+.Fn getipv4sourcefilter
 and
-.Fn setsourcefilter
-allow an application to join a multicast group on an interface by
-passing its index for the
-.Fa interface
-argument.
+.Fn getsourcefilter
+allow an application to discover the filter mode, and
+source filter entries,
+for an existing group membership.
+.Pp
+The kernel will always return the number of source filter
+entries on the socket for that group in
+.Fa *numsrc .
+If the
+.Fa *numsrc
+argument is non-zero, the kernel will attempt to return up to
+.Fa *numsrc
+filter entries in the array pointed to by
+.Fa slist .
 The
-argument.
-.Fa grouplen
-argument specifies the size of the structure pointed to by
-.Fa group .
+.Fa *numsrc
+argument may be set to 0, in which case the
+.Fa slist
+argument will be ignored.
 .Pp
 For the
 .Fn setipv4sourcefilter
 and
 .Fn setsourcefilter
-functions.
+functions,
 the
 .Fa fmode
 argument may be used to place the socket into inclusive or exclusive
@@ -110,14 +123,57 @@ The
 argument specifies the number of source entries in the
 .Fa slist
 array.
-A value of 0 will remove all source filters from the socket.
-The changes will be communicated to IGMPv3 and/or MLDv2 routers
+If the
+.Fa numsrc
+argument has a value of 0,
+all source filters will be removed from the socket.
+Removing all source filters from a membership which is in the
+.Dv MCAST_INCLUDE
+filter mode will cause the group to be left on that socket.
+.Pp
+The protocol-independent function
+.Fn setsourcefilter
+allows an application to join a multicast group on an interface
+which may not have an assigned protocol address,
+by passing its index for the
+.Fa interface
+argument.
+.Pp
+Any changes made by these functions
+will be communicated to IGMPv3 and/or MLDv2 routers
 on the local network as appropriate.
+If no IGMPv3 or MLDv2 routers are present, changes in the source filter
+lists made by these functions will not cause
+state changes to be transmitted, with the exception of any
+change which causes a group to be joined or left.
+The kernel will continue to maintain the source filter state
+regardless of the IGMP or MLD version in use on the link.
 .Sh IMPLEMENTATION NOTES
 The IPv4 specific versions of these functions are implemented in terms
 of the protocol-independent functions.
 Application writers are encouraged to use the protocol-independent functions
-for efficiency, and upwards compatibility with IPv6 networks.
+for efficiency, and forwards compatibility with IPv6 networks.
+.Pp
+For the protocol-independent functions
+.Fn getsourcefilter
+and
+.Fn setsourcefilter ,
+the argument
+.Fa grouplen
+argument specifies the size of the structure pointed to by
+.Fa group .
+This is required in order to differentiate between different
+address families.
+.Pp
+Currently
+.Fx
+does not support source address selection for the IPv4
+protocol family, therefore

svn commit: r189338 - head/share/man/man4

2009-03-03 Thread Bruce M Simpson
Author: bms
Date: Wed Mar  4 02:00:34 2009
New Revision: 189338
URL: http://svn.freebsd.org/changeset/base/189338

Log:
  Add cross-reference to sourcefilter(3).

Modified:
  head/share/man/man4/multicast.4

Modified: head/share/man/man4/multicast.4
==
--- head/share/man/man4/multicast.4 Wed Mar  4 02:00:14 2009
(r189337)
+++ head/share/man/man4/multicast.4 Wed Mar  4 02:00:34 2009
(r189338)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd March 18, 2007
+.Dd February 13, 2009
 .Dt MULTICAST 4
 .Os
 .\
@@ -954,6 +954,7 @@ after the previous upcall.
 .Xr recvmsg 2 ,
 .Xr setsockopt 2 ,
 .Xr socket 2 ,
+.Xr sourcefilter 3 ,
 .Xr icmp6 4 ,
 .Xr inet 4 ,
 .Xr inet6 4 ,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r189339 - head/usr.sbin/mtest

2009-03-03 Thread Bruce M Simpson
Author: bms
Date: Wed Mar  4 02:08:20 2009
New Revision: 189339
URL: http://svn.freebsd.org/changeset/base/189339

Log:
  Update mtest(8) manual page.

Modified:
  head/usr.sbin/mtest/mtest.8

Modified: head/usr.sbin/mtest/mtest.8
==
--- head/usr.sbin/mtest/mtest.8 Wed Mar  4 02:00:34 2009(r189338)
+++ head/usr.sbin/mtest/mtest.8 Wed Mar  4 02:08:20 2009(r189339)
@@ -1,8 +1,32 @@
 .\
+.\ Copyright (c) 2007-2009 Bruce Simpson.
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\ 3. The name of the author may not be used to endorse or promote products
+.\derived from this software without specific prior written permission
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\
 .\ $FreeBSD$
 .\
-.\ The following requests are required for all man pages.
-.Dd March 8, 2007
+.Dd March 3, 2009
 .Os
 .Dt MTEST 8
 .Sh NAME
@@ -17,19 +41,33 @@ utility
 is a small program for testing the multicast membership socket operations
 and ioctls.
 It accepts the following commands, interactively:
-.Bl -tag -width a ifname e.e.e.e.e.e -compact -offset indent
-.It Ic j Ar g.g.g.g Ar i.i.i.i
+.Bl -tag -width a ifname e.e.e.e e.e.e.e -compact -offset indent
+.It Ic j Ar g.g.g.g Ar i.i.i.i Op Ar s.s.s.s
 Join the IP group address
 .Ar g.g.g.g
 on the interface with address
 .Ar i.i.i.i .
+.Pp
+If an optional source
+.Ar s.s.s.s
+is specified, a source-specific join will be performed;
+if
+.Nm
+is already a member of the group, the source
+will be added to its filter list.
+.Pp
 .Ar i.i.i.i
-may be specified as 0.0.0.0 to use the default interface.
-.It Ic l Ar g.g.g.g Ar i.i.i.i
+may be specified as 0.0.0.0 to use the default interface,
+although this is legacy behaviour and is not recommended,
+as group memberships are keyed to each individual link.
+.It Ic l Ar g.g.g.g Ar i.i.i.i Op Ar s.s.s.s
 Leave the IP group address
 .Ar g.g.g.g
 on the interface with address
 .Ar i.i.i.i .
+If a source
+.Ar s.s.s.s
+is specified, only that source will be left.
 .It Ic a Ar ifname Ar e.e.e.e.e.e
 Join the Ethernet group address
 .Ar e.e.e.e.e.e
@@ -115,5 +153,6 @@ Quit the program.
 .Re
 .Sh AUTHORS
 .An -split
+.An Bruce Simpson
 .An Steve Deering
 .An Wilbert De Graaf
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r189340 - head/usr.sbin/mtest

2009-03-03 Thread Bruce M Simpson
Author: bms
Date: Wed Mar  4 02:09:12 2009
New Revision: 189340
URL: http://svn.freebsd.org/changeset/base/189340

Log:
  Add full SSM stack support to mtest(8) diagnostic tool.

Modified:
  head/usr.sbin/mtest/mtest.c

Modified: head/usr.sbin/mtest/mtest.c
==
--- head/usr.sbin/mtest/mtest.c Wed Mar  4 02:08:20 2009(r189339)
+++ head/usr.sbin/mtest/mtest.c Wed Mar  4 02:09:12 2009(r189340)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2007 Bruce M. Simpson.
+ * Copyright (c) 2007-2009 Bruce Simpson.
  * Copyright (c) 2000 Wilbert De Graaf.
  * All rights reserved.
  *
@@ -55,26 +55,21 @@ __FBSDID($FreeBSD$);
 #include err.h
 #include unistd.h
 
-/* The following two socket options are private to the kernel and libc. */
-
-#ifndef IP_SETMSFILTER
-#define IP_SETMSFILTER 74 /* atomically set filter list */
-#endif
-#ifndef IP_GETMSFILTER
-#define IP_GETMSFILTER 75 /* get filter list */
-#endif
-
 static voidprocess_file(char *, int);
 static voidprocess_cmd(char*, int, FILE *fp);
 static voidusage(void);
-#ifdef WITH_IGMPV3
-static int inaddr_cmp(const void *a, const void *b);
-#endif
 
 #defineMAX_ADDRS   20
 #defineSTR_SIZE20
 #defineLINE_LENGTH 80
 
+static int
+inaddr_cmp(const void *a, const void *b)
+{
+   return ((int)((const struct in_addr *)a)-s_addr -
+   ((const struct in_addr *)b)-s_addr);
+}
+
 int
 main(int argc, char **argv)
 {
@@ -145,17 +140,13 @@ process_cmd(char *cmd, int s, FILE *fp _
char str1[STR_SIZE];
char str2[STR_SIZE];
char str3[STR_SIZE];
-#ifdef WITH_IGMPV3
-   char filtbuf[IP_MSFILTER_SIZE(MAX_ADDRS)];
-#endif
+   struct in_addr   sources[MAX_ADDRS];
struct ifreq ifr;
struct ip_mreq   imr;
struct ip_mreq_sourceimrs;
-#ifdef WITH_IGMPV3
-   struct ip_msfilter  *imsfp;
-#endif
char*line;
-   int  n, opt, f, flags;
+   uint32_t fmode;
+   int  i, n, opt, f, flags;
 
line = cmd;
while (isblank(*++line))
@@ -181,20 +172,51 @@ process_cmd(char *cmd, int s, FILE *fp _
 
case 'j':
case 'l':
-   sscanf(line, %s %s, str1, str2);
-   if (((imr.imr_multiaddr.s_addr = inet_addr(str1)) ==
-   INADDR_NONE) ||
-   ((imr.imr_interface.s_addr = inet_addr(str2)) ==
-   INADDR_NONE)) {
-   printf(-1\n);
-   break;
+   str3[0] = '\0';
+   sscanf(line, %s %s %s, str1, str2, str3);
+   if ((imrs.imr_sourceaddr.s_addr = inet_addr(str3)) !=
+   INADDR_NONE) {
+   /*
+* inclusive mode join with source, possibly
+* on existing membership.
+*/
+   if (((imrs.imr_multiaddr.s_addr = inet_addr(str1)) ==
+   INADDR_NONE) ||
+   ((imrs.imr_interface.s_addr = inet_addr(str2)) ==
+   INADDR_NONE)) {
+   printf(-1\n);
+   break;
+   }
+   opt = (*cmd == 'j') ? IP_ADD_SOURCE_MEMBERSHIP :
+   IP_DROP_SOURCE_MEMBERSHIP;
+   if (setsockopt( s, IPPROTO_IP, opt, imrs,
+   sizeof(imrs)) != 0) {
+   warn(setsockopt %s, (*cmd == 'j') ?
+   IP_ADD_SOURCE_MEMBERSHIP :
+   IP_DROP_SOURCE_MEMBERSHIP);
+   } else {
+   printf(ok\n);
+   }
+   } else {
+   /* exclusive mode join w/o source. */
+   if (((imr.imr_multiaddr.s_addr = inet_addr(str1)) ==
+   INADDR_NONE) ||
+   ((imr.imr_interface.s_addr = inet_addr(str2)) ==
+   INADDR_NONE)) {
+   printf(-1\n);
+   break;
+   }
+   opt = (*cmd == 'j') ? IP_ADD_MEMBERSHIP :
+   IP_DROP_MEMBERSHIP;
+   if (setsockopt( s, IPPROTO_IP, opt, imr,
+   sizeof(imr)) != 0) {
+   warn(setsockopt %s, (*cmd == 'j') ?
+   IP_ADD_MEMBERSHIP :
+   IP_DROP_MEMBERSHIP);
+   } else {
+   printf(ok\n);
+   }
}
-   opt = (*cmd

svn commit: r189341 - head/usr.sbin/ifmcstat

2009-03-03 Thread Bruce M Simpson
Author: bms
Date: Wed Mar  4 02:12:29 2009
New Revision: 189341
URL: http://svn.freebsd.org/changeset/base/189341

Log:
  Add printb.c utility file, but do not yet connect it to the build.

Added:
  head/usr.sbin/ifmcstat/printb.c   (contents, props changed)

Added: head/usr.sbin/ifmcstat/printb.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/ifmcstat/printb.c Wed Mar  4 02:12:29 2009
(r189341)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include stdio.h
+
+/*
+ * Print a value a la the %b format of the kernel's printf
+ */
+void
+printb(const char *s, unsigned int v, const char *bits)
+{
+   int i, any = 0;
+   char c;
+
+   if (bits  *bits == 8)
+   printf(%s=%o, s, v);
+   else
+   printf(%s=%x, s, v);
+   bits++;
+   if (bits) {
+   putchar('');
+   while ((i = *bits++) != '\0') {
+   if (v  (1  (i-1))) {
+   if (any)
+   putchar(',');
+   any = 1;
+   for (; (c = *bits)  32; bits++)
+   putchar(c);
+   } else
+   for (; *bits  32; bits++)
+   ;
+   }
+   putchar('');
+   }
+}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


  1   2   >