aboutsummaryrefslogtreecommitdiffstats
path: root/inet.c
diff options
context:
space:
mode:
authorguy <guy>2001-10-28 02:31:49 +0000
committerguy <guy>2001-10-28 02:31:49 +0000
commitdb79c691088d0c5fa5dd04f3959b979a7648ca60 (patch)
tree0c436ab37f300b316f7a3b633407f25c1c653f23 /inet.c
parentc3736d4ff82fd9e56f69b56360a3081cf393edb2 (diff)
Make the "is_loopback" field of a "pcap_if" structure a general "flags"
field, and make a PCAP_IF_LOOPBACK flag be the first flag bit in that field, specifying whether the interface is a loopback interface; this allows us to add more flags without changing the layout of the structure.
Diffstat (limited to 'inet.c')
-rw-r--r--inet.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/inet.c b/inet.c
index 8523dde..f5e88f1 100644
--- a/inet.c
+++ b/inet.c
@@ -34,7 +34,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.42 2001-10-10 06:46:50 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/inet.c,v 1.43 2001-10-28 02:31:49 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -198,7 +198,9 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, char *name,
strcpy(curdev->name, name);
curdev->description = NULL; /* not available */
curdev->addresses = NULL; /* list starts out as empty */
- curdev->is_loopback = ISLOOPBACK(name, flags);
+ curdev->flags = 0;
+ if (ISLOOPBACK(name, flags))
+ curdev->flags |= PCAP_IF_LOOPBACK;
/*
* Add it to the list, in the appropriate location.
@@ -245,7 +247,8 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, char *name,
* Is the new interface a non-loopback interface
* and the next interface a loopback interface?
*/
- if (!curdev->is_loopback && nextdev->is_loopback) {
+ if (!(curdev->flags & PCAP_IF_LOOPBACK) &&
+ (nextdev->flags & PCAP_IF_LOOPBACK)) {
/*
* Yes, we should put the new entry
* before "nextdev", i.e. after "prevdev".
@@ -267,7 +270,8 @@ add_or_find_if(pcap_if_t **curdev_ret, pcap_if_t **alldevs, char *name,
* loopback interfaces.)
*/
if (this_instance < get_instance(nextdev->name) &&
- (!curdev->is_loopback || nextdev->is_loopback)) {
+ (!(curdev->flags & PCAP_IF_LOOPBACK) ||
+ (nextdev->flags & PCAP_IF_LOOPBACK))) {
/*
* Yes - we should put the new entry
* before "nextdev", i.e. after "prevdev".
@@ -943,7 +947,7 @@ pcap_lookupdev(errbuf)
if (pcap_findalldevs(&alldevs, errbuf) == -1)
return (NULL);
- if (alldevs == NULL || alldevs->is_loopback) {
+ if (alldevs == NULL || (alldevs->flags & PCAP_IF_LOOPBACK)) {
/*
* There are no devices on the list, or the first device
* on the list is a loopback device, which means there