tools/testing/selftests/net/netfilter/conntrack_reverse_clash.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/netfilter/conntrack_reverse_clash.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/netfilter/conntrack_reverse_clash.c
Extension
.c
Size
2643 bytes
Lines
131
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (child) {
			if (sendto(s1, buf, LEN, 0, (struct sockaddr *)&sa2, sizeof(sa2)) != LEN)
				continue;

			if (recvfrom(s2, buf, LEN, 0, (struct sockaddr *)&peer, &plen) < 0)
				die("child recvfrom");

			if (peer.sin_port != htons(PORT))
				die_port(&peer, PORT);
		} else {
			if (sendto(s2, buf, LEN, 0, (struct sockaddr *)&sa1, sizeof(sa1)) != LEN)
				continue;

			if (recvfrom(s1, buf, LEN, 0, (struct sockaddr *)&peer, &plen) < 0)
				die("parent recvfrom");

			if (peer.sin_port != htons((PORT + 1)))
				die_port(&peer, PORT + 1);
		}
	}

	if (child)
		return 0;

	wait(&status);

	if (WIFEXITED(status))
		return WEXITSTATUS(status);

	return 1;
}

Annotation

Implementation Notes