Commit 3e8a3ebb authored by nanahira's avatar nanahira

gravity

parent cf703c3d
...@@ -43,7 +43,7 @@ handle_gateway() { ...@@ -43,7 +43,7 @@ handle_gateway() {
ip rule add pref 100 fwmark "$GATEWAY_NEXT_HOP_MARK" lookup "$GATEWAY_NEXT_HOP_MARK" ip rule add pref 100 fwmark "$GATEWAY_NEXT_HOP_MARK" lookup "$GATEWAY_NEXT_HOP_MARK"
ip rule add pref 400 fwmark "$GATEWAY_SELECTION_MARK" lookup "$GATEWAY_NEXT_HOP_MARK" ip rule add pref 400 fwmark "$GATEWAY_SELECTION_MARK" lookup "$GATEWAY_NEXT_HOP_MARK"
if [[ "$GATEWAY_NO_ORIGIN" -eq 0 ]]; then if [[ "$GATEWAY_NO_ORIGIN" -eq 0 ]]; then
eth_origin -A "$BRIDGE_NAME" "$GATEWAY_ID" "$GATEWAY_ADDRESS" "$GATEWAY_MAC" eth_origin -I "$BRIDGE_NAME" "$GATEWAY_ID" "$GATEWAY_ADDRESS" "$GATEWAY_MAC"
fi fi
} }
......
...@@ -38,6 +38,6 @@ fi ...@@ -38,6 +38,6 @@ fi
cd {{ansible_user_dir}}/nextgen-router/services/dnsmasq cd {{ansible_user_dir}}/nextgen-router/services/dnsmasq
docker-compose restart smartdns docker-compose restart smartdns
ppp_origin -A "$PPP_IFACE" ppp_origin -I "$PPP_IFACE"
true true
...@@ -12,9 +12,9 @@ ppp_origin() { ...@@ -12,9 +12,9 @@ ppp_origin() {
OPTION=$1 OPTION=$1
INTERFACE=$2 INTERFACE=$2
MARK=$[1000 + $(echo "$INTERFACE" | sed "s/ppp//g")] MARK=$[1000 + $(echo "$INTERFACE" | sed "s/ppp//g")]
restore_mark "$OPTION" "$MARK"
iptables -t mangle "$OPTION" PREROUTING ! -p ospf -i "$INTERFACE" -m set ! --match-set localnet src -j CONNMARK --set-xmark "$MARK" iptables -t mangle "$OPTION" PREROUTING ! -p ospf -i "$INTERFACE" -m set ! --match-set localnet src -j CONNMARK --set-xmark "$MARK"
# ip6tables -t mangle "$OPTION" PREROUTING ! -p ospf -i "$INTERFACE" -j CONNMARK --set-xmark "$MARK" # ip6tables -t mangle "$OPTION" PREROUTING ! -p ospf -i "$INTERFACE" -j CONNMARK --set-xmark "$MARK"
restore_mark "$OPTION" "$MARK"
} }
initialize_ipset() { initialize_ipset() {
...@@ -42,7 +42,7 @@ eth_origin() { ...@@ -42,7 +42,7 @@ eth_origin() {
NEIGH_LINE=$(ip neigh show "$GATEWAY_ADDRESS") NEIGH_LINE=$(ip neigh show "$GATEWAY_ADDRESS")
GATEWAY_MAC=$(echo $NEIGH_LINE | awk '{print $5}') GATEWAY_MAC=$(echo $NEIGH_LINE | awk '{print $5}')
fi fi
restore_mark "$OPTION" "$MARK"
iptables -t mangle "$OPTION" PREROUTING ! -p ospf -i "$BRIDGE_NAME" -m mac --mac-source "$GATEWAY_MAC" -m set ! --match-set localnet src -j CONNMARK --set-xmark "$MARK" iptables -t mangle "$OPTION" PREROUTING ! -p ospf -i "$BRIDGE_NAME" -m mac --mac-source "$GATEWAY_MAC" -m set ! --match-set localnet src -j CONNMARK --set-xmark "$MARK"
# ip6tables -t mangle "$OPTION" PREROUTING ! -p ospf -i "$BRIDGE_NAME" -m mac --mac-source "$GATEWAY_MAC" -m set ! --match-set localnet src -j CONNMARK --set-xmark "$MARK" # ip6tables -t mangle "$OPTION" PREROUTING ! -p ospf -i "$BRIDGE_NAME" -m mac --mac-source "$GATEWAY_MAC" -m set ! --match-set localnet src -j CONNMARK --set-xmark "$MARK"
restore_mark "$OPTION" "$MARK"
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment