Skip to content

Commit

Permalink
Merge pull request #30 from ffbsee/developement
Browse files Browse the repository at this point in the history
Stable Release 0.7.0
  • Loading branch information
mart-ffbsee authored Feb 5, 2017
2 parents 6ccb112 + ba61ff6 commit 8042eec
Show file tree
Hide file tree
Showing 142 changed files with 41,562 additions and 2,234 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
.directory
*/.directory
**/.directory
**.directory
**.png
**.jpeg
**.jpg
**.pdf
**.swp
**.gif
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ Included is Internet connectivity and a web interface.

Please talk to us on IRC if anything does not work!

To build the firmware you need a Unix console to enter commands into.
[Precompiled firmware images](https://vpn1.ffbsee.de/freifunk/firmware/ "Precompiled firmware images") are available on our server. All other released versions here on github are out-of-date.

To build the firmware yourself you need a Unix console to enter commands into.
Install dependencies for the build environment (Debian/Ubuntu):

```bash
sudo apt-get update; sudo apt-get upgrade
sudo apt-get install subversion g++ zlib1g-dev build-essential git python
sudo apt-get install libncurses5-dev gawk gettext unzip file libssl-dev wget

```
Build commands for the console:

git clone git://git.openwrt.org/15.05/openwrt.git
```bash
git clone https://github.com/openwrt/openwrt.git
cd openwrt
git reset --hard 0f757bd2606971252f901ef3faf4dbd0086315f7

./scripts/feeds update -a
./scripts/feeds install -a
Expand All @@ -32,7 +38,7 @@ Build commands for the console:

make defconfig
make menuconfig

```
Now select the right "Target System" and "Target Profile" for your AP model:

For example, for the TL-WR841ND, select:
Expand All @@ -49,14 +55,20 @@ should now be visible in the "Target Profile" list.

Now start the build process. This takes some time:

```bash
make
```
*You have the oportunity to compile the firmware at more CPU Threats.
E.g. for 4-Threats type* `make -j4` .

The firmware images are now in the `bin`-folder. Use the firmware update
functionality of your router and upload the factory image. The sysupgrade
The **firmware images** are now in the `bin`-folder. Use the firmware update
functionality of your router and upload the factory image to flash it with the freifunk firmware. The sysupgrade
images are for further updates.

* Use `openwrt-[chip]-[model]-squashfs-factory.bin` for the initial flash.
* Use `openwrt-[chip]-[model]-squashfs-sysupgrade.bin` for futher updates.

Many routers have not been tested yet, but may work.
Give it a try! :-)
**Many routers have not been tested yet, but may work.**
***Give it a try! :-)***

