gluon-client-bridge: don't depend on luci.ip
This commit is contained in:
parent
e665bfe64a
commit
80de4a69e3
@ -4,15 +4,14 @@ local site = require 'gluon.site_config'
|
|||||||
local sysconfig = require 'gluon.sysconfig'
|
local sysconfig = require 'gluon.sysconfig'
|
||||||
local util = require 'gluon.util'
|
local util = require 'gluon.util'
|
||||||
|
|
||||||
local ip = require 'luci.ip'
|
|
||||||
local uci = require('simple-uci').cursor()
|
local uci = require('simple-uci').cursor()
|
||||||
|
|
||||||
|
|
||||||
local ip4, netmask, ip6
|
local ip4, ip6
|
||||||
|
|
||||||
if site.next_node.ip4 then
|
if site.next_node.ip4 then
|
||||||
ip4 = site.next_node.ip4
|
local plen = site.prefix4:match('/%d+$')
|
||||||
netmask = ip.IPv4(site.prefix4):mask():string()
|
ip4 = site.next_node.ip4 .. plen
|
||||||
end
|
end
|
||||||
|
|
||||||
if site.next_node.ip6 then
|
if site.next_node.ip6 then
|
||||||
@ -25,7 +24,6 @@ uci:section('network', 'interface', 'client',
|
|||||||
proto = 'static',
|
proto = 'static',
|
||||||
macaddr = site.next_node.mac,
|
macaddr = site.next_node.mac,
|
||||||
ipaddr = ip4,
|
ipaddr = ip4,
|
||||||
netmask = netmask,
|
|
||||||
ip6addr = ip6,
|
ip6addr = ip6,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -33,6 +31,7 @@ uci:section('network', 'interface', 'client',
|
|||||||
uci:delete('network', 'client', 'reqprefix')
|
uci:delete('network', 'client', 'reqprefix')
|
||||||
uci:delete('network', 'client', 'peerdns')
|
uci:delete('network', 'client', 'peerdns')
|
||||||
uci:delete('network', 'client', 'sourcefilter')
|
uci:delete('network', 'client', 'sourcefilter')
|
||||||
|
uci:delete('network', 'client', 'netmask')
|
||||||
|
|
||||||
|
|
||||||
local interfaces = uci:get('network', 'client', 'ifname') or {}
|
local interfaces = uci:get('network', 'client', 'ifname') or {}
|
||||||
|
Loading…
Reference in New Issue
Block a user