cluster: STABLE2 - dlm: Allow dlm_tcpdump & dlmtop to select network interface
Christine Caulfield
chrissie@fedoraproject.org
Wed May 20 15:10:00 GMT 2009
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=32467b220a4bf6aa08eb861d3595b860572cf5f3
Commit: 32467b220a4bf6aa08eb861d3595b860572cf5f3
Parent: bce26b94b8598ee7fa14df49f79980af3b548cd9
Author: Christine Caulfield <ccaulfie@redhat.com>
AuthorDate: Wed May 20 16:09:32 2009 +0100
Committer: Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Wed May 20 16:09:32 2009 +0100
dlm: Allow dlm_tcpdump & dlmtop to select network interface
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
dlm/tests/tcpdump/dlm_tcpdump.c | 10 ++++++++--
dlm/tests/tcpdump/dlmtop.c | 16 +++++++++++-----
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/dlm/tests/tcpdump/dlm_tcpdump.c b/dlm/tests/tcpdump/dlm_tcpdump.c
index 6953aef..ab7a162 100644
--- a/dlm/tests/tcpdump/dlm_tcpdump.c
+++ b/dlm/tests/tcpdump/dlm_tcpdump.c
@@ -10,6 +10,7 @@
* v0.4 Add RHEL5 support(untested)
* v0.5 Fix bug that caused us to loop if length was zero (why??)
* v0.6 Show full command-line and timestamps (djuran)
+* v0.7 Allow ethernet interface to be set via command-line
*
**********************************************************************/
@@ -335,11 +336,16 @@ int main(int argc,char **argv)
signal(SIGINT, finish_up);
- /* has table for lock info */
+ /* hash table for lock info */
hcreate(100000);
/* grab a device to peak into... */
- dev = pcap_lookupdev(errbuf);
+ if (argc>1) {
+ dev=argv[1];
+ } else {
+ dev = pcap_lookupdev(errbuf);
+ }
+
if(dev == NULL)
{ fprintf(stderr,"%s\n",errbuf); exit(1); }
diff --git a/dlm/tests/tcpdump/dlmtop.c b/dlm/tests/tcpdump/dlmtop.c
index 1698c06..df06eb9 100644
--- a/dlm/tests/tcpdump/dlmtop.c
+++ b/dlm/tests/tcpdump/dlmtop.c
@@ -533,6 +533,7 @@ static void usage(char *cmd, FILE *f)
fprintf(f, " -l Sort by lock operations (default)\n");
fprintf(f, " -a Show accumulated counters rather than per <interval> operations\n");
fprintf(f, " -i <secs> Set the refresh interval (default 1 second)\n");
+ fprintf(f, " -I <name> Select the network interface to listen on)\n");
fprintf(f, " -p <port> Change the TCP port to listen on (default 21064)\n");
fprintf(f, " -d[ddd] Enable/increase debugging messages to stderr\n");
fprintf(f, " -h Show this help message\n");
@@ -541,7 +542,7 @@ static void usage(char *cmd, FILE *f)
int main(int argc,char **argv)
{
- char *dev;
+ char *dev=NULL;
char errbuf[PCAP_ERRBUF_SIZE];
char bpf_text[132];
pcap_t* descr;
@@ -553,7 +554,7 @@ int main(int argc,char **argv)
/* Deal with command-line arguments */
opterr = 0;
optind = 0;
- while ((opt=getopt(argc,argv,"?hVrladi:p:")) != EOF)
+ while ((opt=getopt(argc,argv,"?hVrladi:p:I:")) != EOF)
{
switch(opt)
{
@@ -579,6 +580,9 @@ int main(int argc,char **argv)
sprintf(bpf_text, "port %d", atoi(optarg));
dlm_filter = bpf_text;
break;
+ case 'I':
+ dev = strdup(optarg);
+ break;
case 'd':
debug++;
break;
@@ -609,9 +613,11 @@ int main(int argc,char **argv)
memset(remote_procs, 0, sizeof(remote_procs));
/* grab a device to peek into... */
- dev = pcap_lookupdev(errbuf);
- if(dev == NULL)
- { fprintf(stderr,"%s\n",errbuf); exit(1); }
+ if (!dev) {
+ dev = pcap_lookupdev(errbuf);
+ if(dev == NULL)
+ { fprintf(stderr,"%s\n",errbuf); exit(1); }
+ }
/* open device for reading this time lets set it in promiscuous
* mode so we can monitor traffic to another machine */
More information about the Cluster-cvs
mailing list