Bug 215633

Summary: GENEVEļ¼šcannot support bind listening address
Product: Networking Reporter: renmingshuai (rmsh1216)
Component: IPV4Assignee: Stephen Hemminger (stephen)
Status: NEW ---    
Severity: normal CC: noam
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.19.90 Subsystem:
Regression: No Bisected commit-id:

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.