Mouse <mouse%Rodents-Montreal.ORG@localhost> writes: >> I'm seeing issues on NetBSD where connect() returns error and sets >> errno to "Invalid argument". [...] > >> struct sockaddr_storage addr > >> connect(fd, (struct sockaddr *)&addr, sizeof(addr)) > >> If I replace the above connect() with > >> connect(fd, (struct sockaddr *)&addr, sizeof(struct sockaddr)) > >> then connect() succeeds. > > That last is almost certainly spurious. Your address family is > probably AF_INET; at least on my systems, sizeof(struct sockaddr) > equals sizeof(struct sockaddr_in). You really should be using the > correct size for the address family you're using. I didn't grasp the lengths. I suspect mouse is correct here. Perhaps read connect(2) impl in kernel, and it might check that the length arg is sizeof(struct sockaddr_in) after getting the AF and error out if not. That could be all there is to it.
Attachment:
signature.asc
Description: PGP signature