commit 8f795179913a172632debbcf459cdea3562a2279 from: Thomas Adam date: Sat Aug 06 21:19:22 2022 UTC portable: provide sockaddr-linux implementation Someof the socket code has been factored out of gotwebd and put centrally so that platform-specific targets can be created, without the need of heavily modifying the central socket code to contain numerous ifdefs. commit - 275b5ade3a9d9c9850dd0e6f3129bdd58e4a3756 commit + 8f795179913a172632debbcf459cdea3562a2279 blob - /dev/null blob + 3ee344ae0da72bf5dce7537f2d690a67fec60bed (mode 644) --- /dev/null +++ compat/sockaddr-linux.c @@ -0,0 +1,27 @@ + +#include +#include + +#include + +#include "got_sockaddr.h" + +/* These calls are found in lib/socketaddr.c, but are overriden here for + * platform-specific reasons. + */ + +void +got_sockaddr_inet_init(struct sockaddr_in *in, struct in_addr *ina) +{ + in->sin_family = AF_INET; + in->sin_addr.s_addr = ina->s_addr; +} + +void +got_sockaddr_inet6_init(struct sockaddr_in6 *in6, struct in6_addr *in6a, + uint32_t sin6_scope_id) +{ + in6->sin6_family = AF_INET6; + memcpy(&in6->sin6_addr, in6a, sizeof(in6->sin6_addr)); + in6->sin6_scope_id = sin6_scope_id; +} blob - d3effa5d26df2da9b48681c1e302195ca6731d4e blob + f2e1a2e3d98e637f912bf963ffafe63b73fab425 --- gotwebd/Makefile.am +++ gotwebd/Makefile.am @@ -54,6 +54,11 @@ gotwebd_SOURCES = config.c \ $(top_srcdir)/lib/utf8.c \ $(top_srcdir)/lib/worktree.c \ $(top_srcdir)/lib/worktree_open.c +if HOST_LINUX +nodist_gotwebd_SOURCES = $(top_srcdir)/compat/sockaddr-@PLATFORM@.c +else +nodist_gotwebd_SOURCES = $(top_srcdir)/lib/sockaddr.c +endif gotwebd_DEPENDENCIES = $(top_builddir)/compat/libopenbsd-compat.a EXTRA_DIST = $(top_srcdir)/gotwebd/*.h \