Skip to content

Commit

Permalink
implement new address filter based on default route availability (#179)
Browse files Browse the repository at this point in the history
* use mptcpd_addr_info to store known address list

instead of using a plain sockaddr, use the mptcpd_addr_info
structure, so that we can more easily include additional
metadata.

Additionally change the mptcpd_addr_info layout so that this
don't break existing interface->addrs users.

This make address management more efficent and will simplify
the next patch.

* add configuration flag for default route check

This only adds the configuration-related bits, the
actual check implementation is in the next patch.

* implement route check for address notification

if the relevant flag is enabled, do a route lookup for a
default route at address creation time and notify the
new address only if such route is found.

In case of failure re-schedule the check with a small timeout
and exponential backoff up to 3 times. That is intended to
cope with e.g. DHCP clients configuring the address and the
relevant route in order.

Note that route lookup is async, an racing address removal can
try to delete the relevant address object before the route lookup
completes. Implement a simple refcount mechanism on the mptcp
address object to avoid such issue.

In a similar manner, route lookup can race with interface deletion.
Instead of adding another ref-count, just lookup again the interface
via the known ifindex in the async operation.

Finally default route lookup for ipv4 does not really work on the Linux
kernel: 'ip route get 0.0.0.0 ...' always returns a loopback route. To
fetch the default route, lookup for a test-only address: as no host/network
should use it, it should be reachable only via the default route.

The gitlab workflows is update accordingly, explicitly building
and installing the minimal required libell version
  • Loading branch information
pabeni authored Nov 29, 2021
1 parent d3e3821 commit fda8f3e
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 77 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: dependencies
run: sudo apt-get -y install autoconf-archive libell-dev pandoc
run: sudo apt-get -y install autoconf-archive pandoc git
- name: build and install ELL
run: |
git clone git://git.kernel.org/pub/scm/libs/ell/ell.git
cd ell
git checkout 0.30
./bootstrap
./configure --prefix=/usr
sudo make install
- name: bootstrap
run: ./bootstrap
- name: configure
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: dependencies
run: sudo apt-get -y install autoconf-archive libell-dev lcov
run: sudo apt-get -y install autoconf-archive lcov pandoc git
- name: build and install ELL
run: |
git clone git://git.kernel.org/pub/scm/libs/ell/ell.git
cd ell
git checkout 0.30
./bootstrap
./configure --prefix=/usr
sudo make install
- name: bootstrap
run: ./bootstrap
- name: configure
Expand Down
3 changes: 3 additions & 0 deletions include/mptcpd/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ typedef uint32_t mptcpd_flags_t;
/// Ignore host (loopback) addresses.
#define MPTCPD_NOTIFY_FLAG_SKIP_HOST (1U << 2)

/// Notify address only if a default route is available from the given interface
#define MPTCPD_NOTIFY_FLAG_ROUTE_CHECK (1U << 3)

/**
* @enum mptcpd_limit_types
*
Expand Down
Loading

0 comments on commit fda8f3e

Please sign in to comment.