aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_client_vty.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-09-10 16:45:45 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-09-10 16:55:33 +0200
commitb7a834b4cb6a0cdd53d4fb06c1981e8d2af1c949 (patch)
tree9e9f287d2e387bfb66017772bc6e0d07edce671f /src/osmo_client_vty.c
parent07d96eb65441e46647d05e690c557ed3c14cb79b (diff)
gprs: Add a custom GPRS filter
Allow to inspect UDP messages and check for GPRS, NS, BSSGP and then filter LLC frames. Parsing the vL datastructure with the libpcap syntax is a pain. It could be done using BPF but we do not want to use bpf asm to specify the entire ruleset. I looked into using libepan/libwireshark but this has memory issues and is painful too. So let's parse UDP, NS, BSSGP using the info we already have. I tried a bit of editcap to generate a bit of broken data. The length check might still be bad. I used my crash_20100602.pcap file to count the LLC frames we detect and compare that to wireshark it ended with the right number. pcap add-filter gprs can be used to enable the new filtering option after the OS has received the packet. Fixes: ONW#1314
Diffstat (limited to 'src/osmo_client_vty.c')
-rw-r--r--src/osmo_client_vty.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/osmo_client_vty.c b/src/osmo_client_vty.c
index 0b30eb7..a8739b1 100644
--- a/src/osmo_client_vty.c
+++ b/src/osmo_client_vty.c
@@ -59,6 +59,8 @@ static int config_write_client(struct vty *vty)
pcap_client->filter_string, VTY_NEWLINE);
vty_out(vty, " pcap detect-loop %d%s",
pcap_client->filter_itself, VTY_NEWLINE);
+ if (pcap_client->gprs_filtering)
+ vty_out(vty, " pcap add-filter gprs%s", VTY_NEWLINE);
if (pcap_client->srv_ip)
vty_out(vty, " server ip %s%s",
@@ -80,6 +82,24 @@ DEFUN(cfg_client_device,
return CMD_SUCCESS;
}
+DEFUN(cfg_client_add_gprs,
+ cfg_client_add_gprs_cmd,
+ "pcap add-filter gprs",
+ PCAP_STRING "Add-filter\n" "Custom filtering for GPRS\n")
+{
+ pcap_client->gprs_filtering = 1;
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_client_del_gprs,
+ cfg_client_del_gprs_cmd,
+ "no pcap add-filter gprs",
+ NO_STR PCAP_STRING "Add-filter\n" "Custom filter for GPRS\n")
+{
+ pcap_client->gprs_filtering = 0;
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_client_filter,
cfg_client_filter_cmd,
"pcap filter .NAME",
@@ -144,5 +164,8 @@ int vty_client_init(struct osmo_pcap_client *pcap)
install_element(CLIENT_NODE, &cfg_server_ip_cmd);
install_element(CLIENT_NODE, &cfg_server_port_cmd);
+ install_element(CLIENT_NODE, &cfg_client_add_gprs_cmd);
+ install_element(CLIENT_NODE, &cfg_client_del_gprs_cmd);
+
return 0;
}