Commit 64f8c377 authored by nanahira's avatar nanahira

unfinished

parent c22977a2
...@@ -26,37 +26,25 @@ protocol kernel { ...@@ -26,37 +26,25 @@ protocol kernel {
ipv6 { export all; }; ipv6 { export all; };
} }
ipv4 table a; {% for connection in connections %}
{% if connection.type != "null" and connection.remoteLocalAddress != address %}
ipv4 table {{connection.name}};
protocol static { protocol static {
ipv4 { ipv4 {
table a; table {{connection.name}};
}; };
igp table master4; igp table master4;
route 0.0.0.0/0 recursive 10.199.0.12; route 0.0.0.0/0 recursive {{connection.remoteLocalAddress}};
} }
protocol kernel { protocol kernel {
ipv4 { ipv4 {
table a; table {{connection.name}};
export all; export all;
}; };
kernel table 301; kernel table {{connection.remoteGatewayMark}};
}
ipv4 table b;
protocol static {
ipv4 {
table b;
};
igp table master4;
route 0.0.0.0/0 recursive 10.199.0.10;
}
protocol kernel {
ipv4 {
table b;
export all;
};
kernel table 302;
} }
{% endif %}
{% endfor %}
protocol ospf v2 { protocol ospf v2 {
ipv4 { ipv4 {
...@@ -73,6 +61,7 @@ protocol ospf v2 { ...@@ -73,6 +61,7 @@ protocol ospf v2 {
# hello 5; # Default hello perid 10 is too long # hello 5; # Default hello perid 10 is too long
# }; # };
{% for connection in connections %} {% for connection in connections %}
{% if connection.type != "null" and connection.remoteLocalAddress != address %}
interface "{{connection.name}}" { interface "{{connection.name}}" {
type ptp; type ptp;
{% if connection.outbound %} {% if connection.outbound %}
...@@ -82,6 +71,7 @@ protocol ospf v2 { ...@@ -82,6 +71,7 @@ protocol ospf v2 {
{% endif %} {% endif %}
hello 5; hello 5;
}; };
{% endif %}
{% endfor %} {% endfor %}
interface "dummy0" { interface "dummy0" {
stub; # Stub interface, just propagate it stub; # Stub interface, just propagate it
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
ip addr add "$localPeerAddress" peer "$remotePeerAddress" dev "$dev" scope link ip addr add "$localPeerAddress" peer "$remotePeerAddress" dev "$dev" scope link
if [ "$outbound" == True ] ; then if [ "$outbound" == True ] ; then
ip route add default dev "$dev" table "$remoteMark" #ip route add default dev "$dev" table "$remoteMark"
ip rule add fwmark "$remoteMark" table "$remoteMark" pref 300 ip rule add fwmark "$remoteMark" table "$remoteMark" pref 300
fi fi
......
...@@ -80,8 +80,10 @@ class InventoryBuilder { ...@@ -80,8 +80,10 @@ class InventoryBuilder {
const localGatewayMark = localGatewayName ? localGateway.mark : undefined; const localGatewayMark = localGatewayName ? localGateway.mark : undefined;
const remoteGatewayName = (cis ? params.rif : params.lif) || params.if; const remoteGatewayName = (cis ? params.rif : params.lif) || params.if;
const remoteGateway = remoteGatewayName ? this.gateways[remote.name][remoteGatewayName] : _.find(this.gateways[remote.name]); const remoteGateway = remoteGatewayName ? this.gateways[remote.name][remoteGatewayName] : _.find(this.gateways[remote.name]);
const remoteGatewayMark = remoteGatewayMark ? remoteGateway.mark : undefined;
//console.log(remoteGateway.name); //console.log(remoteGateway.name);
const remoteAddress = remoteGateway.address; const remoteAddress = remoteGateway.address;
const remoteLocalAddress = remote.address;
const remoteMark = remote.mark; const remoteMark = remote.mark;
const localPort = primary ? remote.port : remote.port2; const localPort = primary ? remote.port : remote.port2;
const remotePort = primary ? local.port : local.port2; const remotePort = primary ? local.port : local.port2;
...@@ -98,8 +100,10 @@ class InventoryBuilder { ...@@ -98,8 +100,10 @@ class InventoryBuilder {
protocol, protocol,
params, params,
localGatewayMark, localGatewayMark,
remoteGatewayMark,
remoteMark, remoteMark,
remoteAddress, remoteAddress,
remoteLocalAddress,
localPort, localPort,
remotePort, remotePort,
wgPublicKey, wgPublicKey,
......
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