xdp-project / xdp-tools

Utilities and example programs for use with XDP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

xdp-trafficgen fails to build against musl libc

nekopsykose opened this issue · comments

commented

on 1.4.0

xdp-trafficgen.c:793:33: error: passing argument 2 of 'getsockname' from incompatible pointer type [-Werror=incompatible-pointer-types]
  793 |         err = getsockname(sock, &local_saddr, &sockaddr_sz);
      |                                 ^~~~~~~~~~~~
      |                                 |
      |                                 struct sockaddr_in6 *

this is probably because local_saddr is sockaddr_in6 but getsockname takes struct sockaddr as documented. theoretically these are different pointers..

it's possible to get around this by casting it, but afaik that is still a strict aliasing violation (maybe?) so it would only be safe with -fno-strict-aliasing

Hmm. I don't have any issue with adding a cast to appease musl - let's see if that is sufficient. Could you please see if #350 fixes the issue for you?

commented

that fixes it, yeah

commented

asked in #musl irc and you are actually supposed to cast it, so that is actually the correct solution and my analysis that it could be wrong, was wrong :)

thanks for the fix