Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144299685
D18897.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D18897.diff
View Options
Index: head/sys/netinet/siftr.c
===================================================================
--- head/sys/netinet/siftr.c
+++ head/sys/netinet/siftr.c
@@ -272,6 +272,7 @@
static unsigned int siftr_enabled = 0;
static unsigned int siftr_pkts_per_log = 1;
static unsigned int siftr_generate_hashes = 0;
+static uint16_t siftr_port_filter = 0;
/* static unsigned int siftr_binary_log = 0; */
static char siftr_logfile[PATH_MAX] = "/var/log/siftr.log";
static char siftr_logfile_shadow[PATH_MAX] = "/var/log/siftr.log";
@@ -317,6 +318,10 @@
&siftr_generate_hashes, 0,
"enable packet hash generation");
+SYSCTL_U16(_net_inet_siftr, OID_AUTO, port_filter, CTLFLAG_RW,
+ &siftr_port_filter, 0,
+ "enable packet filter on a TCP port");
+
/* XXX: TODO
SYSCTL_UINT(_net_inet_siftr, OID_AUTO, binary, CTLFLAG_RW,
&siftr_binary_log, 0,
@@ -907,6 +912,16 @@
goto inp_unlock;
}
+ /*
+ * Only pkts selected by the tcp port filter
+ * can be inserted into the pkt_queue
+ */
+ if ((siftr_port_filter != 0) &&
+ (siftr_port_filter != ntohs(inp->inp_lport)) &&
+ (siftr_port_filter != ntohs(inp->inp_fport))) {
+ goto inp_unlock;
+ }
+
pn = malloc(sizeof(struct pkt_node), M_SIFTR_PKTNODE, M_NOWAIT|M_ZERO);
if (pn == NULL) {
@@ -1080,6 +1095,16 @@
else
ss->nskip_out_tcpcb++;
+ goto inp_unlock6;
+ }
+
+ /*
+ * Only pkts selected by the tcp port filter
+ * can be inserted into the pkt_queue
+ */
+ if ((siftr_port_filter != 0) &&
+ (siftr_port_filter != ntohs(inp->inp_lport)) &&
+ (siftr_port_filter != ntohs(inp->inp_fport))) {
goto inp_unlock6;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 8, 5:35 PM (15 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28479320
Default Alt Text
D18897.diff (1 KB)
Attached To
Mode
D18897: Add a simple port filter to SIFTR
Attached
Detach File
Event Timeline
Log In to Comment