Bug 19603

Summary: 20 ethernet interfaces not compatible with option BRIDGE
Product: Base System Reporter: dgilbert <dgilbert>
Component: kernAssignee: Luigi Rizzo <luigi>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description dgilbert 2000-06-30 14:40:01 UTC
With 20 dc interfaces in my machine and "option BRIDGE" in the kernel,
I was crashing whenever I typed ifconfig -a... and about once a day
otherwise.  This was stack smashing for some reason

Fix: I'm not 100% happy with this fix.  The bdg_stats structure is used in:

SYSCTL_STRUCT(_net_link_ether, PF_BDG, bdgstats,
        CTLFLAG_RD, &bdg_stats , bdg_stats, "bridge statistics");

and I'm not sure how to handle that.  The most eggregarious error, 
however, is that BDG_MAX_PORTS was defined and the status structure
was still defined with a constant 16 entries (not only that, but
absolutely no bounds checking was done, *ever*).

It would seem smart that this should be dynamic.  I thought about
that... and I just completely don't know what SYSCTL_STRUCT does ...

But even if I did, it would only be half the job to allocate things
here --- you really need to think about what happens when devices
come or leave (leaving is fine, I suppose).  Besides cardbus, we
have hotswap PCI to worry about :).
How-To-Repeat: 
option BRIDGE in a kernel and 20 interfaces (it would appear any
type of ethernet interface will do) in the kernel.

(I'm guessing that bridging doesn't work with vlans?  sigh.
 would be nice).
Comment 1 Sheldon Hearn 2000-06-30 14:48:34 UTC
On Fri, 30 Jun 2000 09:39:14 -0400, dgilbert@velocet.ca wrote:

> With 20 dc interfaces in my machine and "option BRIDGE" in the kernel,
> I was crashing whenever I typed ifconfig -a... and about once a day
> otherwise.  This was stack smashing for some reason

I think that this is Luigi's domain, but I don't want to assign the PR
to him when I'm not sure.

Luigi, wanna take this one? :-)

Ciao,
Sheldon.
Comment 2 Luigi Rizzo 2000-06-30 15:00:32 UTC
> 
> 
> On Fri, 30 Jun 2000 09:39:14 -0400, dgilbert@velocet.ca wrote:
> 
> > With 20 dc interfaces in my machine and "option BRIDGE" in the kernel,
> > I was crashing whenever I typed ifconfig -a... and about once a day
> > otherwise.  This was stack smashing for some reason
> 
> I think that this is Luigi's domain, but I don't want to assign the PR
> to him when I'm not sure.
> 
> Luigi, wanna take this one? :-)

i don't think this is related to bridging, there are no bridging
hooks in ifconfig. To confirm this i would remove
the "option BRIDGE" from the kernel and check if ifconfig -a
still kills the system.

A quick look at the ifconfig code seems to suggest that it could
be the sysctl interface ?

	cheers
	luigi
-----------------------------------+-------------------------------------
  Luigi RIZZO, luigi@iet.unipi.it  . Dip. di Ing. dell'Informazione
  http://www.iet.unipi.it/~luigi/  . Universita` di Pisa
  TEL/FAX: +39-050-568.533/522     . via Diotisalvi 2, 56126 PISA (Italy)
  Mobile   +39-347-0373137
-----------------------------------+-------------------------------------
Comment 3 dgilbert 2000-06-30 15:01:36 UTC
>>>>> "Luigi" == Luigi Rizzo <luigi@info.iet.unipi.it> writes:

Luigi> i don't think this is related to bridging, there are no
Luigi> bridging hooks in ifconfig. To confirm this i would remove the
Luigi> "option BRIDGE" from the kernel and check if ifconfig -a still
Luigi> kills the system.

Luigi> A quick look at the ifconfig code seems to suggest that it
Luigi> could be the sysctl interface ?

already verified six ways from sunday.  "option BRIDGE" in the kernel
makes it crash when ifconfig -a runs.

I have a box you can log into and test (with a serial console, even).

But... I've been working on this for three days.  I'm positive.

Dave.

-- 
============================================================================
|David Gilbert, Velocet Communications.       | Two things can only be     |
|Mail:       dgilbert@velocet.net             |  equal if and only if they |
|http://www.velocet.net/~dgilbert             |   are precisely opposite.  |
=========================================================GLO================
Comment 4 Luigi Rizzo 2000-06-30 15:04:37 UTC
> already verified six ways from sunday.  "option BRIDGE" in the kernel
> makes it crash when ifconfig -a runs.

and i saw your email about struct bdg_stats being too small... sorry!

	cheers
	luigi
-----------------------------------+-------------------------------------
  Luigi RIZZO, luigi@iet.unipi.it  . Dip. di Ing. dell'Informazione
  http://www.iet.unipi.it/~luigi/  . Universita` di Pisa
  TEL/FAX: +39-050-568.533/522     . via Diotisalvi 2, 56126 PISA (Italy)
  Mobile   +39-347-0373137
-----------------------------------+-------------------------------------
Comment 5 Sheldon Hearn freebsd_committer freebsd_triage 2000-06-30 15:05:23 UTC
Responsible Changed
From-To: freebsd-bugs->luigi

Luigi is, after all, the right person for the job. :-)
Comment 6 Luigi Rizzo freebsd_committer freebsd_triage 2002-02-18 00:27:13 UTC
State Changed
From-To: open->closed

Fixed by a recent comment by upping the number of supported 
interfaces to 128, and making sure at runtime that the 
limit is not exceeded when creating new interfaces (pccards 
vlan and the like).