On 1/26/23 10:36 AM, sdf@xxxxxxxxxx wrote:
+ sockfd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (sockfd < 0) {
+ fprintf(stderr, "Failed to create echo socket\n");
+ return -errno;
+ }
+
+ err = setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &optval,
+ sizeof(optval));
+ if (err < 0) {
+ fprintf(stderr, "Failed sockopt on echo socket\n");
+ return -errno;
+ }
+
+ err = bind(sockfd, (struct sockaddr *)&addr, sizeof(addr));
+ if (err) {
+ fprintf(stderr, "Failed to bind echo socket\n");
+ return -errno;
+ }
IIRC, Martin mentioned IPv6 support in the previous version. Should we
also make the userspace v6 aware by at least using AF_INET6 dualstack
sockets? I feel like listening on inaddr_any with AF_INET6 should
get us there without too much pain..
Yeah. Think about host that only has IPv6 address. A tool not supporting IPv6 is
a no-go nowadays.