commit 6236440b6f6cfc10a53dfe3aa30c61f16f1bb5c4
parent 33e70763589ac7a9c14fe1c7cf184897924f67a0
Author: Joshua Piccari <joshua.piccari@gmail.com>
Date: Sun, 13 Sep 2015 22:01:53 -0700
Updates for `tcpkill_kill()` to support 32-bit values for `kill_count`
Diffstat:
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/ngrep.c b/ngrep.c
@@ -108,7 +108,7 @@ uint32_t snaplen = 65535, limitlen = 65535, promisc = 1, to = 100;
uint32_t match_after = 0, keep_matching = 0, matches = 0, max_matches = 0;
#if USE_TCPKILL
-uint16_t tcpkill_active = 0;
+uint32_t tcpkill_active = 0;
#endif
uint8_t re_match_word = 0, re_ignore_case = 0, re_multiline_match = 1;
@@ -337,7 +337,7 @@ int main(int argc, char **argv) {
break;
#if USE_TCPKILL
case 'K':
- tcpkill_active = atoi(optarg);
+ tcpkill_active = _atoui32(optarg);
break;
#endif
case 'h':
diff --git a/tcpkill.c b/tcpkill.c
@@ -23,13 +23,12 @@ libnet_t *l;
void
tcpkill_kill(const struct pcap_pkthdr *pcap, const u_char *pkt,
- unsigned pcap_off, unsigned kill_count)
+ uint32_t pcap_off, uint32_t kill_count)
{
struct libnet_ipv4_hdr *ip;
struct libnet_tcp_hdr *tcp;
u_char ctext[64];
- u_int32_t seq, win;
- int i, len;
+ uint32_t seq, win, i, len;
pkt += pcap_off;
len = pcap->caplen - pcap_off;
diff --git a/tcpkill.h b/tcpkill.h
@@ -2,6 +2,6 @@
#define TCPKILL_H
void tcpkill_init(void);
-void tcpkill_kill(const struct pcap_pkthdr *pcap, const u_char *pkt, unsigned pcap_off, unsigned kill_count);
+void tcpkill_kill(const struct pcap_pkthdr *pcap, const u_char *pkt, uint32_t pcap_off, uint32_t kill_count);
#endif