ipsec-tools/pfkey: Fix socket leak

setkey uses pfkey_open to open a socket. But setkey doesn't close the
socket.

The libipsec functions are used only by user space applications (setkey
and racoon). Adding the wrapper for socket makes sure that the opened
socket is registered and closes if the application exits.

Fixes #4404
This commit is contained in:
Christian Mauderer 2021-05-10 08:50:52 +02:00
parent 35bdef1fa0
commit a2bc8eba46

View File

@ -1,5 +1,12 @@
#include <machine/rtems-bsd-user-space.h> #include <machine/rtems-bsd-user-space.h>
#ifdef __rtems__
/* Only need socket from rtems-bsd-program wrappers! */
int
rtems_bsd_program_socket(int domain, int type, int protocol);
#define socket(domain, type, protocol) \
rtems_bsd_program_socket(domain, type, protocol)
#endif /* __rtems__ */
/* $NetBSD: pfkey.c,v 1.21.2.1 2011/11/14 13:25:06 tteras Exp $ */ /* $NetBSD: pfkey.c,v 1.21.2.1 2011/11/14 13:25:06 tteras Exp $ */
/* $KAME: pfkey.c,v 1.47 2003/10/02 19:52:12 itojun Exp $ */ /* $KAME: pfkey.c,v 1.47 2003/10/02 19:52:12 itojun Exp $ */