Skip to content

Support set-command usage - #1

Merged
mckelvin merged 10 commits into
douban:masterfrom
mckelvin:enhancement
May 8, 2015
Merged

Support set-command usage #1
mckelvin merged 10 commits into
douban:masterfrom
mckelvin:enhancement

Conversation

@mckelvin

@mckelvin mckelvin commented May 5, 2015

Copy link
Copy Markdown

ChangeLog:

  • Build using cmake instead of autotools
  • Fix IP header length
  • Fix TCP header offset
  • Support set-command usage (via -C set, for beansdb)
  • Only filter packet sent from the captured network device for get command, and vice versa for set command.

cc @youngsofun @zzl0

mckelvin and others added 4 commits May 5, 2015 12:20
The data offset field of a TCP header contains the number of words the
header is long (minimum 5).  Previously, this code assumed all TCP
headers were exactly 5 words long and would treat the TCP options as
payload. This patch makes the parser respect the data offset field and
start parsing data at the correct point.
@mckelvin

mckelvin commented May 5, 2015

Copy link
Copy Markdown
Author

@bmatheny I did not send the PR to the upstream since it's not active for a long time. Some commits in the PR are of personal favour (e.g.: use cmake instead of autotools). Please let me know if any of them should be sent to the upstream.

@mckelvin
mckelvin force-pushed the enhancement branch 2 times, most recently from 1527814 to 5903393 Compare May 5, 2015 06:36
Comment thread src/cli.cpp Outdated

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review! Please comment lgtm if the PR looks good to you.

diff --git a/README.md b/README.md
index 798c385..be9a603 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ Build Status: [![Build Status](https://travis-ci.org/bmatheny/memkeys.png?branch
         -r, --refresh=INTERVAL      Refresh the stats display every INTERVAL ms (default 500)
         -l, --logfile=FILE          Output logs to FILE
         -R, --report=REPORT         Output data in REPORT format (CSV or curses, default curses)
-        -C, --capture=CAPTRUE_TYPE  Capture memcached command type (set or get, default get)
+        -C, --capture=CAPTURE_TYPE  Capture memcached command type (set or get, default get)

         -h, --help                  This help
         -v, --verbose               Increase verbosity. May be used multiple times.
diff --git a/src/cli.cpp b/src/cli.cpp
index 4233d2f..f046707 100644
--- a/src/cli.cpp
+++ b/src/cli.cpp
@@ -54,7 +54,7 @@ string Cli::help(const char * progname) {
   txt << mkHelpDoc(
           longopts[9],
           "Capture memcached command type (set or get, default get)",
-          "CAPTRUE_TYPE");
+          "CAPTURE_TYPE");
   txt << endl;
   txt << mkHelpDoc(longopts[4], "This help", "");
   txt << mkHelpDoc(longopts[5],

rebased and pushed --force

@bmatheny

bmatheny commented May 5, 2015

Copy link
Copy Markdown

Please submit the non-build features upstream. I also don't think the address selection logic you have introduced is correct. If you're going to include the "Use default IP", please make it more generic. Either allow the user to specify an address on the command line, or don't include the change in the upstream pull request.

FWIW, not submitting because there hasn't been activity isn't a great reason. There would be activity if people submitted pull requests :)

@mckelvin

mckelvin commented May 5, 2015

Copy link
Copy Markdown
Author

@bmatheny Partial of these commits are from bmatheny#21 . Please consider merge that first. I'll check f433ef9 soon.

mckelvin added 2 commits May 5, 2015 16:17
There might be more than one IP addresses on a single network device.
The first IP provided by `pcap_findalldevs` will be used on default.
You can also specify an IPv4 address via the `-a`/`--address` param.
@mckelvin

mckelvin commented May 5, 2015

Copy link
Copy Markdown
Author

@bmatheny

I also don't think the address selection logic you have introduced is correct.

Agree. I can't find anything documentation about the order of the return value of pcap_findalldevs. cmd line parameter --address is added. Please review again.

@mckelvin

mckelvin commented May 8, 2015

Copy link
Copy Markdown
Author

I will send a corresponding PR to upstream soon.

mckelvin added a commit that referenced this pull request May 8, 2015
@mckelvin
mckelvin merged commit 3873fcb into douban:master May 8, 2015
@mckelvin
mckelvin deleted the enhancement branch May 8, 2015 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants