Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert changes which can be packaged #1

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 23 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,39 @@
[![Build Gluon](https://github.com/freifunk-gluon/gluon/actions/workflows/build-gluon.yml/badge.svg?branch=master)](https://github.com/freifunk-gluon/gluon/actions/workflows/build-gluon.yml)
[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://opensource.org/license/bsd-2-clause/)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/freifunk-gluon/gluon?sort=semver)](https://github.com/freifunk-gluon/gluon/releases/latest)

# Gluon

Gluon is a firmware framework to build preconfigured OpenWrt images for public mesh networks.

## Overview
## Gluon-Parker

Gluon provides an easy-to-use firmware for a public, decentral WLAN and/or wire based mesh network.
Common network capable devices, like smartphones, laptops or desktop PCs can connect to the mesh network and communicate over it, without the need of passwords for access and without the need of installing special software.
Additionally, internet access and merging mesh clouds can be accomplished over a WAN through VPN connected gateways.
This is a fork of Gluon, that uses routing between the nodes (aka. Router devices) and the infrastructure.
It is currently in use by [Freifunk Braunschweig](https://freiunk-bs.de).
Other communities are interested in adopting it as well.

Gluon's features include:
Documentation is currently sparse.
Some hints can be found here:

* a decentral mesh network
* easy configuration mode for less techy users
* community-specific technical settings and customizations through a common site.conf and site.mk
* ecdsa signature-based autoupdater
* node status web page
* publication of node information + statistics through respondd
* a variety of preconfigured mesh and VPN protocols:
* https://media.ccc.de/v/35c3oio-69-project-parker-klassisches-routing-fr-freifunk
* https://freifunk-bs.de/parker.html

Not all features needed for a parker-style Gluon are currently upstream - they are kept in this repository.
In this repository we will keep a branch for every upstream development branch with our local changes on top.
These branches follow the upstream naming, so `v2023.2.x-parker` will track `v2023.2.x`.
Releases will be tagged with an additional suffix: Tag `v2023.2.4.1-parker` will be on top of `v2023.2.4`.

Supported mesh protocols:
We are planning to bring all these changes into upstream Gluon.
Feel free to help!

* batman-adv (BATMAN IV fully, BATMAN V partially)
* OLSRv2 (partially)
Other packages needed for a parker-style Gluon are developed in the [community-packages](https://github.com/freifunk-gluon/community-packages) repository.
They are named `ffbs-parker-*`.

A parker-style network needs a different backend.
You can get some inspiration from [here](https://gitli.stratum0.org/ffbs/ffbs-ansible).

Supported protocols for node-to-node connections:
## Contributing

* WLAN: 802.11s (with forwarding disabled)
* WAN: VPNs via fastd and Wireguard
* LAN: via VXLAN
Pull Requests against this repo are welcome!
(Please only pull-request against changes done in this repository
All other Pull Requests should go to directly to Gluon.)

## Getting started

We have a huge amount of documentation over at https://gluon.readthedocs.io/.

If you're new to Gluon and ready to get your feet wet, have a look at the
[Getting Started Guide](https://gluon.readthedocs.io/en/latest/user/getting_started.html).

Gluon's developers frequent an IRC chatroom at [#gluon](ircs://irc.hackint.org/#gluon)
on [hackint](https://hackint.org/). There is also a [webchat](https://webirc.hackint.org/#irc://irc.hackint.org/#gluon)
that allows for uncomplicated access from within your browser. This channel is also available as a bridged Matrix Room at [#gluon:hackint.org](https://matrix.to/#/#gluon:hackint.org).

## Issues & Feature requests

Before opening an issue, make sure to check whether any existing issues
(open or closed) match. If you're suggesting a new feature, drop by on IRC or
our mailinglist to discuss it first.

We maintain a [Roadmap](https://github.com/freifunk-gluon/gluon/wiki/Roadmap) for
the future development of Gluon.

## Use a release!

Please refrain from using the `master` branch for anything else but development purposes!
Use the most recent release instead. You can list all releases by running `git tag`
and switch to one by running `git checkout v2023.2.4 && make update`.

If you're using the autoupdater, do not autoupdate nodes with anything but releases.
If you upgrade using random master commits the nodes *might break* eventually.

## Mailinglist

To subscribe to the list, send a message to:

[email protected]

To remove your address from the list, just send a message to
the address in the `List-Unsubscribe` header of any list
message. If you haven't changed addresses since subscribing,
you can also send a message to:

[email protected]
Please be aware that we may rebase our branches on top of upstream without a PR 🫠.
11 changes: 6 additions & 5 deletions modules
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ OPENWRT_REPO=https://github.com/openwrt/openwrt.git
OPENWRT_BRANCH=openwrt-23.05
OPENWRT_COMMIT=1efcdb2446602c3b120b265c1d189039fdb9c0e7

PACKAGES_GLUON_REPO=https://github.com/freifunk-gluon/packages.git
PACKAGES_GLUON_COMMIT=3d08b0fee8dc5d96d8bcdb985fad1d5564de4022
PACKAGES_GLUON_REPO=https://gitli.stratum0.org/ffbs/packages.git
PACKAGES_GLUON_COMMIT=953a6a9dde028491e1eba4a85d4ca2ebbf3d1bc0
PACKAGES_GLUON_BRANCH=v2023.2.x-ffbs-next

PACKAGES_PACKAGES_REPO=https://github.com/openwrt/packages.git
PACKAGES_PACKAGES_BRANCH=openwrt-23.05
PACKAGES_PACKAGES_COMMIT=c691e6f4c7ea2b40909270e4523b0fa6dcfbb9ae
PACKAGES_PACKAGES_REPO=https://gitli.stratum0.org/ffbs/openwrt-packages.git
PACKAGES_PACKAGES_BRANCH=openwrt-23.05-ffbs-next
PACKAGES_PACKAGES_COMMIT=ca2ff667e28e03d1b24a92696449f77b63e6dbf2

PACKAGES_ROUTING_REPO=https://github.com/openwrt/routing.git
PACKAGES_ROUTING_BRANCH=openwrt-23.05
Expand Down
4 changes: 0 additions & 4 deletions package/gluon-client-bridge/check_site.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
need_string_match(in_domain({'next_node', 'mac'}), '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%x$', false)

if need_string_match(in_domain({'next_node', 'ip4'}), '^%d+.%d+.%d+.%d+$', false) then
need_string_match(in_domain({'prefix4'}), '^%d+.%d+.%d+.%d+/%d+$')
end

need_string_match(in_domain({'next_node', 'ip6'}), '^[%x:]+$', false)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@ uci:section('dhcp', 'dhcp', 'local_client', {
ignore = true,
})

uci:delete('dhcp', 'local_client')

uci:save('dhcp')
uci:save('firewall')
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ uci:section('network', 'device', 'local_node_dev', {
local ip4, ip6

if next_node.ip4 then
local plen = site.prefix4():match('/%d+$')
ip4 = next_node.ip4 .. plen
ip4 = next_node.ip4 .. '/32'
end

if next_node.ip6 then
Expand Down
4 changes: 0 additions & 4 deletions package/gluon-core/check_site.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ need_string(in_site({'timezone'}))

need_string_array({'ntp_servers'}, false)

need_string_match(in_domain({'prefix4'}), '^%d+.%d+.%d+.%d+/%d+$', false)
need_string_match(in_domain({'prefix6'}), '^[%x:]+/64$')
need_string_array_match(in_domain({'extra_prefixes6'}), '^[%x:]+/%d+$', false)

local supported_rates = {6000, 9000, 12000, 18000, 24000, 36000, 48000, 54000}
for _, config in ipairs({'wifi24', 'wifi5'}) do
if need_table({config}, nil, false) then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#!/usr/bin/lua

local json=require("jsonc")
local f = assert(io.popen("ip -6 -br -j addr show dev br-client scope link", 'r'))
local s = assert(f:read('*a'))
f:close()
local ll = json.parse(s)[1]["addr_info"][2]["local"]
local ll = "2001:bf7:382::1"

local f = io.open("/tmp/range6","r")

Expand Down
43 changes: 31 additions & 12 deletions package/gluon-radv-filterd/src/gluon-radv-filterd.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
// seconds). Re-read it from the transtable afterwards.
#define ORIGINATOR_CACHE_TTL 300

// max execution time of a single ebtables call in nanoseconds
#define EBTABLES_TIMEOUT 500000000 // 500ms
// max execution time of a single ebtables call in seconds
#define EBTABLES_TIMEOUT 2

// TQ value assigned to local routers
#define LOCAL_TQ 512
Expand Down Expand Up @@ -92,6 +92,7 @@ struct router {
struct ether_addr originator;
uint16_t tq;
bool redirected;
bool expired;
struct in6_addr lladdr;
struct in6_addr prefix;
};
Expand Down Expand Up @@ -143,7 +144,7 @@ static int timespec_diff(struct timespec *tv1, struct timespec *tv2,
static void cleanup(void) {
struct router *router;
struct timespec timeout = {
.tv_nsec = EBTABLES_TIMEOUT,
.tv_sec = EBTABLES_TIMEOUT,
};

close(G.sock);
Expand Down Expand Up @@ -300,6 +301,9 @@ static struct router *router_find_src(const struct ether_addr *src) {
struct router *router;

foreach(router, G.routers) {
if (router->expired)
continue;

if (ether_addr_equal(router->src, *src))
return router;
}
Expand All @@ -311,6 +315,9 @@ static struct router *router_find_orig(const struct ether_addr *orig) {
struct router *router;

foreach(router, G.routers) {
if (router->expired)
continue;

if (ether_addr_equal(router->originator, *orig))
return router;
}
Expand All @@ -321,6 +328,13 @@ static struct router *router_find_orig(const struct ether_addr *orig) {
static struct router *router_add(const struct ether_addr *mac) {
struct router *router;

foreach(router, G.routers) {
if (ether_addr_equal(router->src, *mac)) {
router->expired = false;
return router;
}
}

router = calloc(1, sizeof(*router));
if (!router)
return NULL;
Expand Down Expand Up @@ -417,23 +431,19 @@ static void handle_ra(int sock) {
}

static void expire_routers(void) {
struct router **prev_ptr = &G.routers;
struct router *router;
struct router *safe;
struct timespec now;
struct timespec diff;

clock_gettime(CLOCK_MONOTONIC, &now);

foreach_safe(router, safe, G.routers) {
foreach(router, G.routers) {
if (timespec_diff(&now, &router->eol, &diff)) {
DEBUG_MSG("router " F_MAC " expired", F_MAC_VAR(router->src));
*prev_ptr = router->next;
if (G.best_router == router)
G.best_router = NULL;
free(router);
} else {
prev_ptr = &router->next;
router->expired = true;
}
}
}
Expand Down Expand Up @@ -628,6 +638,9 @@ static void update_tqs(void) {

// if all routers have a TQ value, we don't need to check translocal
foreach(router, G.routers) {
if (router->expired)
continue;

if (router->tq == 0)
break;
}
Expand All @@ -641,6 +654,9 @@ static void update_tqs(void) {
}

foreach(router, G.routers) {
if (router->expired)
continue;

if (router->tq == 0) {
if (ether_addr_equal(router->originator, unspec))
DEBUG_MSG(
Expand All @@ -658,15 +674,15 @@ static void update_tqs(void) {
static void update_redirect(void) {
struct router *router;
struct timespec timeout = {
.tv_nsec = EBTABLES_TIMEOUT,
.tv_sec = EBTABLES_TIMEOUT,
};

foreach(router, G.routers) {
char mac[F_MAC_LEN + 1];
char addr[INET6_ADDRSTRLEN];
char prefix[INET6_ADDRSTRLEN];

if (router->redirected)
if (router->redirected || router->expired)
continue;
router->redirected = true;

Expand Down Expand Up @@ -770,7 +786,7 @@ static bool election_required(void)

static void update_ebtables(void) {
struct timespec timeout = {
.tv_nsec = EBTABLES_TIMEOUT,
.tv_sec = EBTABLES_TIMEOUT,
};
char mac[F_MAC_LEN + 1];
struct router *router;
Expand All @@ -784,6 +800,9 @@ static void update_ebtables(void) {
}

foreach(router, G.routers) {
if (router->expired)
continue;

if (router->tq == G.max_tq) {
snprintf(mac, sizeof(mac), F_MAC, F_MAC_VAR(router->src));
break;
Expand Down
Loading