Bug 20907 - RFE: add option to specify all devices with '-i'
Summary: RFE: add option to specify all devices with '-i'
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: tcpdump
Version: 1.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Harald Hoyer
QA Contact:
URL:
Whiteboard:
Keywords: FutureFeature
Depends On:
Blocks: 20906
TreeView+ depends on / blocked
 
Reported: 2000-11-15 15:28 UTC by Enrico Scholz
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

(edit)
Clone Of:
(edit)
Last Closed: 2001-01-22 15:49:53 UTC


Attachments (Terms of Use)
fix -i behaviour and documentation plus minor odds and ends (2.17 KB, patch)
2000-12-30 22:41 UTC, Pekka Savola
no flags Details | Diff

Description Enrico Scholz 2000-11-15 15:28:11 UTC
Although tcpdump listens on all devices if called *without* '-i', there
doesn't exist a possibility to express such a request with '-i'. 

I think that's a bad style, because default values should be accessable at
the commandline also (e.g. to keep portability in scripts).

An

+	if ( device!=0 && (strcmp(device,"all")==0) ) device=0

shortly after the getopt()-while-switch clause in tcpdump.c would introduce
the 'all' keyword as synonym for 'all devices'.

Comment 1 Pekka Savola 2000-12-28 20:05:46 UTC
reminder: a man page change would also be necessary.

Comment 2 Pekka Savola 2000-12-30 22:39:47 UTC
This patch:

 * adds -i 'any' and 'all'.  'any' looks up an interface using the old algorithm.  
'all' tries to use all interfaces (no error message if used in -R where it wouldn't work).

 * changes default behaviour for -R so that 'any' is assumed (no need to always use -i anymore).

 * document some stuff in -i and -p, fix a typo.

---
       -i     Listen on interface.  Special keywords ``all'' or ``any'' may also be used.
              ``all'' is effective only in default, packet socket  mode.   ``any''  means
              that  tcpdump  searches  the system interface list for the lowest numbered,
              configured up interface (excluding loopback).  Ties are broken by  choosing
              the  earliest  match.   The default is ``all'' in packet and ``any'' in raw
              socket mode.
[...]
       -p     Do put the interface into promiscuous mode.  Note that legacy mode  was  to
              use  promiscuous mode by default.  tcpdump can only listen to one interface
              in promiscuous mode.  Also note that the interface might be in  promiscuous
              mode for some other reason.
---


Comment 3 Pekka Savola 2000-12-30 22:41:07 UTC
Created attachment 6862 [details]
fix -i behaviour and documentation plus minor odds and ends

Comment 4 Pekka Savola 2000-12-31 00:50:23 UTC
It seems tcpdump.org has semantics where 'any' mean "all".  In the hindsight, for the future 
compatibility it would probably be better make all and any synonyms and use something
like 'one' for the algorithm.  Oh well.


Comment 5 Pekka Savola 2000-12-31 14:45:17 UTC
Changed the behaviour in patches above to 'any' and 'one' as the patch had to be modified anyway for
another reason.



Note You need to log in before you can comment on or make changes to this bug.