Commit b2bdce7a authored by Kuniyuki Iwashima's avatar Kuniyuki Iwashima Committed by Jakub Kicinski
Browse files

selftest: net: Remove DCCP bits.



We will remove DCCP.

Let's remove DCCP bits from selftest.

Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20250410023921.11307-2-kuniyu@amazon.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent ba5560e5
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ CONFIG_NETFILTER_ADVANCED=y
CONFIG_NF_CONNTRACK=m
CONFIG_IPV6_MROUTE=y
CONFIG_IPV6_SIT=y
CONFIG_IP_DCCP=m
CONFIG_NF_NAT=m
CONFIG_IP6_NF_IPTABLES=m
CONFIG_IP_NF_IPTABLES=m
+1 −35
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@
#include <arpa/inet.h>
#include <errno.h>
#include <error.h>
#include <linux/dccp.h>
#include <linux/in.h>
#include <linux/unistd.h>
#include <stdbool.h>
@@ -21,10 +20,6 @@
#include <sys/socket.h>
#include <unistd.h>

#ifndef SOL_DCCP
#define SOL_DCCP 269
#endif

static const char *IP4_ADDR = "127.0.0.1";
static const char *IP6_ADDR = "::1";
static const char *IP4_MAPPED6 = "::ffff:127.0.0.1";
@@ -86,15 +81,6 @@ static void build_rcv_fd(int family, int proto, int *rcv_fds, int count,

		if (proto == SOCK_STREAM && listen(rcv_fds[i], 10))
			error(1, errno, "tcp: failed to listen on receive port");
		else if (proto == SOCK_DCCP) {
			if (setsockopt(rcv_fds[i], SOL_DCCP,
					DCCP_SOCKOPT_SERVICE,
					&(int) {htonl(42)}, sizeof(int)))
				error(1, errno, "failed to setsockopt");

			if (listen(rcv_fds[i], 10))
				error(1, errno, "dccp: failed to listen on receive port");
		}
	}
}

@@ -148,11 +134,6 @@ static int connect_and_send(int family, int proto)
	if (fd < 0)
		error(1, errno, "failed to create send socket");

	if (proto == SOCK_DCCP &&
		setsockopt(fd, SOL_DCCP, DCCP_SOCKOPT_SERVICE,
				&(int){htonl(42)}, sizeof(int)))
		error(1, errno, "failed to setsockopt");

	if (bind(fd, saddr, sz))
		error(1, errno, "failed to bind send socket");

@@ -175,7 +156,7 @@ static int receive_once(int epfd, int proto)
	if (i < 0)
		error(1, errno, "epoll_wait failed");

	if (proto == SOCK_STREAM || proto == SOCK_DCCP) {
	if (proto == SOCK_STREAM) {
		fd = accept(ev.data.fd, NULL, NULL);
		if (fd < 0)
			error(1, errno, "failed to accept");
@@ -243,20 +224,6 @@ static void run_one_test(int fam_send, int fam_rcv, int proto,

static void test_proto(int proto, const char *proto_str)
{
	if (proto == SOCK_DCCP) {
		int test_fd;

		test_fd = socket(AF_INET, proto, 0);
		if (test_fd < 0) {
			if (errno == ESOCKTNOSUPPORT) {
				fprintf(stderr, "DCCP not supported: skipping DCCP tests\n");
				return;
			} else
				error(1, errno, "failed to create a DCCP socket");
		}
		close(test_fd);
	}

	fprintf(stderr, "%s IPv4 ... ", proto_str);
	run_one_test(AF_INET, AF_INET, proto, IP4_ADDR);

@@ -271,7 +238,6 @@ int main(void)
{
	test_proto(SOCK_DGRAM, "UDP");
	test_proto(SOCK_STREAM, "TCP");
	test_proto(SOCK_DCCP, "DCCP");

	fprintf(stderr, "SUCCESS\n");
	return 0;