Handling Ingress Traffic
We saw in Chapter 10 how ingress traffic
is processed by netif_receive_skb. In particular, we
saw how the function calls handle_bridge (defined in
net/core/dev.c) before passing each ingress frame
to the upper-layer protocol handler.
When the kernel does not have support for bridging, handle_bridge is defined as a NULL pointer and netif_receive_skb hands ingress frames to other protocol handlers. When the
kernel does support bridging, and a frame is received on a bridge port, handle_bridge processes the frame with br_handle_frame_hook. The latter pointer is initialized to
br_handle_bridge when the bridging module is
initialized.
#if defined(CONFIG_BRIDGE) || defined (CONFIG_BRIDGE_MODULE)
...
static _ _inline_ _ int handle_bridge(struct sk_buff **pskb,
struct packet_type **pt_prev, int *ret)
{
struct net_bridge_port *port;
if ((*pskb)->pkt_type == PACKET_LOOPBACK ||
(port = rcu_dereference((*pskb)->dev->br_port)) == NULL)
return 0;
if (*pt_prev) {
*ret = deliver_skb(*pskb, *pt_prev);
*pt_prev = NULL;
}
return br_handle_frame_hook(port, pskb);
}
#else
#define handle_bridge(skb, pt_prev, ret) (0)
#endifIn the following subsections, we will see how handle_bridge processes ingress frames, distinguishing between data frames and
STP BPDUs (Figure 16-11, circle a). For
data frames, the function also distinguishes between unicast frames and multicast or
broadcast frames (Figure 16-11, circle
b).
Data Frames Versus BPDUs
On a Linux system with support for bridging, not ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access