summaryrefslogtreecommitdiff
path: root/nametoaddr.c
diff options
context:
space:
mode:
authorguy <guy>2008-02-06 10:21:30 +0000
committerguy <guy>2008-02-06 10:21:30 +0000
commitf8f7ec5ace38a0fa46606901b237146f9f9b1bbb (patch)
treeaaa82bbbc551a9c7155ba1966edc40e401b4ef5b /nametoaddr.c
parent26504998e7cc5b3cf13b77c6ba55d7ac288a98f4 (diff)
downloadlibpcap-f8f7ec5ace38a0fa46606901b237146f9f9b1bbb.tar.gz
From Arien Vijn: support various notions for MAC addresses.
Diffstat (limited to 'nametoaddr.c')
-rw-r--r--nametoaddr.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/nametoaddr.c b/nametoaddr.c
index 0ba6c997..5203e514 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.82 2007-06-11 10:04:25 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.83 2008-02-06 10:21:30 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -398,7 +398,15 @@ __pcap_atodn(const char *s, bpf_u_int32 *addr)
}
/*
- * Convert 's' which has the form "xx:xx:xx:xx:xx:xx" into a new
+ * Convert 's', which can have the one of the forms:
+ *
+ * "xx:xx:xx:xx:xx:xx"
+ * "xx.xx.xx.xx.xx.xx"
+ * "xx-xx-xx-xx-xx-xx"
+ * "xxxx.xxxx.xxxx"
+ * "xxxxxxxxxxxx"
+ *
+ * (or various mixes of ':', '.', and '-') into a new
* ethernet address. Assumes 's' is well formed.
*/
u_char *
@@ -410,7 +418,7 @@ pcap_ether_aton(const char *s)
e = ep = (u_char *)malloc(6);
while (*s) {
- if (*s == ':')
+ if (*s == ':' || *s == '.' || *s == '-')
s += 1;
d = xdtoi(*s++);
if (isxdigit((unsigned char)*s)) {