[rtems-libbsd commit] pfctl: Fix global state initialization
Sebastian Huber
sebh at rtems.org
Fri May 13 06:53:11 UTC 2022
Module: rtems-libbsd
Branch: master
Commit: ae635eb21422c5066ef34742195d45a9fb04c777
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=ae635eb21422c5066ef34742195d45a9fb04c777
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed May 11 13:43:14 2022 +0200
pfctl: Fix global state initialization
Update #4654.
---
freebsd/sbin/pfctl/pfctl_parser.c | 10 ++++++++++
freebsd/sbin/pfctl/rtems-bsd-pfctl-namespace.h | 1 +
freebsd/sbin/pfctl/rtems-bsd-pfctl-pfctl_parser-data.h | 1 +
3 files changed, 12 insertions(+)
diff --git a/freebsd/sbin/pfctl/pfctl_parser.c b/freebsd/sbin/pfctl/pfctl_parser.c
index f339d972..9d752d26 100644
--- a/freebsd/sbin/pfctl/pfctl_parser.c
+++ b/freebsd/sbin/pfctl/pfctl_parser.c
@@ -1351,10 +1351,17 @@ get_socket_domain(void)
return (sdom);
}
+#ifdef __rtems__
+static int pfctl_s = -1;
+#endif /* __rtems__ */
int
get_query_socket(void)
{
+#ifndef __rtems__
static int s = -1;
+#else /* __rtems__ */
+#define s pfctl_s
+#endif /* __rtems__ */
if (s == -1) {
if ((s = socket(get_socket_domain(), SOCK_DGRAM, 0)) == -1)
@@ -1362,6 +1369,9 @@ get_query_socket(void)
}
return (s);
+#ifdef __rtems__
+#undef s
+#endif /* __rtems__ */
}
/*
diff --git a/freebsd/sbin/pfctl/rtems-bsd-pfctl-namespace.h b/freebsd/sbin/pfctl/rtems-bsd-pfctl-namespace.h
index 1712b9e6..2f7fb828 100644
--- a/freebsd/sbin/pfctl/rtems-bsd-pfctl-namespace.h
+++ b/freebsd/sbin/pfctl/rtems-bsd-pfctl-namespace.h
@@ -35,6 +35,7 @@
#define parseport _bsd_pfctl_parseport
#define pfctl_cmdline_symset _bsd_pfctl_pfctl_cmdline_symset
#define pfctl_load_anchors _bsd_pfctl_pfctl_load_anchors
+#define pfctl_s _bsd_pfctl_s
#define pfctlychar _bsd_pfctl_pfctlychar
#define pfctlydebug _bsd_pfctl_pfctlydebug
#define pfctlyerrflag _bsd_pfctl_pfctlyerrflag
diff --git a/freebsd/sbin/pfctl/rtems-bsd-pfctl-pfctl_parser-data.h b/freebsd/sbin/pfctl/rtems-bsd-pfctl-pfctl_parser-data.h
index bb8832ac..9bbec579 100644
--- a/freebsd/sbin/pfctl/rtems-bsd-pfctl-pfctl_parser-data.h
+++ b/freebsd/sbin/pfctl/rtems-bsd-pfctl-pfctl_parser-data.h
@@ -3,3 +3,4 @@
#include "rtems-bsd-pfctl-data.h"
/* pfctl_parser.c */
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_pfctl, static struct node_host *iftab);
+RTEMS_LINKER_RWSET_CONTENT(bsd_prog_pfctl, static int pfctl_s);
More information about the vc
mailing list