summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mauderer <christian.mauderer@embedded-brains.de>2021-05-10 08:50:52 +0200
committerChristian Mauderer <christian.mauderer@embedded-brains.de>2021-05-11 08:43:42 +0200
commite5d5e097de85d56f1662493ccf0385125b85bec9 (patch)
tree5565d5b0951f34f74e321ae9ab9b8c7329bd6bd3
parentb1ecc253eed9695cb63a697c4d47b455e8e9bff4 (diff)
downloadrtems-libbsd-e5d5e097de85d56f1662493ccf0385125b85bec9.tar.bz2
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 #4405
-rw-r--r--ipsec-tools/src/libipsec/pfkey.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ipsec-tools/src/libipsec/pfkey.c b/ipsec-tools/src/libipsec/pfkey.c
index a621be12..385a21a9 100644
--- a/ipsec-tools/src/libipsec/pfkey.c
+++ b/ipsec-tools/src/libipsec/pfkey.c
@@ -1,5 +1,12 @@
#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 $ */
/* $KAME: pfkey.c,v 1.47 2003/10/02 19:52:12 itojun Exp $ */