This commit brings back the driver from commit
f187d6dfbf633665ba6740fe22742aec60ce02a2 plus subsequent fixes from
upstream.
Obtained from: git@git.zx2c4.com:wireguard-freebsd
Sponsored by: The FreeBSD Foundation
Differential D36909
Import the WireGuard driver from zx2c4.com. jhb on Oct 7 2022, 9:58 PM. Authored by Tags None Referenced Files
Details This commit brings back the driver from commit Obtained from: git@git.zx2c4.com:wireguard-freebsd
Diff Detail
Event TimelineComment Actions IMHO, code should be cleaned up from __FreeBSD_version and only code that is for CURRENT shall end in git branch main. Comment Actions The previous discussion on this lead to us keeping them for now- IIRC it's specifically that we don't want to maintain the out-of-tree repo just for compat shims and keeping those patches in ports is kind of a pain, so it's harmless to carry these here until if_wg ends up in all supported releases. Comment Actions
Yeah, it seems reasonable to me to merge to stable/13 when appropriate, and then unifdef on main. Comment Actions See also D36913. That trims a lot of the #ifdef's, but I wanted to have a starting point closer to the current driver (though even here I have some changes to fine LINT-NO*, etc. relative to upstream) Comment Actions That seems to be missing a definition for sogetsockaddr(): /usr/src/sys/dev/wg/if_wg.c:825:14: error: implicit declaration of function 'sogetsockaddr' is invalid in C99 [-Werror,-Wimplicit-function-declaration] int ret = sogetsockaddr(so4, (struct sockaddr **)&bound_sin); ^ /usr/src/sys/dev/wg/if_wg.c:825:14: note: did you mean 'getsockaddr'? /usr/src/sys/sys/socketvar.h:449:5: note: 'getsockaddr' declared here int getsockaddr(struct sockaddr **namp, const struct sockaddr *uaddr, ^ /usr/src/sys/dev/wg/if_wg.c:840:14: error: implicit declaration of function 'sogetsockaddr' is invalid in C99 [-Werror,-Wimplicit-function-declaration] int ret = sogetsockaddr(so6, (struct sockaddr **)&bound_sin6); ^ The patch that removed wireguard had this: diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index eb748928cd91..7f06b51cf096 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -850,17 +850,6 @@ sopeeloff(struct socket *head) } #endif /* SCTP */ -int -sogetsockaddr(struct socket *so, struct sockaddr **nam) -{ - int error; - - CURVNET_SET(so->so_vnet); - error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, nam); - CURVNET_RESTORE(); - return (error); -} - int sobind(struct socket *so, struct sockaddr *nam, struct thread *td) { Comment Actions Although it does have to be this, due to other refactoring in the mean time: +int +sogetsockaddr(struct socket *so, struct sockaddr **nam) +{ + int error; + + CURVNET_SET(so->so_vnet); + error = (*so->so_proto->pr_sockaddr)(so, nam); + CURVNET_RESTORE(); + return (error); +} + Comment Actions
It's earlier in the stack, see D30087 Comment Actions
Comment Actions
Comment Actions I made an entry on my todo list for the man page changes. @jhb is right about, that this should be a separate differential. |