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
2533e110
Commit
2533e110
authored
Apr 28, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interfaces: portable alternative for php module function
BTW: 5000 commits on master branch, yay, party!
parent
6e5fbbc9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
3 deletions
+40
-3
interfaces.lib.inc
src/etc/inc/interfaces.lib.inc
+40
-3
No files found.
src/etc/inc/interfaces.lib.inc
View file @
2533e110
...
@@ -210,17 +210,17 @@ function legacy_interface_details($intf)
...
@@ -210,17 +210,17 @@ function legacy_interface_details($intf)
function
legacy_netgraph_attach
(
$ifs
)
function
legacy_netgraph_attach
(
$ifs
)
{
{
mwexecf
(
'/usr/local/sbin/ngattach %s'
,
array
(
$ifs
));
mwexecf
(
'/usr/local/sbin/ngattach %s'
,
array
(
$ifs
));
}
}
function
legacy_netgraph_detach
(
$ifs
)
function
legacy_netgraph_detach
(
$ifs
)
{
{
mwexecf
(
'/usr/sbin/ngctl msg %s: detach'
,
array
(
$ifs
),
true
);
mwexecf
(
'/usr/sbin/ngctl msg %s: detach'
,
array
(
$ifs
),
true
);
}
}
function
legacy_netgraph_rename
(
$tmpifs
,
$ifs
)
function
legacy_netgraph_rename
(
$tmpifs
,
$ifs
)
{
{
mwexecf
(
'/usr/sbin/ngctl name %s: %s'
,
array
(
$tmpifs
,
$ifs
));
mwexecf
(
'/usr/sbin/ngctl name %s: %s'
,
array
(
$tmpifs
,
$ifs
));
}
}
/**
/**
...
@@ -259,3 +259,40 @@ function configure_interface_hardware($ifs)
...
@@ -259,3 +259,40 @@ function configure_interface_hardware($ifs)
}
}
}
}
}
}
function
legacy_getall_interface_addresses
(
$ifs
)
{
$cmd
=
'/sbin/ifconfig '
.
escapeshellarg
(
$ifs
);
$addrs
=
array
();
exec
(
$cmd
.
' 2>&1'
,
$out
,
$ret
);
if
(
$ret
)
{
log_error
(
'The command `'
.
$cmd
.
'\' failed to execute'
);
return
$stats
;
}
if
(
count
(
$out
))
{
foreach
(
$out
as
$line
)
{
if
(
$line
[
0
]
!=
"
\t
"
)
{
continue
;
}
$stat
=
explode
(
' '
,
$line
);
if
(
isset
(
$stat
[
0
]))
{
switch
(
trim
(
$stat
[
0
]))
{
case
'inet'
:
$mask
=
substr_count
(
base_convert
(
hexdec
(
$stat
[
3
]),
10
,
2
),
'1'
);
$addrs
[]
=
$stat
[
1
]
.
'/'
.
$mask
;
break
;
case
'inet6'
:
$addrs
[]
=
strtok
(
$stat
[
1
],
'%'
)
.
'/'
.
$stat
[
3
];
break
;
default
:
/* not relevant to our interest */
break
;
}
}
}
}
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