diff options
-rw-r--r-- | gencode.c | 9 | ||||
-rw-r--r-- | nametoaddr.c | 26 | ||||
-rw-r--r-- | pcap-namedb.h | 3 |
3 files changed, 33 insertions, 5 deletions
@@ -21,7 +21,7 @@ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.219 2005-02-08 19:52:18 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.220 2005-03-17 07:02:31 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -3380,8 +3380,11 @@ lookup_proto(name, proto) case Q_LINK: /* XXX should look up h/w protocol type based on linktype */ v = pcap_nametoeproto(name); - if (v == PROTO_UNDEF) - bpf_error("unknown ether proto '%s'", name); + if (v == PROTO_UNDEF) { + v = pcap_nametollc(name); + if (v == PROTO_UNDEF) + bpf_error("unknown ether proto '%s'", name); + } break; case Q_ISO: diff --git a/nametoaddr.c b/nametoaddr.c index 02f1b48d..b6c6a66a 100644 --- a/nametoaddr.c +++ b/nametoaddr.c @@ -24,7 +24,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.73 2003-12-24 09:14:21 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.74 2005-03-17 07:02:32 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -268,6 +268,30 @@ pcap_nametoeproto(const char *s) return PROTO_UNDEF; } +#include "llc.h" + +/* Static data base of LLC values. */ +static struct eproto llc_db[] = { + { "iso", LLCSAP_ISONS }, + { "stp", LLCSAP_8021D }, + { "ipx", LLCSAP_IPX }, + { "netbeui", LLCSAP_NETBEUI }, + { (char *)0, 0 } +}; + +int +pcap_nametollc(const char *s) +{ + struct eproto *p = llc_db; + + while (p->s != 0) { + if (strcmp(p->s, s) == 0) + return p->p; + p += 1; + } + return PROTO_UNDEF; +} + /* Hex digit to integer. */ static inline int xdtoi(c) diff --git a/pcap-namedb.h b/pcap-namedb.h index 8ecd9e1f..ba02ee0f 100644 --- a/pcap-namedb.h +++ b/pcap-namedb.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#) $Header: /tcpdump/master/libpcap/pcap-namedb.h,v 1.9 2004-12-19 19:48:37 guy Exp $ (LBL) + * @(#) $Header: /tcpdump/master/libpcap/pcap-namedb.h,v 1.10 2005-03-17 07:02:32 guy Exp $ (LBL) */ #ifndef lib_pcap_namedb_h @@ -67,6 +67,7 @@ bpf_u_int32 pcap_nametonetaddr(const char *); int pcap_nametoport(const char *, int *, int *); int pcap_nametoproto(const char *); int pcap_nametoeproto(const char *); +int pcap_nametollc(const char *); /* * If a protocol is unknown, PROTO_UNDEF is returned. * Also, pcap_nametoport() returns the protocol along with the port number. |