net/batman-adv/hard-interface.c
Source file repositories/reference/linux-study-clean/net/batman-adv/hard-interface.c
File Facts
- System
- Linux kernel
- Corpus path
net/batman-adv/hard-interface.c- Extension
.c- Size
- 32975 bytes
- Lines
- 1194
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
hard-interface.hmain.hlinux/bug.hlinux/byteorder/generic.hlinux/compiler.hlinux/container_of.hlinux/errno.hlinux/gfp.hlinux/if.hlinux/if_arp.hlinux/if_ether.hlinux/kref.hlinux/limits.hlinux/list.hlinux/minmax.hlinux/mutex.hlinux/netdevice.hlinux/notifier.hlinux/printk.hlinux/rculist.hlinux/rhashtable-types.hlinux/rhashtable.hlinux/rtnetlink.hlinux/slab.hlinux/spinlock.hnet/net_namespace.hnet/rtnetlink.huapi/linux/batadv_packet.hbat_v.hbridge_loop_avoidance.hdistributed-arp-table.hgateway_client.h
Detected Declarations
function batadv_hardif_releasefunction batadv_hardif_get_by_netdevfunction batadv_getlink_netfunction batadv_mutual_parentsfunction batadv_is_on_batman_ifacefunction batadv_is_valid_ifacefunction __batadv_get_real_netdevfunction batadv_get_real_netdevfunction batadv_is_wext_netdevfunction batadv_is_cfg80211_netdevfunction batadv_wifi_flags_evaluatefunction batadv_netdev_get_wifi_flagsfunction batadv_hardif_get_wifi_flagsfunction batadv_is_wifi_hardiffunction batadv_hardif_no_broadcastfunction batadv_compare_ethfunction batadv_hardif_get_activefunction batadv_primary_if_update_addrfunction batadv_primary_if_selectfunction batadv_hardif_is_iface_upfunction batadv_check_known_mac_addrfunction netdev_for_each_lower_privatefunction batadv_hardif_recalc_extra_skbroomfunction batadv_hardif_min_mtufunction batadv_update_min_mtufunction batadv_hardif_activate_interfacefunction batadv_hardif_deactivate_interfacefunction batadv_hardif_enable_interfacefunction batadv_hardif_cntfunction batadv_hardif_disable_interfacefunction batadv_hardif_add_interfacefunction batadv_hardif_remove_interfacefunction batadv_hard_if_event_meshiffunction batadv_wifi_net_device_insertfunction batadv_wifi_net_device_removefunction batadv_wifi_net_device_updatefunction batadv_wifi_net_device_unregisterfunction batadv_wifi_net_device_eventfunction batadv_hard_if_eventfunction batadv_wifi_net_devices_initfunction batadv_wifi_net_devices_deinit
Annotated Snippet
batadv_compare_eth(hardif_neigh->orig, orig_neigh)) {
ret = BATADV_HARDIF_BCAST_DUPFWD;
}
out:
rcu_read_unlock();
return ret;
}
static struct batadv_hard_iface *
batadv_hardif_get_active(struct net_device *mesh_iface)
{
struct batadv_hard_iface *hard_iface;
struct list_head *iter;
rcu_read_lock();
netdev_for_each_lower_private_rcu(mesh_iface, hard_iface, iter) {
if (hard_iface->if_status == BATADV_IF_ACTIVE &&
kref_get_unless_zero(&hard_iface->refcount))
goto out;
}
hard_iface = NULL;
out:
rcu_read_unlock();
return hard_iface;
}
static void batadv_primary_if_update_addr(struct batadv_priv *bat_priv,
struct batadv_hard_iface *oldif)
{
struct batadv_hard_iface *primary_if;
primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
batadv_dat_init_own_addr(bat_priv, primary_if);
batadv_bla_update_orig_address(bat_priv, primary_if, oldif);
out:
batadv_hardif_put(primary_if);
}
static void batadv_primary_if_select(struct batadv_priv *bat_priv,
struct batadv_hard_iface *new_hard_iface)
{
struct batadv_hard_iface *curr_hard_iface;
ASSERT_RTNL();
if (new_hard_iface)
kref_get(&new_hard_iface->refcount);
curr_hard_iface = rcu_replace_pointer(bat_priv->primary_if,
new_hard_iface, 1);
if (!new_hard_iface)
goto out;
bat_priv->algo_ops->iface.primary_set(new_hard_iface);
batadv_primary_if_update_addr(bat_priv, curr_hard_iface);
out:
batadv_hardif_put(curr_hard_iface);
}
static bool
batadv_hardif_is_iface_up(const struct batadv_hard_iface *hard_iface)
{
if (hard_iface->net_dev->flags & IFF_UP)
return true;
return false;
}
static void batadv_check_known_mac_addr(const struct batadv_hard_iface *hard_iface)
{
struct net_device *mesh_iface = hard_iface->mesh_iface;
const struct batadv_hard_iface *tmp_hard_iface;
struct list_head *iter;
if (!mesh_iface)
return;
netdev_for_each_lower_private(mesh_iface, tmp_hard_iface, iter) {
if (tmp_hard_iface == hard_iface)
continue;
if (tmp_hard_iface->if_status == BATADV_IF_NOT_IN_USE)
Annotation
- Immediate include surface: `hard-interface.h`, `main.h`, `linux/bug.h`, `linux/byteorder/generic.h`, `linux/compiler.h`, `linux/container_of.h`, `linux/errno.h`, `linux/gfp.h`.
- Detected declarations: `function batadv_hardif_release`, `function batadv_hardif_get_by_netdev`, `function batadv_getlink_net`, `function batadv_mutual_parents`, `function batadv_is_on_batman_iface`, `function batadv_is_valid_iface`, `function __batadv_get_real_netdev`, `function batadv_get_real_netdev`, `function batadv_is_wext_netdev`, `function batadv_is_cfg80211_netdev`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.