net/bridge/br_arp_nd_proxy.c
Source file repositories/reference/linux-study-clean/net/bridge/br_arp_nd_proxy.c
File Facts
- System
- Linux kernel
- Corpus path
net/bridge/br_arp_nd_proxy.c- Extension
.c- Size
- 13443 bytes
- Lines
- 539
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/netdevice.hlinux/etherdevice.hlinux/neighbour.hnet/arp.hlinux/if_vlan.hlinux/inetdevice.hnet/addrconf.hnet/ip6_checksum.hbr_private.h
Detected Declarations
function Copyrightfunction list_for_each_entryfunction br_arp_sendfunction br_chk_addr_ipfunction br_is_local_ipfunction br_do_proxy_suppress_arpfunction br_nd_sendfunction br_chk_addr_ip6function br_is_local_ip6function br_do_suppress_ndfunction br_is_neigh_suppress_enabledfunction br_is_neigh_forward_grat_enabled
Annotated Snippet
if (READ_ONCE(p->flags) & (BR_NEIGH_SUPPRESS | BR_NEIGH_VLAN_SUPPRESS)) {
neigh_suppress = true;
break;
}
}
br_opt_toggle(br, BROPT_NEIGH_SUPPRESS_ENABLED, neigh_suppress);
}
#if IS_ENABLED(CONFIG_INET)
static void br_arp_send(struct net_bridge *br, struct net_bridge_port *p,
struct net_device *dev, __be32 dest_ip, __be32 src_ip,
const unsigned char *dest_hw,
const unsigned char *src_hw,
const unsigned char *target_hw,
__be16 vlan_proto, u16 vlan_tci)
{
struct net_bridge_vlan_group *vg;
struct sk_buff *skb;
u16 pvid;
netdev_dbg(dev, "arp send dev %s dst %pI4 dst_hw %pM src %pI4 src_hw %pM\n",
dev->name, &dest_ip, dest_hw, &src_ip, src_hw);
if (!vlan_tci) {
arp_send(ARPOP_REPLY, ETH_P_ARP, dest_ip, dev, src_ip,
dest_hw, src_hw, target_hw);
return;
}
skb = arp_create(ARPOP_REPLY, ETH_P_ARP, dest_ip, dev, src_ip,
dest_hw, src_hw, target_hw);
if (!skb)
return;
if (p)
vg = nbp_vlan_group_rcu(p);
else
vg = br_vlan_group_rcu(br);
pvid = br_get_pvid(vg);
if (pvid == (vlan_tci & VLAN_VID_MASK))
vlan_tci = 0;
if (vlan_tci)
__vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci);
if (p) {
arp_xmit(skb);
} else {
skb_reset_mac_header(skb);
__skb_pull(skb, skb_network_offset(skb));
skb->ip_summed = CHECKSUM_UNNECESSARY;
skb->pkt_type = PACKET_HOST;
netif_rx(skb);
}
}
static int br_chk_addr_ip(struct net_device *dev,
struct netdev_nested_priv *priv)
{
__be32 ip = *(__be32 *)priv->data;
struct in_device *in_dev;
__be32 addr = 0;
in_dev = __in_dev_get_rcu(dev);
if (in_dev)
addr = inet_confirm_addr(dev_net(dev), in_dev, 0, ip,
RT_SCOPE_HOST);
if (addr == ip)
return 1;
return 0;
}
static bool br_is_local_ip(struct net_device *dev, __be32 ip)
{
struct netdev_nested_priv priv = {
.data = (void *)&ip,
};
if (br_chk_addr_ip(dev, &priv))
return true;
/* check if ip is configured on upper dev */
if (netdev_walk_all_upper_dev_rcu(dev, br_chk_addr_ip, &priv))
return true;
return false;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/neighbour.h`, `net/arp.h`, `linux/if_vlan.h`, `linux/inetdevice.h`, `net/addrconf.h`.
- Detected declarations: `function Copyright`, `function list_for_each_entry`, `function br_arp_send`, `function br_chk_addr_ip`, `function br_is_local_ip`, `function br_do_proxy_suppress_arp`, `function br_nd_send`, `function br_chk_addr_ip6`, `function br_is_local_ip6`, `function br_do_suppress_nd`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.