tools/net/ynl/tests/rt-link.c
Source file repositories/reference/linux-study-clean/tools/net/ynl/tests/rt-link.c
File Facts
- System
- Linux kernel
- Corpus path
tools/net/ynl/tests/rt-link.c- Extension
.c- Size
- 4693 bytes
- Lines
- 207
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdio.hstring.hynl.harpa/inet.hnet/if.hkselftest_harness.hrt-link-user.h
Detected Declarations
function rt_link_printfunction netkit_createfunction netkit_deletefunction ynl_dump_foreach
Annotated Snippet
if (link->_hdr.ifi_index == netkit_ifindex) {
rt_link_print(_metadata, link);
found = true;
}
}
rt_link_getlink_list_free(rsp);
EXPECT_TRUE(found);
netkit_delete(_metadata, self->ys, netkit_ifindex);
}
TEST_F(rt_link, netkit_err_msg)
{
struct rt_link_newlink_req *req;
int ret;
/* Test creating netkit with bad policy - should fail */
req = rt_link_newlink_req_alloc();
ASSERT_NE(NULL, req);
rt_link_newlink_req_set_nlflags(req, NLM_F_CREATE);
rt_link_newlink_req_set_linkinfo_kind(req, "netkit");
rt_link_newlink_req_set_linkinfo_data_netkit_policy(req, 10);
ret = rt_link_newlink(self->ys, req);
rt_link_newlink_req_free(req);
EXPECT_NE(0, ret) {
TH_LOG("creating netkit with bad policy should fail");
}
/* Expect:
* Kernel error: 'Provided default xmit policy not supported' (bad attribute: .linkinfo.data(netkit).policy)
*/
EXPECT_NE(NULL, strstr(self->ys->err.msg, "bad attribute: .linkinfo.data(netkit).policy")) {
TH_LOG("expected extack msg not found: %s",
self->ys->err.msg);
}
}
TEST_HARNESS_MAIN
Annotation
- Immediate include surface: `stdio.h`, `string.h`, `ynl.h`, `arpa/inet.h`, `net/if.h`, `kselftest_harness.h`, `rt-link-user.h`.
- Detected declarations: `function rt_link_print`, `function netkit_create`, `function netkit_delete`, `function ynl_dump_foreach`.
- Atlas domain: Support Tooling And Documentation / tools.
- 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.