To build all images for all supported models see [github.com/freifunk-bielefeld](https://github.com/freifunk-bielefeld/docs/blob/master/release_howto.md#images-bauen)
1 change: 1 addition & 0 deletions files/etc/config/autoupdater
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ config branch stable
list pubkey '9917fc356c2d9dbbcef05e94db5c69e7add4383c339355d5a2f48af64d707f4e' #mart
list pubkey '6e3d9c98e4f7f9139c01f99b539dce45a9339f10774d2a57095822dbc7e68d4a' #l3d
list pubkey '4bc8902befbf3f3d4c308caad02cc1efd32e0309837c9fae9f1a264e47f7faee' #Xperimental
list pubkey 'eb00dd3606a4b7d724d308763a175ec755a73025874d90b373e598f427e7f998' #Byt3
10 changes: 4 additions & 6 deletions files/etc/config/freifunk
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ config settings
option longitude ''
option contact ''
option community 'bodensee'
option version '0.6.2'
option publish_map 'basic'
option exittunnel 'foreign'
option version '0.7.0'
option publish_map 'more'
option exittunnel 'either'
option ipv6_only 'both'
option access_from 'lan'
option publish_map 'basic'
option allow_access_from 'lan'
option service_link ''
option service_label ''
option service_display_max 0
option service_display_max 8
option default_mesh_id 'ffbsee_mesh'
option mesh_on_wan '0'
option community_url 'https://ffbsee.de'
Expand Down
8 changes: 4 additions & 4 deletions files/etc/crontabs/root
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#check for new firmware every 6 hours
# Check for new firmware every 6 hours
0 */6 * * * /usr/sbin/autoupdater
#publish map data
# Publish map data
*/5 * * * * /usr/sbin/print_map.sh -p
#publish service data
# Publish service data
*/5 * * * * /usr/sbin/print_service.sh -p
#reboot every 5 days at 04:05
# Reboot every 5 days at 04:05
5 4 */5 * * /sbin/reboot
3 changes: 2 additions & 1 deletion files/etc/hotplug.d/net/60-freifunk-ula
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if [ "$INTERFACE" = "bat0" ]; then
. /lib/ff_shared.sh

macaddr="$(cat /sys/kernel/debug/batman_adv/bat0/originators | awk -F'[/ ]' '{print $7; exit;}')"
ipaddr="$(ula_addr $macaddr)"
prefix="$(uci get network.globals.ula_prefix)"
ipaddr="$(ula_addr $prefix $macaddr)"
ip a a "$ipaddr/64" dev br-freifunk
fi
3 changes: 3 additions & 0 deletions files/etc/sysupgrade.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Keep ssh keys on sysupgrade
/etc/uhttpd.crt
/etc/uhttpd.key
98 changes: 70 additions & 28 deletions files/etc/uci-defaults/50_freifunk-setup
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,29 @@ initial_freifunk_setup()

initial_local_node_setup()
{
echo "(I) Setup IPv4 local node access."
echo "(I) Setup IPv4 and IPv6 local node access."

local ula_prefix="$(uci get network.globals.ula_prefix)"
local addr6="${ula_prefix%%::*}::0"
local addr4="10.11.175.127"
local addr6="$(uci get network.globals.ula_prefix)" #CIDR notation


uci add_list network.freifunk.ipaddr="$addr4"
uci add_list network.freifunk.ipaddr6="$addr6"
uci add_list network.freifunk.ip6addr="$addr6"

cat >> /etc/firewall.user <<- EOF
#isolate local-node IPv4 address
# isolate local-node IPv4 address
ebtables -A FORWARD --logical-out br-freifunk -o bat0 -p arp --arp-ip-dst $addr4/32 -j DROP
ebtables -A OUTPUT --logical-out br-freifunk -o bat0 -p arp --arp-ip-dst $addr4/32 -j DROP
ebtables -A FORWARD --logical-out br-freifunk -o bat0 -p IPv4 --ip-source $addr4/32 -j DROP
ebtables -A OUTPUT --logical-out br-freifunk -o bat0 -p IPv4 --ip-source $addr4/32 -j DROP
# Hope to isolate local-node IPv6 address
ebtables -A FORWARD --logical-out br-freifunk -o bat0 -p IPv6 --ip6-dst ${addr6%%??}128 -j DROP
ebtables -A OUTPUT --logical-out br-freifunk -o bat0 -p IPv6 --ip6-dst ${addr6%%??}128 -j DROP
EOF
}

Expand Down Expand Up @@ -215,7 +223,7 @@ initial_setup()
(echo ""; sleep 1; echo "") | passwd > /dev/null

#get a unique MAC address to identify the node
local mac="$(cat /sys/class/ieee80211/phy0/macaddress)"
local mac="$(cat /sys/class/ieee80211/phy0/macaddress 2> /dev/null)"
if [ -z "$mac" -o "$mac" = "00:11:22:33:44:55" ]; then
mac="$(cat /sys/class/net/eth0/address)"
if [ -z "$mac" -o "$mac" = "00:11:22:33:44:55" ]; then
Expand All @@ -238,6 +246,7 @@ initial_setup()
uci set -q network.globals="globals"
uci set network.globals.ula_prefix="$prefix"
echo "10.11.175.127 node" >> /etc/hosts
echo "10.11.175.127 nextnode.ffbsee" >> /etc/hosts

# ------------------------------------------- #
# S E T U P W I R E L E S S #
Expand All @@ -246,13 +255,13 @@ initial_setup()
initial_wifi_setup

# ------------------------------------- #
# P R I V A T E S E T U P #
# L A N S E T U P #
# ------------------------------------- #

initial_lan_setup "$lan_interface"

# ------------------------------------- #
# P U B L I C S E T U P #
# F R E I F U N K S E T U P #
# ------------------------------------- #

initial_freifunk_setup "bat0" "$mac_la"
Expand Down Expand Up @@ -300,8 +309,6 @@ initial_setup()
;;
esac



#allow access of the local node using a common IP address
initial_local_node_setup

Expand Down Expand Up @@ -332,10 +339,13 @@ initial_setup()

#write everything to flash
uci commit

# NTP Server Update
sed -E -i "s/list\ server\ '0.openwrt.pool.ntp.org'/list\ server\ 'ntp.ffbsee'\n\tlist\ server\ 'fdef:1701:b5ee:42:1337::13d'\n\tlist\ server\ '0.openwrt.pool.ntp.org'/" /etc/config/system

}

