Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
cfbcc72a
Commit
cfbcc72a
authored
May 25, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interfaces: manually backport
b676a002
parent
d44f11fe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
4 deletions
+37
-4
interfaces.lib.inc
src/etc/inc/interfaces.lib.inc
+37
-4
No files found.
src/etc/inc/interfaces.lib.inc
View file @
cfbcc72a
...
@@ -260,10 +260,13 @@ function configure_interface_hardware($ifs)
...
@@ -260,10 +260,13 @@ function configure_interface_hardware($ifs)
}
}
}
}
function
legacy_getall_interface_addresses
(
$ifs
)
function
_
legacy_getall_interface_addresses
(
$ifs
)
{
{
$cmd
=
'/sbin/ifconfig '
.
escapeshellarg
(
$ifs
);
$cmd
=
'/sbin/ifconfig '
.
escapeshellarg
(
$ifs
);
$addrs
=
array
();
$addrs
=
array
(
'macaddr'
=>
'00:00:00:00:00:00'
,
'compat'
=>
array
(),
);
exec
(
$cmd
.
' 2>&1'
,
$out
,
$ret
);
exec
(
$cmd
.
' 2>&1'
,
$out
,
$ret
);
if
(
$ret
)
{
if
(
$ret
)
{
...
@@ -281,10 +284,27 @@ function legacy_getall_interface_addresses($ifs)
...
@@ -281,10 +284,27 @@ function legacy_getall_interface_addresses($ifs)
switch
(
trim
(
$stat
[
0
]))
{
switch
(
trim
(
$stat
[
0
]))
{
case
'inet'
:
case
'inet'
:
$mask
=
substr_count
(
base_convert
(
hexdec
(
$stat
[
3
]),
10
,
2
),
'1'
);
$mask
=
substr_count
(
base_convert
(
hexdec
(
$stat
[
3
]),
10
,
2
),
'1'
);
$addrs
[]
=
$stat
[
1
]
.
'/'
.
$mask
;
$addrs
[
'compat'
][]
=
$stat
[
1
]
.
'/'
.
$mask
;
if
(
!
isset
(
$addrs
[
'ipaddr'
]))
{
$addrs
[
'ipaddr'
]
=
$stat
[
1
];
$addrs
[
'subnetbits'
]
=
$mask
;
}
break
;
break
;
case
'inet6'
:
case
'inet6'
:
$addrs
[]
=
strtok
(
$stat
[
1
],
'%'
)
.
'/'
.
$stat
[
3
];
$addr
=
strtok
(
$stat
[
1
],
'%'
);
if
(
!
isset
(
$addrs
[
'ipaddr6'
])
&&
strpos
(
$addr
,
'fe80:'
)
!==
0
)
{
/* does not pick up link-local */
$addrs
[
'ipaddr6'
]
=
$addr
;
for
(
$i
=
0
;
$i
<
count
(
$stat
);
++
$i
)
{
if
(
$stat
[
$i
]
==
'prefixlen'
)
{
$addrs
[
'subnetbits6'
]
=
intval
(
$stat
[
$i
+
1
]);
}
}
}
$addrs
[
'compat'
][]
=
$addr
.
'/'
.
$addrs
[
'subnetbits6'
];
break
;
case
'ether'
:
$addrs
[
'macaddr'
]
=
$stat
[
1
];
break
;
break
;
default
:
default
:
/* not relevant to our interest */
/* not relevant to our interest */
...
@@ -296,3 +316,16 @@ function legacy_getall_interface_addresses($ifs)
...
@@ -296,3 +316,16 @@ function legacy_getall_interface_addresses($ifs)
return
$addrs
;
return
$addrs
;
}
}
function
legacy_getall_interface_addresses
(
$ifs
)
{
$addrs
=
_legacy_getall_interface_addresses
(
$ifs
);
return
$addrs
[
'compat'
];
}
function
legacy_get_interface_addresses
(
$ifs
)
{
$addrs
=
_legacy_getall_interface_addresses
(
$ifs
);
unset
(
$addrs
[
'compat'
]);
return
$addrs
;
}
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