net/batman-adv/netlink.c
Source file repositories/reference/linux-study-clean/net/batman-adv/netlink.c
File Facts
- System
- Linux kernel
- Corpus path
net/batman-adv/netlink.c- Extension
.c- Size
- 43730 bytes
- Lines
- 1568
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
netlink.hmain.hlinux/array_size.hlinux/atomic.hlinux/bitops.hlinux/bug.hlinux/byteorder/generic.hlinux/cache.hlinux/compiler.hlinux/err.hlinux/errno.hlinux/gfp.hlinux/if_ether.hlinux/if_vlan.hlinux/init.hlinux/limits.hlinux/minmax.hlinux/netdevice.hlinux/netlink.hlinux/printk.hlinux/rtnetlink.hlinux/skbuff.hlinux/stddef.hlinux/types.hlinux/utsname.hnet/genetlink.hnet/net_namespace.hnet/netlink.hnet/sock.huapi/linux/batadv_packet.huapi/linux/batman_adv.hbat_algo.h
Detected Declarations
enum batadv_netlink_multicast_groupsenum batadv_genl_ops_flagsfunction batadv_netlink_get_ifindexfunction batadv_netlink_mesh_fill_ap_isolationfunction batadv_netlink_set_mesh_ap_isolationfunction batadv_netlink_mesh_fillfunction batadv_netlink_notify_meshfunction batadv_netlink_get_meshfunction batadv_netlink_set_meshfunction batadv_netlink_tp_meter_putfunction batadv_netlink_tpmeter_notifyfunction batadv_netlink_tp_meter_startfunction batadv_netlink_tp_meter_cancelfunction batadv_netlink_hardif_fillfunction batadv_netlink_notify_hardiffunction batadv_netlink_cmd_get_hardiffunction batadv_netlink_set_hardiffunction batadv_netlink_dump_hardiffunction netdev_for_each_lower_privatefunction batadv_netlink_vlan_fillfunction batadv_netlink_notify_vlanfunction batadv_netlink_get_vlanfunction batadv_netlink_set_vlanfunction batadv_netlink_get_meshif_from_ifindexfunction batadv_netlink_get_meshif_from_infofunction batadv_netlink_get_meshiffunction batadv_netlink_get_hardif_from_ifindexfunction batadv_netlink_get_hardif_from_infofunction batadv_netlink_get_hardiffunction batadv_get_vlan_from_infofunction batadv_pre_doitfunction batadv_post_doitfunction batadv_netlink_registerfunction batadv_netlink_unregister
Annotated Snippet
if (gw_mode <= BATADV_GW_MODE_SERVER) {
/* Invoking batadv_gw_reselect() is not enough to really
* de-select the current GW. It will only instruct the
* gateway client code to perform a re-election the next
* time that this is needed.
*
* When gw client mode is being switched off the current
* GW must be de-selected explicitly otherwise no GW_ADD
* uevent is thrown on client mode re-activation. This
* is operation is performed in
* batadv_gw_check_client_stop().
*/
batadv_gw_reselect(bat_priv);
/* always call batadv_gw_check_client_stop() before
* changing the gateway state
*/
batadv_gw_check_client_stop(bat_priv);
WRITE_ONCE(bat_priv->gw.mode, gw_mode);
batadv_gw_tvlv_container_update(bat_priv);
}
}
if (info->attrs[BATADV_ATTR_GW_SEL_CLASS] &&
bat_priv->algo_ops->gw.get_best_gw_node &&
bat_priv->algo_ops->gw.is_eligible) {
/* setting the GW selection class is allowed only if the routing
* algorithm in use implements the GW API
*/
u32 sel_class_max = bat_priv->algo_ops->gw.sel_class_max;
u32 sel_class;
attr = info->attrs[BATADV_ATTR_GW_SEL_CLASS];
sel_class = nla_get_u32(attr);
if (sel_class >= 1 && sel_class <= sel_class_max) {
WRITE_ONCE(bat_priv->gw.sel_class, sel_class);
batadv_gw_reselect(bat_priv);
}
}
if (info->attrs[BATADV_ATTR_HOP_PENALTY]) {
attr = info->attrs[BATADV_ATTR_HOP_PENALTY];
WRITE_ONCE(bat_priv->hop_penalty, nla_get_u8(attr));
}
#ifdef CONFIG_BATMAN_ADV_DEBUG
if (info->attrs[BATADV_ATTR_LOG_LEVEL]) {
attr = info->attrs[BATADV_ATTR_LOG_LEVEL];
WRITE_ONCE(bat_priv->log_level,
nla_get_u32(attr) & BATADV_DBG_ALL);
}
#endif /* CONFIG_BATMAN_ADV_DEBUG */
#ifdef CONFIG_BATMAN_ADV_MCAST
if (info->attrs[BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED]) {
attr = info->attrs[BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED];
WRITE_ONCE(bat_priv->multicast_mode, !nla_get_u8(attr));
}
if (info->attrs[BATADV_ATTR_MULTICAST_FANOUT]) {
attr = info->attrs[BATADV_ATTR_MULTICAST_FANOUT];
WRITE_ONCE(bat_priv->multicast_fanout, nla_get_u32(attr));
}
#endif /* CONFIG_BATMAN_ADV_MCAST */
if (info->attrs[BATADV_ATTR_ORIG_INTERVAL]) {
u32 orig_interval;
attr = info->attrs[BATADV_ATTR_ORIG_INTERVAL];
orig_interval = nla_get_u32(attr);
orig_interval = min_t(u32, orig_interval, INT_MAX);
orig_interval = max_t(u32, orig_interval, 2 * BATADV_JITTER);
WRITE_ONCE(bat_priv->orig_interval, orig_interval);
}
batadv_netlink_notify_mesh(bat_priv);
return 0;
}
/**
* batadv_netlink_tp_meter_put() - Fill information of started tp_meter session
Annotation
- Immediate include surface: `netlink.h`, `main.h`, `linux/array_size.h`, `linux/atomic.h`, `linux/bitops.h`, `linux/bug.h`, `linux/byteorder/generic.h`, `linux/cache.h`.
- Detected declarations: `enum batadv_netlink_multicast_groups`, `enum batadv_genl_ops_flags`, `function batadv_netlink_get_ifindex`, `function batadv_netlink_mesh_fill_ap_isolation`, `function batadv_netlink_set_mesh_ap_isolation`, `function batadv_netlink_mesh_fill`, `function batadv_netlink_notify_mesh`, `function batadv_netlink_get_mesh`, `function batadv_netlink_set_mesh`, `function batadv_netlink_tp_meter_put`.
- 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.