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
5adfd6bf
Commit
5adfd6bf
authored
Feb 24, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interfaces: replace netgraph functions with portable alternatives
parent
124a7809
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
9 deletions
+25
-9
Makefile
Makefile
+1
-0
interfaces.inc
src/etc/inc/interfaces.inc
+5
-5
interfaces.lib.inc
src/etc/inc/interfaces.lib.inc
+16
-1
vpn.inc
src/etc/inc/plugins.inc.d/vpn.inc
+3
-3
No files found.
Makefile
View file @
5adfd6bf
...
...
@@ -67,6 +67,7 @@ CORE_DEPENDS?= apinger \
miniupnpd
\
mpd4
\
mpd5
\
ngattach
\
ntp
\
openssh-portable
\
openvpn
\
...
...
src/etc/inc/interfaces.inc
View file @
5adfd6bf
...
...
@@ -202,7 +202,7 @@ function interface_netgraph_needed($interface = "wan")
if
(
!
$found
)
{
$realif
=
get_real_interface
(
$interface
);
mwexecf
(
'/usr/sbin/ngctl msg %s: detach'
,
array
(
$realif
)
);
legacy_netgraph_detach
(
$realif
);
}
}
...
...
@@ -293,7 +293,7 @@ function interface_vlan_configure(&$vlan)
}
else
{
$tmpvlanif
=
legacy_interface_create
(
'vlan'
);
legacy_interface_rename
(
$tmpvlanif
,
$vlanif
);
mwexecf
(
'/usr/sbin/ngctl name %s: %s'
,
array
(
$tmpvlanif
,
$vlanif
)
);
legacy_netgraph_rename
(
$tmpvlanif
,
$vlanif
);
}
legacy_vlan_tag
(
$vlanif
,
$if
,
$tag
);
...
...
@@ -338,8 +338,8 @@ function interface_qinq_configure(&$vlan, $fd = null)
/* make sure the parent is converted to ng_vlan(4) and is up */
interfaces_bring_up
(
$qinqif
);
legacy_netgraph_attach
(
$qinqif
);
pfSense_ngctl_attach
(
"."
,
$qinqif
);
if
(
!
empty
(
$vlanif
)
&&
does_interface_exist
(
$vlanif
))
{
fwrite
(
$fd
,
"shutdown
{
$qinqif
}
qinq:
\n
"
);
exec
(
"/usr/sbin/ngctl msg
{
$qinqif
}
qinq: gettable"
,
$result
);
...
...
@@ -1608,7 +1608,7 @@ function interface_ppps_configure($interface)
case
"pppoe"
:
/* Bring the parent interface up */
interfaces_bring_up
(
$port
);
pfSense_ngctl_attach
(
"."
,
$port
);
legacy_netgraph_attach
(
$port
);
/* Enable setautosrc to automatically change mac address if parent interface's changes */
mwexecf
(
'/usr/sbin/ngctl msg %s: setautosrc 1'
,
array
(
$port
));
break
;
...
...
@@ -1631,7 +1631,7 @@ function interface_ppps_configure($interface)
log_error
(
sprintf
(
gettext
(
'Could not get a PPTP/L2TP Remote IP address from %s for %s in interfaces_ppps_configure.'
),
$dhcp_gateway
,
$gway
));
return
0
;
}
pfSense_ngctl_attach
(
"."
,
$port
);
legacy_netgraph_attach
(
$port
);
break
;
case
"ppp"
:
if
(
!
file_exists
(
"
{
$port
}
"
))
{
...
...
src/etc/inc/interfaces.lib.inc
View file @
5adfd6bf
<?php
/*
Copyright (c) 2015 Franco Fichtner <franco@opnsense.org>
Copyright (c) 2015
-2016
Franco Fichtner <franco@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
...
...
@@ -199,3 +199,18 @@ function legacy_interface_details($intf)
}
return
$result
;
}
function
legacy_netgraph_attach
(
$ifs
)
{
mwexecf
(
'/usr/local/sbin/ngattach %s'
,
array
(
$ifs
));
}
function
legacy_netgraph_detach
(
$ifs
)
{
mwexecf
(
'/usr/sbin/ngctl msg %s: detach'
,
array
(
$ifs
));
}
function
legacy_netgraph_rename
(
$tmpifs
,
$ifs
)
{
mwexecf
(
'/usr/sbin/ngctl name %s: %s'
,
array
(
$tmpifs
,
$ifs
));
}
src/etc/inc/plugins.inc.d/vpn.inc
View file @
5adfd6bf
...
...
@@ -310,7 +310,7 @@ EOD;
chmod
(
'/var/etc/pptp-vpn/mpd.secret'
,
0600
);
/* fixed to WAN elsewhere, no need to extend, but at least make it work */
pfSense_ngctl_attach
(
'.'
,
get_real_interface
(
'wan'
));
legacy_netgraph_attach
(
get_real_interface
(
'wan'
));
mwexec
(
'/usr/local/sbin/mpd4 -b -d /var/etc/pptp-vpn -p /var/run/pptp-vpn.pid -s pptps pptps'
);
...
...
@@ -557,7 +557,7 @@ EOD;
killbypid
(
"/var/run/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn.pid"
);
pfSense_ngctl_attach
(
"."
,
$pppoe_interface
);
legacy_netgraph_attach
(
$pppoe_interface
);
mwexec
(
"/usr/local/sbin/mpd4 -b -d /var/etc/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn -p /var/run/pppoe
{
$pppoecfg
[
'pppoeid'
]
}
-vpn.pid -s poes poes"
);
...
...
@@ -747,7 +747,7 @@ EOD;
unset
(
$mpdsecret
);
chmod
(
'/var/etc/l2tp-vpn/mpd.secret'
,
0600
);
pfSense_ngctl_attach
(
'.'
,
get_real_interface
(
$l2tpcfg
[
'interface'
]));
legacy_netgraph_attach
(
get_real_interface
(
$l2tpcfg
[
'interface'
]));
mwexec
(
'/usr/local/sbin/mpd4 -b -d /var/etc/l2tp-vpn -p /var/run/l2tp-vpn.pid -s l2tps l2tps'
);
...
...
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