Backported conntrack page
This commit is contained in:
parent
c8170941b9
commit
fa40172915
11 changed files with 102 additions and 2 deletions
|
@ -163,6 +163,8 @@ dhcp_dnsmasq_dhcpleasemax = '<abbr title="maximal">max.</abbr> <abbr title="Dyna
|
|||
dhcp_dnsmasq_addnhosts = 'additional hostfile'
|
||||
dhcp_dnsmasq_queryport = 'query port'
|
||||
a_n_switch = 'Switch'
|
||||
a_n_conntrack = 'Active Connections'
|
||||
a_n_conntrack_desc = 'This page gives an overview over currently active network connections.'
|
||||
a_n_routes = 'Routes'
|
||||
a_network1 = 'In this area you find all network-related settings.'
|
||||
a_network2 = 'On most routers the network switch can be freely configured and splitted up into several <abbr title="Virtual Local Area Network">VLAN</abbr>s.'
|
||||
|
|
|
@ -167,6 +167,8 @@
|
|||
<i18n:msg xml:id="dhcp_dnsmasq_addnhosts">additional hostfile</i18n:msg>
|
||||
<i18n:msg xml:id="dhcp_dnsmasq_queryport">query port</i18n:msg>
|
||||
<i18n:msg xml:id="a_n_switch">Switch</i18n:msg>
|
||||
<i18n:msg xml:id="a_n_conntrack">Active Connections</i18n:msg>
|
||||
<i18n:msg xml:id="a_n_conntrack_desc">This page gives an overview over currently active network connections.</i18n:msg>
|
||||
<i18n:msg xml:id="a_n_routes">Routes</i18n:msg>
|
||||
<i18n:msg xml:id="a_network1">In this area you find all network-related settings.</i18n:msg>
|
||||
<i18n:msg xml:id="a_network2">On most routers the network switch can be freely configured and splitted up into several <abbr title="Virtual Local Area Network">VLAN</abbr>s.</i18n:msg>
|
||||
|
|
|
@ -17,6 +17,7 @@ confirmation = 'Confirmation'
|
|||
delete = 'Delete'
|
||||
descr = 'Description'
|
||||
design = 'Design'
|
||||
destination = 'Destination'
|
||||
device = 'Device'
|
||||
devices = 'Devices'
|
||||
disable = 'disable'
|
||||
|
@ -75,6 +76,7 @@ service = 'Service'
|
|||
services = 'Services'
|
||||
settings = 'Settings'
|
||||
size = 'Size'
|
||||
source = 'Source'
|
||||
start = 'Start'
|
||||
static = 'static'
|
||||
status = 'Status'
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<i18n:msg xml:id="delete">Delete</i18n:msg>
|
||||
<i18n:msg xml:id="descr">Description</i18n:msg>
|
||||
<i18n:msg xml:id="design">Design</i18n:msg>
|
||||
<i18n:msg xml:id="destination">Destination</i18n:msg>
|
||||
<i18n:msg xml:id="device">Device</i18n:msg>
|
||||
<i18n:msg xml:id="devices">Devices</i18n:msg>
|
||||
<i18n:msg xml:id="disable">disable</i18n:msg>
|
||||
|
@ -80,6 +81,7 @@
|
|||
<i18n:msg xml:id="services">Services</i18n:msg>
|
||||
<i18n:msg xml:id="settings">Settings</i18n:msg>
|
||||
<i18n:msg xml:id="size">Size</i18n:msg>
|
||||
<i18n:msg xml:id="source">Source</i18n:msg>
|
||||
<i18n:msg xml:id="start">Start</i18n:msg>
|
||||
<i18n:msg xml:id="static">static</i18n:msg>
|
||||
<i18n:msg xml:id="status">Status</i18n:msg>
|
||||
|
|
|
@ -25,6 +25,8 @@ a_n_routes_static = 'Statische Routen'
|
|||
a_n_routes_kernel4 = 'Aktive IPv4-Routen'
|
||||
a_n_switch = 'Switch'
|
||||
a_n_switch1 = 'Die Netzwerkschnittstellen am Router können zu verschienden VLANs zusammengefasst werden, in denen Geräte miteinander direkt kommunizieren können. VLANs werden auch häufig dazu genutzt, um Netzwerke voneiander zu trennen. So ist oftmals eine Schnittstelle als Uplink zu einem größerem Netz, wie dem Internet vorkonfiguriert und die anderen Schnittstellen bilden ein VLAN für das lokale Netzwerk.'
|
||||
a_n_conntrack = 'Aktive Verbindungen'
|
||||
a_n_conntrack_desc = 'Diese Seite gibt eine Übersicht über aktive Netzwerkverbindungen.'
|
||||
a_network1 = 'In diesem Bereich finden sich alle netzwerkbezogenen Einstellungen.'
|
||||
a_network2 = 'Der Netzwerkswitch kann bei den meisten Routern frei konfiguriert und in mehrere VLANs aufgeteilt werden.'
|
||||
a_network3 = 'Schnittstellen und PPPoE/PPTP-Einstellungen ermöglichen die freie Organisation des Netzwerks und die Anbindung an ein WAN.'
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
<i18n:msg xml:id="a_n_routes_kernel4">Aktive IPv4-Routen</i18n:msg>
|
||||
<i18n:msg xml:id="a_n_switch">Switch</i18n:msg>
|
||||
<i18n:msg xml:id="a_n_switch1">Die Netzwerkschnittstellen am Router können zu verschienden VLANs zusammengefasst werden, in denen Geräte miteinander direkt kommunizieren können. VLANs werden auch häufig dazu genutzt, um Netzwerke voneiander zu trennen. So ist oftmals eine Schnittstelle als Uplink zu einem größerem Netz, wie dem Internet vorkonfiguriert und die anderen Schnittstellen bilden ein VLAN für das lokale Netzwerk.</i18n:msg>
|
||||
<i18n:msg xml:id="a_n_conntrack">Aktive Verbindungen</i18n:msg>
|
||||
<i18n:msg xml:id="a_n_conntrack_desc">Diese Seite gibt eine Übersicht über aktive Netzwerkverbindungen.</i18n:msg>
|
||||
<i18n:msg xml:id="a_network1">In diesem Bereich finden sich alle netzwerkbezogenen Einstellungen.</i18n:msg>
|
||||
<i18n:msg xml:id="a_network2">Der Netzwerkswitch kann bei den meisten Routern frei konfiguriert und in mehrere VLANs aufgeteilt werden.</i18n:msg>
|
||||
<i18n:msg xml:id="a_network3">Schnittstellen und PPPoE/PPTP-Einstellungen ermöglichen die freie Organisation des Netzwerks und die Anbindung an ein WAN.</i18n:msg>
|
||||
|
|
|
@ -17,6 +17,7 @@ confirmation = 'Bestätigung'
|
|||
delete = 'Löschen'
|
||||
descr = 'Beschreibung'
|
||||
design = 'Design'
|
||||
destination = 'Ziel'
|
||||
device = 'Gerät'
|
||||
devices = 'Geräte'
|
||||
disable = 'deaktivieren'
|
||||
|
@ -75,6 +76,7 @@ service = 'Dienst'
|
|||
services = 'Dienste'
|
||||
settings = 'Einstellungen'
|
||||
size = 'Größe'
|
||||
source = 'Quelle'
|
||||
start = 'Start'
|
||||
static = 'statisch'
|
||||
statistics = 'Statistiken'
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
<i18n:msg xml:id="delete">Löschen</i18n:msg>
|
||||
<i18n:msg xml:id="descr">Beschreibung</i18n:msg>
|
||||
<i18n:msg xml:id="design">Design</i18n:msg>
|
||||
<i18n:msg xml:id="destination">Ziel</i18n:msg>
|
||||
<i18n:msg xml:id="device">Gerät</i18n:msg>
|
||||
<i18n:msg xml:id="devices">Geräte</i18n:msg>
|
||||
<i18n:msg xml:id="disable">deaktivieren</i18n:msg>
|
||||
|
@ -98,6 +99,7 @@
|
|||
<i18n:msg xml:id="services">Dienste</i18n:msg>
|
||||
<i18n:msg xml:id="settings">Einstellungen</i18n:msg>
|
||||
<i18n:msg xml:id="size">Größe</i18n:msg>
|
||||
<i18n:msg xml:id="source">Quelle</i18n:msg>
|
||||
<i18n:msg xml:id="start">Start</i18n:msg>
|
||||
<i18n:msg xml:id="static">statisch</i18n:msg>
|
||||
<i18n:msg xml:id="statistics">Statistiken</i18n:msg>
|
||||
|
|
|
@ -259,6 +259,38 @@ function net.arptable()
|
|||
return _parse_delimited_table(io.lines("/proc/net/arp"), "%s%s+")
|
||||
end
|
||||
|
||||
--- Returns conntrack information
|
||||
-- @return Table with the currently tracked IP connections
|
||||
function net.conntrack()
|
||||
local connt = {}
|
||||
if luci.fs.access("/proc/net/nf_conntrack") then
|
||||
for line in io.lines("/proc/net/nf_conntrack") do
|
||||
local entry = _parse_mixed_record(line, " +")
|
||||
entry.layer3 = entry[1]
|
||||
entry.layer4 = entry[2]
|
||||
for i=1, #entry do
|
||||
entry[i] = nil
|
||||
end
|
||||
|
||||
connt[#connt+1] = entry
|
||||
end
|
||||
elseif luci.fs.access("/proc/net/ip_conntrack") then
|
||||
for line in io.lines("/proc/net/nf_conntrack") do
|
||||
local entry = _parse_mixed_record(line, " +")
|
||||
entry.layer3 = "ipv4"
|
||||
entry.layer4 = entry[1]
|
||||
for i=1, #entry do
|
||||
entry[i] = nil
|
||||
end
|
||||
|
||||
connt[#connt+1] = entry
|
||||
end
|
||||
else
|
||||
return nil
|
||||
end
|
||||
return connt
|
||||
end
|
||||
|
||||
--- Determine the current default route.
|
||||
-- @return Table with the properties of the current default route.
|
||||
-- The following fields are defined:
|
||||
|
@ -610,11 +642,12 @@ function _parse_delimited_table(iter, delimiter)
|
|||
return data
|
||||
end
|
||||
|
||||
function _parse_mixed_record(cnt)
|
||||
function _parse_mixed_record(cnt, delimiter)
|
||||
delimiter = delimiter or " "
|
||||
local data = {}
|
||||
|
||||
for i, l in pairs(luci.util.split(luci.util.trim(cnt), "\n")) do
|
||||
for j, f in pairs(luci.util.split(luci.util.trim(l), " ")) do
|
||||
for j, f in pairs(luci.util.split(luci.util.trim(l), delimiter, nil, true)) do
|
||||
local k, x, v = f:match('([^%s][^:=]+) *([:=]*) *"*([^\n"]*)"*')
|
||||
|
||||
if k then
|
||||
|
|
|
@ -94,4 +94,11 @@ function index()
|
|||
i18n("a_n_routes_static")
|
||||
)
|
||||
|
||||
entry(
|
||||
{"admin", "network", "conntrack"},
|
||||
form("admin_network/conntrack"),
|
||||
i18n("a_n_conntrack"),
|
||||
60
|
||||
)
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
$Id$
|
||||
]]--
|
||||
|
||||
f = SimpleForm("conntrack", translate("a_n_conntrack"), translate("a_n_conntrack_desc"))
|
||||
f.reset = false
|
||||
f.submit = false
|
||||
|
||||
t = f:section(Table, luci.sys.net.conntrack())
|
||||
l3 = t:option(DummyValue, "layer3", translate("network"))
|
||||
function l3.cfgvalue(self, ...)
|
||||
return DummyValue.cfgvalue(self, ...):upper()
|
||||
end
|
||||
|
||||
|
||||
l4 = t:option(DummyValue, "layer4", translate("protocol"))
|
||||
function l4.cfgvalue(self, ...)
|
||||
return DummyValue.cfgvalue(self, ...):upper()
|
||||
end
|
||||
|
||||
s = t:option(DummyValue, "src", translate("source"))
|
||||
function s.cfgvalue(self, section)
|
||||
return "%s:%s" % { self.map:get(section, "src"),
|
||||
self.map:get(section, "sport") or "*" }
|
||||
end
|
||||
|
||||
d = t:option(DummyValue, "dst", translate("destination"))
|
||||
function d.cfgvalue(self, section)
|
||||
return "%s:%s" % { self.map:get(section, "dst"),
|
||||
self.map:get(section, "dport") or "*" }
|
||||
end
|
||||
|
||||
return f
|
Loading…
Reference in a new issue