net/netfilter/nf_conntrack_broadcast.c

Source file repositories/reference/linux-study-clean/net/netfilter/nf_conntrack_broadcast.c

File Facts

System
Linux kernel
Corpus path
net/netfilter/nf_conntrack_broadcast.c
Extension
.c
Size
2326 bytes
Lines
94
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.

Dependency Surface

Detected Declarations

Annotated Snippet

in_dev_for_each_ifa_rcu(ifa, in_dev) {
			if (ifa->ifa_flags & IFA_F_SECONDARY)
				continue;

			if (ifa->ifa_broadcast == iph->daddr) {
				mask = ifa->ifa_mask;
				break;
			}
		}
	}

	if (mask == 0)
		goto out;

	exp = nf_ct_expect_alloc(ct);
	if (exp == NULL)
		goto out;

	exp->tuple                = ct->tuplehash[IP_CT_DIR_REPLY].tuple;

	helper = rcu_dereference(help->helper);
	if (helper)
		exp->tuple.src.u.udp.port = helper->tuple.src.u.udp.port;

	exp->mask.src.u3.ip       = mask;
	exp->mask.src.u.udp.port  = htons(0xFFFF);

	exp->expectfn             = NULL;
	exp->flags                = NF_CT_EXPECT_PERMANENT;
	exp->class		  = NF_CT_EXPECT_CLASS_DEFAULT;
	rcu_assign_pointer(exp->helper, helper);
	rcu_assign_pointer(exp->assign_helper, NULL);
	write_pnet(&exp->net, net);
#ifdef CONFIG_NF_CONNTRACK_ZONES
	exp->zone = ct->zone;
#endif
	nf_ct_expect_related(exp, 0);
	nf_ct_expect_put(exp);

	nf_ct_refresh(ct, timeout * HZ);
out:
	return NF_ACCEPT;
}
EXPORT_SYMBOL_GPL(nf_conntrack_broadcast_help);

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Broadcast connection tracking helper");

Annotation

Implementation Notes