mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 08:09:41 +00:00
interfaces: replace netgraph functions with portable alternatives
This commit is contained in:
parent
124a7809eb
commit
5adfd6bf12
1
Makefile
1
Makefile
@ -67,6 +67,7 @@ CORE_DEPENDS?= apinger \
|
||||
miniupnpd \
|
||||
mpd4 \
|
||||
mpd5 \
|
||||
ngattach \
|
||||
ntp \
|
||||
openssh-portable \
|
||||
openvpn \
|
||||
|
||||
@ -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}")) {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?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));
|
||||
}
|
||||
|
||||
@ -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');
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user