update_002_to_004()
{
update_002_to_004(){
echo "(I) Fix IPv6 prefix."
uci set network.globals.ula_prefix='fdef:1701:b5ee:42::/64'
uci delete network.freifunk.ip6addr
Expand All @@ -351,8 +361,7 @@ update_002_to_004()
uci commit network
}

update_004()
{
update_004(){
echo "(I) Update public key for autoupdater."
sed -i "s/7c76dcb242c477b2f60afb7d94590c47c23edea0a23b544a87b2d37ed22b9238' #randomguy/4bc8902befbf3f3d4c308caad02cc1efd32e0309837c9fae9f1a264e47f7faee' #Xperimental/" /etc/config/autoupdater
echo "(I) Make vpn1 prefer ipv6"
Expand All @@ -363,14 +372,12 @@ update_004()
printf "\nconfig peer 'vpn3'\n option enabled 1\n option net 'default'\n option group 'backbone'\n option key '1e81443889a1b9d3ee14fcbbee0aaf7331c38163ee8f64ef49fb41004ccb8280'\n list remote 'ipv6 \"vpn3.ffbsee.de\" port 1244'\n list remote 'ipv4 \"vpn3.ffbsee.de\" port 1244'\n option float 0\n" >> /etc/config/fastd
}

update_005()
{
update_005(){
echo "(I) Add a 4th VPN Server."
printf "\nconfig peer 'vpn4'\n option enabled 1\n option net 'default'\n option group 'backbone'\n option key '696b6fbfa5f1cc1a8a85c78276b55448d0cb89ed9d52f30234f02a811f7132d0'\n list remote 'ipv6 \"vpn4.ffbsee.de\" port 1244'\n list remote 'ipv4 \"vpn4.ffbsee.de\" port 1244'\n option float 0\n" >> /etc/config/fastd
}

update_006()
{
update_006(){
# preserve self signed certificates
cp /rom/etc/uhttpd.crt /etc/ 2> /dev/null
cp /rom/etc/uhttpd.key /etc/ 2> /dev/null
Expand Down Expand Up @@ -429,13 +436,33 @@ update_006()
uci commit network
}

update_061()
{
update_061(){
# update fastd configuration
cp /rom/etc/config/fastd.foreign /etc/config/fastd
cp /rom/etc/config/fastd.either /etc/config/fastd
cp /rom/etc/config/fastd.domestic /etc/config/fastd
}
update_064(){
# IP config update
echo "10.11.175.127 nextnode.ffbsee" >> /etc/hosts
local addr6="$(uci get network.globals.ula_prefix)" #CIDR notation
uci add_list network.freifunk.ip6addr="$addr6"

cat >> /etc/firewall.user <<- EOF
# Hope to isolate local-node IPv6 address
ebtables -A FORWARD --logical-out br-freifunk -o bat0 -p IPv6 --ip6-dst ${addr6%%??}128 -j DROP
ebtables -A OUTPUT --logical-out br-freifunk -o bat0 -p IPv6 --ip6-dst ${addr6%%??}128 -j DROP
EOF

# Update NTP config
sed -E -i "s/list\ server\ '0.openwrt.pool.ntp.org'/list\ server\ 'ntp.ffbsee'\n\tlist\ server\ 'fdef:1701:b5ee:42:1337::13d'\n\tlist\ server\ '0.openwrt.pool.ntp.org'/" /etc/config/system

# Add public key for autoupdater
echo -e "\n\tlist pubkey 'eb00dd3606a4b7d724d308763a175ec755a73025874d90b373e598f427e7f998' #Byt3" >> /etc/config/autoupdater
}


start()
{
Expand All @@ -457,55 +484,70 @@ start()

echo "(I) Update from '$from_version' to '$to_version'"
case "$from_version" in
"0.0.2")
0.0.2*)
echo "(I) Apply 0.0.2 update."
update_002_to_004
update_004
update_005
update_006
update_version
;;
"0.0.3")
0.0.3*)
echo "(I) Apply 0.0.3 update."
update_002_to_004
update_004
update_005
update_006
update_version
;;
"0.0.4")
0.0.4*)
echo "(I) Apply 0.0.4 update."
update_004
update_005
update_006
update_version
;;
"0.0.5")
0.0.5*)
echo "(I) Apply 0.0.5 update."
update_005
update_006
update_version
;;
"0.0.6")
0.0.6*)
echo "(I) Apply 0.0.6 update."
update_006
update_version
;;
"0.1.0-testing")
0.1.0*)
echo "(I) Apply 0.1.0-testing update."
update_006
update_version
;;
"0.6.0-dev")
0.6.0*)
echo "(I) Apply 0.6.0-dev update."
update_061
update_version
;;
"0.6.1")
echo "(I) Apply 0.6.1 update."
0.6.1*)
echo "(I) Apply 0.6.1 update."
update_061
update_version
;;
0.6.2*)
echo "(I) Apply 0.6.2 update."
update_064
update_version
;;
0.6.3*)
echo "(I) Apply 0.6.3-development update."
update_064
update_version
;;
0.6.4*)
echo "(I) Apply 0.6.4-development update."
update_064
update_version
;;
"")
echo "(I) Start initial setup."
initial_setup
Expand Down
4 changes: 1 addition & 3 deletions files/lib/ff_shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
# Create an IPv6 ULA-address.
ula_addr()
{
local prefix a mac="$1" invert=${2:-0}

prefix="$(uci get network.globals.ula_prefix)"
local prefix a prefix="$1" mac="$2" invert=${3:-0}

if [ $invert -eq 1 ]; then
# translate to local administered mac
Expand Down
25 changes: 25 additions & 0 deletions files/usr/sbin/calc_speed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

# Calculate up/down speed and record data volume on given network interfaces.

net="$1"
td="$2"

if [ -n "$net" -a -n "$td" ]; then
bytes1="$(cat /var/${td}_data_${net} 2> /dev/null)"
time1="$(date +%s -r /var/${td}_data_${net} 2> /dev/null)"

bytes2="$(cat /sys/class/net/$net/statistics/${td}_bytes)"
time2="$(date +%s)"

# Only calculate new speed after at least one second has passed
if [ "$time1" != "$time2" ]; then
# Remember data volume for next time
echo -n "$bytes2" > /var/${td}_data_${net}
fi

speed="$(expr \( $bytes2 - $bytes1 \) / \( $time2 - $time1 \) 2> /dev/null)"
echo "${speed:-0}"
else
echo "Usage: $0 <interface> [tx|rx]"
fi
Loading

0 comments on commit 8042eec

Please sign in to comment.