Srinivas Aji [Thu, 29 Nov 2007 20:34:32 +0000 (02:04 +0530)]
Use new RSTP library.
This is a somewhat big commit which replaces the use of RSTPLIB in the
RSTP daemon by the new RSTP library. This makes the daemon much more
compliant with the 802.1D-2004 standard. The control program, rstpctl,
has been modified so its output closer to the output of brctl showstp.
Srinivas Aji [Thu, 29 Nov 2007 19:58:09 +0000 (01:28 +0530)]
Add in new RSTP implementation to replace RSTPLIB.
We have a new implementation of RSTP, which is meant to implement the
Spanning Tree Protocol in IEEE 802.1D-2004. This implementation is
written as a library consisting of one .c file and one .h file.
It is written from scratch directly from the 802.1D-2004 document.
This commit adds the files rstp.h and rstp.c to the directory, in
preparation for modifying other code to use this instead of rstplib.
Srinivas Aji [Thu, 29 Nov 2007 17:38:12 +0000 (23:08 +0530)]
Removed portion of brmon.c which received BPDUs through netlink.
At one time, BPDUs were being received through netlink using a kernel
patch. We now receive and send BPDUs through PF_PACKET sockets, so this
code is not needed anymore.
Srinivas Aji [Mon, 28 May 2007 18:39:43 +0000 (00:09 +0530)]
Put in Ethernet and LLC headers ourselves while sending BPDUs
Take BPDU contents from RSTPLIB but create the Ethernet and LLC
headers ourselves. The packet send interface has been modified to
take an iovec array so we can pass the headers and data to it without
making copies into another flat buffer.
RSTPLIB then doesn't even need to know the port MAC addresses if we
add an interface to configure the bridge address.
Srinivas Aji [Mon, 28 May 2007 18:30:40 +0000 (00:00 +0530)]
Track and cache bridge and port MAC addresses.
Check for MAC address change when we get notifications.
If we get a port notification and find that the port MAC address
changed, we check if the bridge MAC address changed as well.
This will be useful for modifying RSTPLIB to allow setting bridge
address instead of trying to replicate the kernel bridge address
computation.
Srinivas Aji [Mon, 28 May 2007 18:14:43 +0000 (23:44 +0530)]
Change notification processing to account for kernel changes
We now always get NEWLINK and DELLINK notifications for bridge port
additions and deletions. And DELLINK is only for port deletions.
So we can always remove a bridge port on a DELLINK notification,
and not make uncertain checks in fear of missing this.
Aji, Srinivas [Thu, 10 May 2007 23:37:26 +0000 (16:37 -0700)]
RSTP testing - PATCH: BPDU length calculation
The bpdu_len sent to STP_OUT_tx_bpdu() excludes the ethernet and
and LLC headers, though the bpdu pointer points to the start of the
ethernet header. Given the types in rstplib/stp_bpdu.h, we need to
be sending a packet with (base, len) given by
(bpdu, bpdu_len + sizeof(MAC_HEADER_T) + sizeof(ETH_HEADER_T))
MAC_HEADER_T is dest and source ethernet addresses and ETH_HEADER_T
is the 802.2 part.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Aji, Srinivas [Thu, 10 May 2007 23:35:41 +0000 (16:35 -0700)]
RSTP testing - PATCH: source MAC address of BPDU
BPDU's were being sent out with an all zero source ethernet
address. These packets don't make it far in the receive path on
another bridge since bridge_handle_frame() checks for valid source
ethernet address and drops them if that isn't the case.
I needed to undo a change I made in rstplib/transmit.c, where I was
not setting source MAC address because the LLC layer was doing it.
TODO: We get notified when a port MAC address changes, so we should
cache it. Right now it uses SIOCGIFHWADDR each time (for each BPDU
sent) using a cached name, which is not good.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>