net/netfilter/ipvs/ip_vs_app.c
Source file repositories/reference/linux-study-clean/net/netfilter/ipvs/ip_vs_app.c
File Facts
- System
- Linux kernel
- Corpus path
net/netfilter/ipvs/ip_vs_app.c- Extension
.c- Size
- 13491 bytes
- Lines
- 617
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
linux/module.hlinux/kernel.hlinux/skbuff.hlinux/in.hlinux/ip.hlinux/netfilter.hlinux/slab.hnet/net_namespace.hnet/protocol.hnet/tcp.hlinux/stat.hlinux/proc_fs.hlinux/seq_file.hlinux/mutex.hnet/ip_vs.h
Detected Declarations
function ip_vs_app_getfunction ip_vs_app_putfunction ip_vs_app_inc_destroyfunction ip_vs_app_inc_rcu_freefunction ip_vs_app_inc_newfunction ip_vs_app_inc_releasefunction incfunction incfunction register_ip_vs_app_incfunction list_for_each_entryfunction synchronize_rcufunction list_for_each_entry_safefunction list_for_each_entry_safefunction ip_vs_appfunction incarnationfunction vs_fix_seqfunction vs_fix_ack_seqfunction vs_seq_updatefunction app_tcp_pkt_outfunction ip_vs_app_pkt_outfunction app_tcp_pkt_infunction ip_vs_app_pkt_infunction list_for_each_entryfunction list_for_each_entryfunction ip_vs_app_seq_stopfunction ip_vs_app_seq_showfunction ip_vs_app_net_initfunction ip_vs_app_net_cleanupexport register_ip_vs_appexport unregister_ip_vs_appexport register_ip_vs_app_inc
Annotated Snippet
if (!inc->timeout_table) {
ret = -ENOMEM;
goto out;
}
}
ret = pp->register_app(ipvs, inc);
if (ret)
goto out;
list_add(&inc->a_list, &app->incs_list);
IP_VS_DBG(9, "%s App %s:%u registered\n",
pp->name, inc->name, ntohs(inc->port));
return 0;
out:
ip_vs_app_inc_destroy(inc);
return ret;
}
/*
* Release app incarnation
*/
static void
ip_vs_app_inc_release(struct netns_ipvs *ipvs, struct ip_vs_app *inc)
{
struct ip_vs_protocol *pp;
if (!(pp = ip_vs_proto_get(inc->protocol)))
return;
if (pp->unregister_app)
pp->unregister_app(ipvs, inc);
IP_VS_DBG(9, "%s App %s:%u unregistered\n",
pp->name, inc->name, ntohs(inc->port));
list_del(&inc->a_list);
call_rcu(&inc->rcu_head, ip_vs_app_inc_rcu_free);
}
/*
* Get reference to app inc (only called from softirq)
*
*/
int ip_vs_app_inc_get(struct ip_vs_app *inc)
{
int result;
result = ip_vs_app_get(inc->app);
if (result)
atomic_inc(&inc->usecnt);
return result;
}
/*
* Put the app inc (only called from timer or net softirq)
*/
void ip_vs_app_inc_put(struct ip_vs_app *inc)
{
atomic_dec(&inc->usecnt);
ip_vs_app_put(inc->app);
}
/*
* Register an application incarnation in protocol applications
*/
int
register_ip_vs_app_inc(struct netns_ipvs *ipvs, struct ip_vs_app *app, __u16 proto,
__u16 port)
{
int result;
mutex_lock(&__ip_vs_app_mutex);
result = ip_vs_app_inc_new(ipvs, app, proto, port);
mutex_unlock(&__ip_vs_app_mutex);
return result;
}
/* Register application for netns */
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/skbuff.h`, `linux/in.h`, `linux/ip.h`, `linux/netfilter.h`, `linux/slab.h`, `net/net_namespace.h`.
- Detected declarations: `function ip_vs_app_get`, `function ip_vs_app_put`, `function ip_vs_app_inc_destroy`, `function ip_vs_app_inc_rcu_free`, `function ip_vs_app_inc_new`, `function ip_vs_app_inc_release`, `function inc`, `function inc`, `function register_ip_vs_app_inc`, `function list_for_each_entry`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration 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.