Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151986020
D56155.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D56155.diff
View Options
diff --git a/sys/netinet/siftr.c b/sys/netinet/siftr.c
--- a/sys/netinet/siftr.c
+++ b/sys/netinet/siftr.c
@@ -119,30 +119,37 @@
#define MODVERSION_STR __XSTRING(V_MAJOR) "." __XSTRING(V_BACKBREAK) "." \
__XSTRING(V_BACKCOMPAT)
-#define HOOK 0
-#define UNHOOK 1
-#define SIFTR_EXPECTED_MAX_TCP_FLOWS 65536
#define SYS_NAME "FreeBSD"
-#define PACKET_TAG_SIFTR 100
-#define PACKET_COOKIE_SIFTR 21749576
-#define SIFTR_LOG_FILE_MODE 0644
-#define SIFTR_DISABLE 0
-#define SIFTR_ENABLE 1
-/*
- * Hard upper limit on the length of log messages. Bump this up if you add new
- * data fields such that the line length could exceed the below value.
- */
-#define MAX_LOG_MSG_LEN 300
-#define MAX_LOG_BATCH_SIZE 3
-/* XXX: Make this a sysctl tunable. */
-#define SIFTR_ALQ_BUFLEN (1000*MAX_LOG_MSG_LEN)
+enum pfil_action {
+ HOOK = 0,
+ UNHOOK = 1,
+};
+
+enum siftr_ops {
+ SIFTR_DISABLE = 0,
+ SIFTR_ENABLE = 1,
+};
+enum siftr_settings {
+ SIFTR_PACKET_TAG = 100,
+ SIFTR_PACKET_COOKIE = 21749576,
+ SIFTR_LOG_FILE_MODE = 0644,
+ SIFTR_EXPECTED_MAX_TCP_FLOWS = 65536,
+ /*
+ * Hard upper limit on the length of log messages. Bump this up if you
+ * add new data fields such that the line length could exceed the
+ * below value.
+ */
+ MAX_LOG_MSG_LEN = 300,
+ MAX_LOG_BATCH_SIZE = 3,
+ SIFTR_ALQ_BUFLEN = 1000 * MAX_LOG_MSG_LEN,
#ifdef SIFTR_IPV6
-#define SIFTR_IPMODE 6
+ SIFTR_IPMODE = 6,
#else
-#define SIFTR_IPMODE 4
+ SIFTR_IPMODE = 4,
#endif
+};
static MALLOC_DEFINE(M_SIFTR, "siftr", "dynamic memory used by SIFTR");
static MALLOC_DEFINE(M_SIFTR_PKTNODE, "siftr_pktnode",
@@ -561,7 +568,7 @@
static inline int
siftr_chkreinject(struct mbuf *m, int dir, struct siftr_stats *ss)
{
- if (m_tag_locate(m, PACKET_COOKIE_SIFTR, PACKET_TAG_SIFTR, NULL)
+ if (m_tag_locate(m, SIFTR_PACKET_COOKIE, SIFTR_PACKET_TAG, NULL)
!= NULL) {
if (dir == PFIL_IN)
ss->nskip_in_dejavu++;
@@ -570,8 +577,8 @@
return (1);
} else {
- struct m_tag *tag = m_tag_alloc(PACKET_COOKIE_SIFTR,
- PACKET_TAG_SIFTR, 0, M_NOWAIT);
+ struct m_tag *tag = m_tag_alloc(SIFTR_PACKET_COOKIE,
+ SIFTR_PACKET_TAG, 0, M_NOWAIT);
if (tag == NULL) {
if (dir == PFIL_IN)
ss->nskip_in_malloc++;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 12, 10:53 PM (10 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30716955
Default Alt Text
D56155.diff (2 KB)
Attached To
Mode
D56155: siftr: replace macro constants with debug friendly enums
Attached
Detach File
Event Timeline
Log In to Comment