Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add skip bits to adapt gre usage

  • Loading branch information...
commit 669fc81aad20ad6da176ebc6fbacd880c99ef8ef 1 parent 92670ed
Meng Zhang authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 httpry.c
View
7 httpry.c
@@ -50,6 +50,7 @@ void display_usage();
/* Program flags/options, set by arguments or config file */
static unsigned int parse_count = 0;
static int daemon_mode = 0;
+static int eth_skip_bits = 0;
static char *use_infile = NULL;
static char *interface = NULL;
static char *capfilter = NULL;
@@ -307,6 +308,8 @@ void parse_http_packet(u_char *args, const struct pcap_pkthdr *header, const u_c
header_offset = eth_offset;
}
+ header_offset += eth_skip_bits;
+
/* Position pointers within packet stream and do sanity checks */
ip = (struct ip_header *) (pkt + header_offset);
ip6 = (struct ip6_header *) (pkt + header_offset);
@@ -648,6 +651,7 @@ void display_usage() {
" -s run in HTTP requests per second mode\n"
" -t seconds specify the display interval for rate statistics\n"
" -u user set process owner\n"
+ " -S count Number of bytes need to be skipped after ethernet header\n"
" expression specify a bpf-style capture filter\n\n");
printf("Additional information can be found at:\n"
@@ -666,7 +670,7 @@ int main(int argc, char **argv) {
signal(SIGINT, &handle_signal);
/* Process command line arguments */
- while ((opt = getopt(argc, argv, "b:df:Fhpqi:l:m:n:o:P:r:st:u:")) != -1) {
+ while ((opt = getopt(argc, argv, "b:df:Fhpqi:l:m:n:o:P:r:st:u:S:")) != -1) {
switch (opt) {
case 'b': use_dumpfile = optarg; break;
case 'd': daemon_mode = 1; use_syslog = 1; break;
@@ -685,6 +689,7 @@ int main(int argc, char **argv) {
case 's': rate_stats = 1; break;
case 't': rate_interval = atoi(optarg); break;
case 'u': new_user = optarg; break;
+ case 'S': eth_skip_bits = atoi(optarg); break;
default: display_usage();
}
}

1 comment on commit 669fc81

@jbittel

Were you wanting to merge this back into the main httpry project? This looks like a useful option and I'd be happy to merge it if you submit a pull request. If you wish, feel free to add yourself to the AUTHORS file also.

Please sign in to comment.
Something went wrong with that request. Please try again.