/* Technische Informationen */ ein verweis auf den quellcode ist ja jetzt möglich, oder?
This commit is contained in:
parent
c19af2c809
commit
ee4fe01823
|
@ -109,209 +109,13 @@ Ideen dazu werden [[Diskussion:Freifunk Dresden|diskutiert]], um die jetzigen Be
|
||||||
|
|
||||||
== Technische Informationen ==
|
== Technische Informationen ==
|
||||||
|
|
||||||
Bitte konsultiert zuerst das [http://wiki.freifunk-dresden.de/ Wiki Freifunk Dresden] und
|
Grundsätzlich soll das [http://wiki.freifunk-dresden.de/ Wiki Freifunk Dresden] Informationen, insbesondere auch technische Informationen, bereitstellen. Das ist wohl aber noch nicht der Fall und soll wohl in Arbeit sein.
|
||||||
[http://wiki.freifunk-dresden.de/index.php/Knoten_Spezifikation Knoten Spezifikationen] für aktuelle Informationen,
|
|
||||||
Derzeit enthält es noch keine techischen Informationen (ist aber in Arbeit).
|
|
||||||
<font color="red">Die Informationen hier in diesem Wiki sind derzeit veraltet und sind nicht mehr kompatibel mit dem Freifunk Dresden Netz. Sie sollten daher
|
|
||||||
nicht mehr verwendet werden, da es damit zu IP Konflikten kommt.</font>
|
|
||||||
|
|
||||||
=== WLAN-Einstellungen ===
|
=== Quellcode ===
|
||||||
|
|
||||||
Die detailierten Einstellungen werden [[Intern:Freifunk Dresden|derzeit intern]] beschrieben.
|
Der Quellcode soll auf [[#GitHub]] verfügbar sein. Dies gilt insbesondere für die [[#Firmware]].<ref>https://github.com/ddmesh/firmware-freifunk-dresden</ref>
|
||||||
|
|
||||||
=== Adressvergabe ===
|
=== mögliche Probleme beim Betrieb der Technik ===
|
||||||
|
|
||||||
==== IP-Adressberechnungs mit Shell- und Lua Script ====
|
|
||||||
|
|
||||||
Die Berechnung kann sich in künftigen Versionen ändern, derzeit wird u.a. eine Aufteilung des Netzwerkes in "original"-FFF und "custom" erwogen. Deshalb ist Vorsicht geboten was die Aktualität des Inhaltes angeht - bitte überprüfen bevor ihr peert.
|
|
||||||
|
|
||||||
Die Scripte deren Algorithmus formalisiert werden soll:
|
|
||||||
|
|
||||||
===== usr/bin/ddmesh-ipcalc.sh =====
|
|
||||||
<source lang="bash">
|
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
if [ "$1" = "" ]
|
|
||||||
then
|
|
||||||
echo ""
|
|
||||||
echo "ddmesh-ipcalc.sh (lua) Stephan Enderlein (c) 2013 V1.7"
|
|
||||||
echo ""
|
|
||||||
echo "Calculates all the addresses for the ddmesh freifunk node"
|
|
||||||
echo "usage: ddmesh-ipcalc.sh [-n node] | [ip]"
|
|
||||||
echo ""
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$1" = "-n" ]; then
|
|
||||||
node=`echo "$2" | sed 's/[\$\`\(\)]/0/g'`
|
|
||||||
lua -lddmesh -e "ipcalc.print($node)"
|
|
||||||
else
|
|
||||||
ip=`echo "$1" | sed 's/[\$\`\(\)]/0/g'`
|
|
||||||
lua -lddmesh -e "print(iplookup(\"$ip\"))"
|
|
||||||
fi
|
|
||||||
|
|
||||||
</source>
|
|
||||||
|
|
||||||
===== usr/lib/lua/ddmesh.lua =====
|
|
||||||
|
|
||||||
<source lang="lua">
|
|
||||||
--[[----------------------------------------------------------------------------------------
|
|
||||||
ddmesh.lua
|
|
||||||
library for different freifunk functions
|
|
||||||
version: 6
|
|
||||||
-------------------------------------------------------------------------------------------]]
|
|
||||||
|
|
||||||
----------------- ipcalc ---------------
|
|
||||||
ipcalc={}
|
|
||||||
ipcalc.data={}
|
|
||||||
ipcalc.data.max=2048
|
|
||||||
|
|
||||||
function split(str, delim, maxNb)
|
|
||||||
-- Eliminate bad cases...
|
|
||||||
if string.find(str, delim) == nil then
|
|
||||||
return { str }
|
|
||||||
end
|
|
||||||
if maxNb == nil or maxNb < 1 then
|
|
||||||
maxNb = 0 -- No limit
|
|
||||||
end
|
|
||||||
local result = {}
|
|
||||||
local pat = "(.-)" .. delim .. "()"
|
|
||||||
local nb = 0
|
|
||||||
local lastPos
|
|
||||||
for part, pos in string.gfind(str, pat) do
|
|
||||||
nb = nb + 1
|
|
||||||
result[nb] = part
|
|
||||||
lastPos = pos
|
|
||||||
if nb == maxNb then break end
|
|
||||||
end
|
|
||||||
-- Handle the last field
|
|
||||||
if nb ~= maxNb then
|
|
||||||
result[nb + 1] = string.sub(str, lastPos)
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
function ipcalc.rCalcIp(ip)
|
|
||||||
if ip==nil or ip=="" then return -1 end
|
|
||||||
a = split(ip, "[.]")
|
|
||||||
if #a ~= 4 then return -1 end
|
|
||||||
if a[1]==nil or a[1]=="" or tonumber(a[1]) ~= 10 then return -1 end
|
|
||||||
if a[2]==nil or a[2]=="" or tonumber(a[2]) ~= 200 and tonumber(a[2]) ~= 201 then return -1 end
|
|
||||||
if a[3]==nil or a[3]=="" or tonumber(a[3]) < 0 or tonumber(a[3]) > 255 then return -1 end
|
|
||||||
if a[4]==nil or a[4]=="" or tonumber(a[4]) < 0 or tonumber(a[4]) > 255 then return -1 end
|
|
||||||
|
|
||||||
middle = a[3]
|
|
||||||
if a[2]=="201" then middle = middle + 256 end
|
|
||||||
minor = math.floor(a[4]/64) --x>>6
|
|
||||||
node = middle*4+minor --x<<2
|
|
||||||
if node < 0 or node > ipcalc.data.max then return -1 end
|
|
||||||
return node
|
|
||||||
end
|
|
||||||
|
|
||||||
function ipcalc.calc(node)
|
|
||||||
--node has to be a number n \in N_0, 0 <= n <= 2048
|
|
||||||
if node==nil or node=="" then return -1 end
|
|
||||||
node=tonumber(node)
|
|
||||||
if node==nil or node=="" then return -1 end
|
|
||||||
if node < 0 or node > ipcalc.data.max then return -1 end
|
|
||||||
|
|
||||||
local domain = "freifunk-dresden.de"
|
|
||||||
|
|
||||||
--Ternary Operator in use
|
|
||||||
-- major network for nodes n < 1024: 200, for nodes > 1023: 201
|
|
||||||
local major = node >= 1024 and 201 or 200 --a[2]
|
|
||||||
-- etc.
|
|
||||||
local middle = node >= 1024 and math.floor((node-1024) / 4) or math.floor(node / 4) --a[3]
|
|
||||||
local minor = (node % 4) * 64
|
|
||||||
|
|
||||||
local meshnet = "10"
|
|
||||||
local nodeip = meshnet .. "." .. major .. "." .. middle .. "." .. minor + 1
|
|
||||||
local meshnetmask = "255.0.0.0"
|
|
||||||
local meshpre = 15
|
|
||||||
local meshbroadcast = "10.255.255.255"
|
|
||||||
local meshnetwork = "10.200.0.0"
|
|
||||||
|
|
||||||
local dhcpstart = meshnet .. "." .. major .. "." .. middle .. "." .. minor + 2
|
|
||||||
local dhcpend = meshnet .. "." .. major .. "." .. middle .. "." .. minor + 63
|
|
||||||
local dhcpoffset = 1 --used by config/dhcp
|
|
||||||
local dhcplimit = 62 --used by config/dhcp
|
|
||||||
local dhcprangepre = 26
|
|
||||||
local dhcprangemask = "255.255.255.192"
|
|
||||||
local dhcpnetmask = "255.255.255.255"
|
|
||||||
local dhcpbroadcast = "10.255.255.255" -- needed, else dnsmasq will not start
|
|
||||||
local dhcpnetwork = meshnet .. "." .. major .. "." .. middle .. "." .. minor
|
|
||||||
|
|
||||||
local hna = meshnet .. "." .. major .. "." .. middle .. "." .. minor .. "/" .. dhcprangepre
|
|
||||||
local mesh6pre = "48"
|
|
||||||
local mesh6net = "fd11:11ae:7466::"
|
|
||||||
-- client range
|
|
||||||
local mesh6nodenet= "fd11:11ae:7466:" .. string.format("%x", node) .. "::"
|
|
||||||
local mesh6ip = mesh6nodenet .. "1"
|
|
||||||
local mesh6nodepre= "64"
|
|
||||||
|
|
||||||
-- preparing variabled to be expoted
|
|
||||||
ipcalc.data.node = node
|
|
||||||
ipcalc.data.domain = domain
|
|
||||||
ipcalc.data.hostname = "r" .. node
|
|
||||||
ipcalc.data.ip = nodeip
|
|
||||||
ipcalc.data.network = meshnetwork
|
|
||||||
ipcalc.data.netpre = meshpre
|
|
||||||
ipcalc.data.netmask = meshnetmask
|
|
||||||
ipcalc.data.broadcast = meshbroadcast
|
|
||||||
ipcalc.data.dhcpstart = dhcpstart
|
|
||||||
ipcalc.data.dhcpend = dhcpend
|
|
||||||
ipcalc.data.dhcpoffset = dhcpoffset
|
|
||||||
ipcalc.data.dhcplimit = dhcplimit
|
|
||||||
ipcalc.data.dhcprangepre = dhcprangepre
|
|
||||||
ipcalc.data.dhcprangemask = dhcprangemask
|
|
||||||
ipcalc.data.dhcpnetwork = dhcpnetwork
|
|
||||||
ipcalc.data.dhcpbroadcast = dhcpbroadcast
|
|
||||||
ipcalc.data.dhcpnetmask = dhcpnetmask
|
|
||||||
ipcalc.data.clienthna = hna
|
|
||||||
ipcalc.data.mesh6ip = mesh6ip
|
|
||||||
ipcalc.data.mesh6net = mesh6net
|
|
||||||
ipcalc.data.mesh6pre = mesh6pre
|
|
||||||
ipcalc.data.mesh6nodenet = mesh6nodenet
|
|
||||||
ipcalc.data.mesh6nodepre = mesh6nodepre
|
|
||||||
end
|
|
||||||
|
|
||||||
function ipcalc.print(node)
|
|
||||||
|
|
||||||
if node==nil or node=="" then print("ERROR"); return -1 end
|
|
||||||
node=tonumber(node)
|
|
||||||
if node==nil then print("ERROR"); return -1 end
|
|
||||||
if node < 0 or node > ipcalc.data.max then return -1 end
|
|
||||||
ipcalc.calc(node)
|
|
||||||
|
|
||||||
for k,v in pairs(ipcalc.data) do
|
|
||||||
print("export _ddmesh_"..k.."="..v)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--not needed for ip address calculation
|
|
||||||
function iplookup(ip)
|
|
||||||
if ip==nil then return -1 end
|
|
||||||
n=ipcalc.rCalcIp(ip)
|
|
||||||
if n == -1 then return -1 end
|
|
||||||
ipcalc.calc(n)
|
|
||||||
return ipcalc.data.hostname
|
|
||||||
end
|
|
||||||
|
|
||||||
--not needed for ip address calculation
|
|
||||||
function lookup(node)
|
|
||||||
if node==nil then return -1 end
|
|
||||||
if string.sub(node,1,1) == "r" then
|
|
||||||
n=tonumber(string.sub(node,2))
|
|
||||||
else
|
|
||||||
n=tonumber(node)
|
|
||||||
end
|
|
||||||
if n==nil then return -1 end
|
|
||||||
if n < 0 or n > ipcalc.data.max then return -1 end
|
|
||||||
ipcalc.calc(n)
|
|
||||||
return ipcalc.data.ip
|
|
||||||
end
|
|
||||||
</source>
|
|
||||||
----
|
|
||||||
|
|
||||||
== Metadaten ==
|
== Metadaten ==
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue