Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
b6b420e4
Commit
b6b420e4
authored
May 31, 2016
by
Mike Hibler
Browse files
Allow command line MAC address to contain ':', '-', and '.' chars.
parent
36576e99
Changes
1
Hide whitespace changes
Inline
Side-by-side
clientside/tmcc/findif.c
View file @
b6b420e4
...
...
@@ -103,6 +103,8 @@ int
main
(
int
argc
,
char
**
argv
)
{
int
ch
;
char
*
addr
;
char
macstr
[
13
];
while
((
ch
=
getopt
(
argc
,
argv
,
"im"
))
!=
-
1
)
{
switch
(
ch
)
{
...
...
@@ -121,7 +123,30 @@ main(int argc, char **argv)
if
(
argc
!=
1
)
usage
();
exit
(
find_iface
(
argv
[
0
]));
addr
=
argv
[
0
];
/*
* XXX accept MACs in a variety of flavors:
* 3cfdfe027864
* 3c:fd:fe:02:78:64
* 3c-fd-fe-02-78-64
* 3cfd.fe02.7864
*/
if
(
addrtype
==
ADDR_MAC
)
{
char
*
cp
;
int
n
=
0
;
for
(
cp
=
addr
;
*
cp
&&
n
<
sizeof
(
macstr
)
-
1
;
cp
++
)
{
if
(
*
cp
==
':'
||
*
cp
==
'-'
||
*
cp
==
'.'
)
continue
;
macstr
[
n
]
=
*
cp
;
n
++
;
}
macstr
[
n
]
=
'\0'
;
addr
=
macstr
;
}
exit
(
find_iface
(
addr
));
}
#ifdef __FreeBSD__
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment