Commit f88eb1f4 authored by nanahira's avatar nanahira

remove origin

parent a2c30f4e
...@@ -18,7 +18,6 @@ handle_gateway() { ...@@ -18,7 +18,6 @@ handle_gateway() {
GATEWAY_ID=$1 GATEWAY_ID=$1
GATEWAY_ADDRESS=$2 GATEWAY_ADDRESS=$2
GATEWAY_MAC=$3 GATEWAY_MAC=$3
GATEWAY_NO_ORIGIN=$4
GATEWAY_NEXT_HOP_MARK=$((GATEWAY_ID + 1100)) GATEWAY_NEXT_HOP_MARK=$((GATEWAY_ID + 1100))
GATEWAY_SELECTION_MARK=$((GATEWAY_NEXT_HOP_MARK + 50)) GATEWAY_SELECTION_MARK=$((GATEWAY_NEXT_HOP_MARK + 50))
BRIDGE_IP=$(ip -4 addr show dev "$BRIDGE_NAME" | grep 'inet ' | awk '{print $2}') BRIDGE_IP=$(ip -4 addr show dev "$BRIDGE_NAME" | grep 'inet ' | awk '{print $2}')
...@@ -36,15 +35,13 @@ handle_gateway() { ...@@ -36,15 +35,13 @@ 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" == 0 ]]; then eth_origin -I "$BRIDGE_NAME" "$GATEWAY_ID" "$GATEWAY_ADDRESS" "$GATEWAY_MAC"
eth_origin -I "$BRIDGE_NAME" "$GATEWAY_ID" "$GATEWAY_ADDRESS" "$GATEWAY_MAC"
fi
} }
{% if br.gateways is defined and br.gateways %} {% if br.gateways is defined and br.gateways %}
# Gateways # Gateways
{% for gateway in br.gateways %} {% for gateway in br.gateways %}
handle_gateway {{gateway.id}} {{gateway.address}} {% if gateway.mac is defined and gateway.mac %}{{gateway.mac}}{% else %}"unknown"{% endif %} {% if gateway.noOrigin is defined and gateway.noOrigin %}1{% else %}0{% endif %} handle_gateway {{gateway.id}} {{gateway.address}} {% if gateway.mac is defined and gateway.mac %}{{gateway.mac}}{% else %}"unknown"{% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
......
...@@ -11,7 +11,6 @@ handle_gateway() { ...@@ -11,7 +11,6 @@ handle_gateway() {
GATEWAY_ID=$1 GATEWAY_ID=$1
GATEWAY_ADDRESS=$2 GATEWAY_ADDRESS=$2
GATEWAY_MAC=$3 GATEWAY_MAC=$3
GATEWAY_NO_ORIGIN=$4
GATEWAY_NEXT_HOP_MARK=$((GATEWAY_ID + 1100)) GATEWAY_NEXT_HOP_MARK=$((GATEWAY_ID + 1100))
GATEWAY_SELECTION_MARK=$((GATEWAY_NEXT_HOP_MARK + 50)) GATEWAY_SELECTION_MARK=$((GATEWAY_NEXT_HOP_MARK + 50))
BRIDGE_IP=$(ip -4 addr show dev "$BRIDGE_NAME" | grep 'inet ' | awk '{print $2}') BRIDGE_IP=$(ip -4 addr show dev "$BRIDGE_NAME" | grep 'inet ' | awk '{print $2}')
...@@ -24,15 +23,13 @@ handle_gateway() { ...@@ -24,15 +23,13 @@ handle_gateway() {
ip rule del pref 100 fwmark "$GATEWAY_NEXT_HOP_MARK" lookup "$GATEWAY_NEXT_HOP_MARK" ip rule del pref 100 fwmark "$GATEWAY_NEXT_HOP_MARK" lookup "$GATEWAY_NEXT_HOP_MARK"
ip rule del pref 400 fwmark "$GATEWAY_SELECTION_MARK" lookup "$GATEWAY_NEXT_HOP_MARK" ip rule del pref 400 fwmark "$GATEWAY_SELECTION_MARK" lookup "$GATEWAY_NEXT_HOP_MARK"
if [[ "$GATEWAY_NO_ORIGIN" == 0 ]]; then eth_origin -D "$BRIDGE_NAME" "$GATEWAY_ID" "$GATEWAY_ADDRESS" "$GATEWAY_MAC"
eth_origin -D "$BRIDGE_NAME" "$GATEWAY_ID" "$GATEWAY_ADDRESS" "$GATEWAY_MAC"
fi
} }
{% if br.gateways is defined and br.gateways %} {% if br.gateways is defined and br.gateways %}
# Gateways # Gateways
{% for gateway in br.gateways %} {% for gateway in br.gateways %}
handle_gateway {{gateway.id}} {{gateway.address}} {% if gateway.mac is defined and gateway.mac %}{{gateway.mac}}{% else %}"unknown"{% endif %} {% if gateway.noOrigin is defined and gateway.noOrigin %}1{% else %}0{% endif %} handle_gateway {{gateway.id}} {{gateway.address}} {% if gateway.mac is defined and gateway.mac %}{{gateway.mac}}{% else %}"unknown"{% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
......
...@@ -57,7 +57,6 @@ vars: ...@@ -57,7 +57,6 @@ vars:
- id: 0 # 网关ID,关乎mark和table。该网关的table计算方法为 1100+id - id: 0 # 网关ID,关乎mark和table。该网关的table计算方法为 1100+id
address: 10.198.21.1 # 网关地址,填写 _use_first 使用可用地址第一个,填写 _use_last 使用可用地址最后一个 address: 10.198.21.1 # 网关地址,填写 _use_first 使用可用地址第一个,填写 _use_last 使用可用地址最后一个
mac: null # 网关mac地址,为null则自动ping获取,但是bridge有启动坑容易获取失败 mac: null # 网关mac地址,为null则自动ping获取,但是bridge有启动坑容易获取失败
noOrigin: false # 是否关闭源进源出,对于专门peer的网关,这个可能很有用。
restartCron: '0 4 * * *' # 重启 crontab restartCron: '0 4 * * *' # 重启 crontab
up: null up: null
down: null down: null
......
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