Now if the promiscuous mode is on, packet will be delivered locally, irrespective of the destination.Or else message is received using br_multicast_rcv (not in the above snippet) If the destination address is a multicast address, and if the multicast is disabled, the packet is dropped.An entry in forwarding database is updated for the source of the frame.int br_dev_ioctl ( struct net_device * dev, struct ifreq * rq, int cmd ) Īs you can see in above snippet of br_handle_frame_finish, If you look at the handler code, it handles ioctl command to add/delete interfaces. This also includes setting up the bridge specific ioctl handler. br_ioctl_deviceless_stub |- br_add_bridge |- alloc_netdev |- alloc_netdev_mqs // creates the network device |- br_dev_setup // sets br_dev_ioctl handlerĪlloc_netdev also initializes the new netdevice using the br_dev_setup. This method calls alloc_netdev, which is a macro that eventually calls alloc_netdev_mqs.
Note that there is no device at this point to handle the ioctl command, so the ioctl command is handled by a stub method: br_ioctl_deviceless_stub, which in turn calls br_add_bridge.
:~ $ sudo strace brctl addbr br1Įxecve ( "/sbin/brctl",, ) = 0 Creating a bridgeīridge can be created using ioctl command SIOCBRADDBR as can be seen by brctl utility provided by bridge-utils. In this article, we only talk about ioctl.
PORT FORWARD NETWORK UTILITIES BUNDLE MAC
MAC learning database: used to keep track of the host locations in the LAN.įor each unicast mac address, bridge maintains a mac learning database to decide which ports to forward based on MAC addresses, and if it can’t find an entry for a given mac address, it will broadcast the frame to all ports except the one where it received the frame from.A forwarding plane: used to process incoming input frames from the ports, forward them to the network port by making a forwarding decision based on the MAC learning database.A control plane: used to run Spanning Tree Protocol (STP) that calculates minimum spanning tree, preventing loops from crashing the network.