net/ipv6/ioam6.c
Source file repositories/reference/linux-study-clean/net/ipv6/ioam6.c
File Facts
- System
- Linux kernel
- Corpus path
net/ipv6/ioam6.c- Extension
.c- Size
- 24591 bytes
- Lines
- 1062
- 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
linux/errno.hlinux/types.hlinux/kernel.hlinux/net.hlinux/ioam6.hlinux/ioam6_genl.hlinux/rhashtable.hlinux/netdevice.hnet/addrconf.hnet/genetlink.hnet/ioam6.hnet/sch_generic.h
Detected Declarations
function ioam6_ns_releasefunction ioam6_sc_releasefunction ioam6_free_nsfunction ioam6_free_scfunction ioam6_ns_cmpfnfunction ioam6_sc_cmpfnfunction ioam6_genl_addnsfunction ioam6_genl_delnsfunction __ioam6_genl_dumpns_elementfunction ioam6_genl_dumpns_startfunction ioam6_genl_dumpns_donefunction ioam6_genl_dumpnsfunction ioam6_genl_addscfunction ioam6_genl_delscfunction __ioam6_genl_dumpsc_elementfunction ioam6_genl_dumpsc_startfunction ioam6_genl_dumpsc_donefunction ioam6_genl_dumpscfunction ioam6_genl_ns_set_schemafunction ioam6_event_put_tracefunction ioam6_eventfunction ioam6_trace_compute_nodelenfunction __ioam6_fill_trace_datafunction ioam6_fill_trace_datafunction ioam6_net_initfunction ioam6_net_exitfunction ioam6_initfunction ioam6_exit
Annotated Snippet
if (IS_ERR(ns)) {
if (PTR_ERR(ns) == -EAGAIN)
continue;
err = PTR_ERR(ns);
goto done;
} else if (!ns) {
break;
}
err = __ioam6_genl_dumpns_element(ns,
NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq,
NLM_F_MULTI,
skb,
IOAM6_CMD_DUMP_NAMESPACES);
if (err)
goto done;
}
err = skb->len;
done:
rhashtable_walk_stop(iter);
return err;
}
static int ioam6_genl_addsc(struct sk_buff *skb, struct genl_info *info)
{
struct ioam6_pernet_data *nsdata;
int len, len_aligned, err;
struct ioam6_schema *sc;
u32 id;
if (!info->attrs[IOAM6_ATTR_SC_ID] || !info->attrs[IOAM6_ATTR_SC_DATA])
return -EINVAL;
id = nla_get_u32(info->attrs[IOAM6_ATTR_SC_ID]);
nsdata = ioam6_pernet(genl_info_net(info));
mutex_lock(&nsdata->lock);
sc = rhashtable_lookup_fast(&nsdata->schemas, &id, rht_sc_params);
if (sc) {
err = -EEXIST;
goto out_unlock;
}
len = nla_len(info->attrs[IOAM6_ATTR_SC_DATA]);
len_aligned = ALIGN(len, 4);
sc = kzalloc(sizeof(*sc) + len_aligned, GFP_KERNEL);
if (!sc) {
err = -ENOMEM;
goto out_unlock;
}
sc->id = id;
sc->len = len_aligned;
sc->hdr = cpu_to_be32(sc->id | ((u8)(sc->len / 4) << 24));
nla_memcpy(sc->data, info->attrs[IOAM6_ATTR_SC_DATA], len);
err = rhashtable_lookup_insert_fast(&nsdata->schemas, &sc->head,
rht_sc_params);
if (err)
goto free_sc;
out_unlock:
mutex_unlock(&nsdata->lock);
return err;
free_sc:
kfree(sc);
goto out_unlock;
}
static int ioam6_genl_delsc(struct sk_buff *skb, struct genl_info *info)
{
struct ioam6_pernet_data *nsdata;
struct ioam6_namespace *ns;
struct ioam6_schema *sc;
int err;
u32 id;
if (!info->attrs[IOAM6_ATTR_SC_ID])
return -EINVAL;
id = nla_get_u32(info->attrs[IOAM6_ATTR_SC_ID]);
nsdata = ioam6_pernet(genl_info_net(info));
mutex_lock(&nsdata->lock);
Annotation
- Immediate include surface: `linux/errno.h`, `linux/types.h`, `linux/kernel.h`, `linux/net.h`, `linux/ioam6.h`, `linux/ioam6_genl.h`, `linux/rhashtable.h`, `linux/netdevice.h`.
- Detected declarations: `function ioam6_ns_release`, `function ioam6_sc_release`, `function ioam6_free_ns`, `function ioam6_free_sc`, `function ioam6_ns_cmpfn`, `function ioam6_sc_cmpfn`, `function ioam6_genl_addns`, `function ioam6_genl_delns`, `function __ioam6_genl_dumpns_element`, `function ioam6_genl_dumpns_start`.
- 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.