Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
network-defaults: prohibit traffic to net on ffuplink
this hotplug-script probibits all traffic to nodes on the upstream-network of ffuplink-interface. Only traffic to not directly attached networks is accepted. This script also sets up the default route for all traffic reaching the "ffuplink" routing-table. this all honors the settings of * ffwizard.sharenet * freifunk-policyrouting.enable
- Loading branch information
1 parent
eb5fe0f
commit 0d671b3
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
defaults/freifunk-berlin-network-defaults/hotplug.d/iface/60-ffuplink_policyrouting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
|
||
. /lib/functions.sh | ||
. /lib/functions/network.sh | ||
|
||
[ "$INTERFACE" = ffuplink ] || exit | ||
|
||
config_load ffwizard | ||
config_get sharenet settings sharenet | ||
[ "$sharenet" = 1 ] || exit | ||
|
||
config_load freifunk-policyrouting | ||
config_get pr_enable pr enable | ||
config_get fallback pr fallback | ||
config_get strict pr strict | ||
config_get zones pr zones | ||
[ "$pr_enable" = 1 ] || exit | ||
|
||
if [ "$ACTION" = ifup ]; then | ||
logger -t ff-userlog "ffuplink interface is up" | ||
logger -t ff-userlog "prohibiting traffic to net on ffuplink-interface" | ||
network_get_subnet uplink_net ffuplink | ||
eval $(/bin/ipcalc.sh $uplink_net) | ||
ip route add prohibit $NETWORK/$PREFIX table ffuplink | ||
logger -t ff-userlog "setting defaultroute via ffuplink-interface for interfaces of zone $zones" | ||
network_get_gateway gw ffuplink | ||
ip route add default via $gw dev ffuplink table ffuplink | ||
logger -t ff-userlog "ffuplink-interface is setup" | ||
fi | ||
|
||
if [ "$ACTION" = ifdown ]; then | ||
logger -t ff-userlog "ffuplink interface going down" | ||
ip route flush table ffuplink | ||
fi |