Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
128efaa9
Commit
128efaa9
authored
Jun 18, 2018
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -M option for optional mask.
parent
8bd8d4c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
utils/addinterface.in
utils/addinterface.in
+10
-1
No files found.
utils/addinterface.in
View file @
128efaa9
...
@@ -43,6 +43,7 @@ sub usage()
...
@@ -43,6 +43,7 @@ sub usage()
print
STDERR
"
-r - Delete interface
\n
";
print
STDERR
"
-r - Delete interface
\n
";
print
STDERR
"
-f - (with -r) force deletion, even if iface used
\n
";
print
STDERR
"
-f - (with -r) force deletion, even if iface used
\n
";
print
STDERR
"
-I IP - Optional IP address (as for control iface)
\n
";
print
STDERR
"
-I IP - Optional IP address (as for control iface)
\n
";
print
STDERR
"
-M Mask - IP Mask, defaults to 255.255.255.0
\n
";
print
STDERR
"
-e role - Optional interface role, default to 'other'
\n
";
print
STDERR
"
-e role - Optional interface role, default to 'other'
\n
";
print
STDERR
"
-m mac - Optional MAC address. 0123456789AB format.
\n
";
print
STDERR
"
-m mac - Optional MAC address. 0123456789AB format.
\n
";
print
STDERR
"
-b speed - Interface speed; 100Mb,1Gb,10Gb,40Gb,100Gb
\n
";
print
STDERR
"
-b speed - Interface speed; 100Mb,1Gb,10Gb,40Gb,100Gb
\n
";
...
@@ -50,13 +51,14 @@ sub usage()
...
@@ -50,13 +51,14 @@ sub usage()
print
STDERR
"
iface_id - eth0, eth1, 1/69, 1.6:1, Po4.5/9:1, etc.
\n
";
print
STDERR
"
iface_id - eth0, eth1, 1/69, 1.6:1, Po4.5/9:1, etc.
\n
";
exit
(
-
1
);
exit
(
-
1
);
}
}
my
$optlist
=
"
b:t:nvfm:re:iI:
";
my
$optlist
=
"
b:t:nvfm:re:iI:
M:
";
my
$verbose
=
0
;
my
$verbose
=
0
;
my
$impotent
=
0
;
my
$impotent
=
0
;
my
$remove
=
0
;
my
$remove
=
0
;
my
$info
=
0
;
my
$info
=
0
;
my
$force
=
0
;
my
$force
=
0
;
my
$IP
;
my
$IP
;
my
$MASK
;
my
$speed
;
my
$speed
;
my
$type
;
my
$type
;
my
$mac
=
"
000000000000
";
my
$mac
=
"
000000000000
";
...
@@ -136,6 +138,12 @@ if (defined($options{'I'})) {
...
@@ -136,6 +138,12 @@ if (defined($options{'I'})) {
fatal
("
Invalid IP format
");
fatal
("
Invalid IP format
");
}
}
}
}
if
(
defined
(
$options
{'
M
'}))
{
$MASK
=
$options
{'
M
'};
if
(
$MASK
!~
/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/
)
{
fatal
("
Invalid IP mask format
");
}
}
if
(
defined
(
$options
{'
m
'}))
{
if
(
defined
(
$options
{'
m
'}))
{
$mac
=
$options
{'
m
'};
$mac
=
$options
{'
m
'};
if
(
$mac
!~
/^\w\w\w\w\w\w\w\w\w\w\w\w$/
)
{
if
(
$mac
!~
/^\w\w\w\w\w\w\w\w\w\w\w\w$/
)
{
...
@@ -199,6 +207,7 @@ my $ifaceargs = {
...
@@ -199,6 +207,7 @@ my $ifaceargs = {
"
max_speed
"
=>
$type
->
max_speed
()
/
1000
,
"
max_speed
"
=>
$type
->
max_speed
()
/
1000
,
"
mac
"
=>
$mac
,
"
mac
"
=>
$mac
,
"
IP
"
=>
$IP
,
"
IP
"
=>
$IP
,
"
mask
"
=>
$MASK
,
};
};
if
(
$verbose
||
$impotent
)
{
if
(
$verbose
||
$impotent
)
{
if
(
$verbose
)
{
if
(
$verbose
)
{
...
...
Write
Preview
Markdown
is supported
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