Bug 215633 - GENEVE:cannot support bind listening address
Summary: GENEVE:cannot support bind listening address
Status: NEW
Alias: None
Product: Networking
Classification: Unclassified
Component: IPV4 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Stephen Hemminger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-22 12:39 UTC by renmingshuai
Modified: 2022-07-05 10:03 UTC (History)
1 user (show)

See Also:
Kernel Version: 4.19.90
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description renmingshuai 2022-02-22 12:39:10 UTC
when create geneve interface and turn it up, then found the specified port is listening at 0.0.0.0 address.

[root@localhost ~]# ip link add geneve1 type geneve id 2 dstport 6081 remote 10.10.10.2
[root@localhost ~]# netstat -apntu|grep 6081
udp        0      0 0.0.0.0:6081            0.0.0.0:*                           -

read the code, the geneve driver initializes the IP address to 0 by default. It does not support setting the listening address.

static struct socket *geneve_create_sock(struct net *net, bool ipv6,
					 __be16 port, bool ipv6_rx_csum)
{
	struct socket *sock;
	struct udp_port_cfg udp_conf;
	int err;

	memset(&udp_conf, 0, sizeof(udp_conf));

	if (ipv6) {
		udp_conf.family = AF_INET6;
		udp_conf.ipv6_v6only = 1;
		udp_conf.use_udp6_rx_checksums = ipv6_rx_csum;
	} else {
		udp_conf.family = AF_INET;
		udp_conf.local_ip.s_addr = htonl(INADDR_ANY);
	}

	udp_conf.local_udp_port = port;

	/* Open UDP socket */
	err = udp_sock_create(net, &udp_conf, &sock);
	if (err < 0)
		return ERR_PTR(err);

	return sock;
}

It is necessary to support configurable listening address for the reaseon that 
0.0.0.0 address listen is not safe.

Note You need to log in before you can comment on or make changes to this bug.