Skip to content

Commit

Permalink
Merge pull request snabbco#224 from Igalia/lwsf_b4mac
Browse files Browse the repository at this point in the history
Renamed b4_mac to next_hop6_mac
  • Loading branch information
kbara committed Feb 5, 2016
2 parents ff573ec + 4e2883a commit 95c8725
Show file tree
Hide file tree
Showing 23 changed files with 35 additions and 31 deletions.
10 changes: 5 additions & 5 deletions src/apps/lwaftr/conf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ local lwaftr_conf_spec = {
aftr_ipv6_ip=Parser.parse_ipv6,
aftr_mac_b4_side=Parser.parse_mac,
aftr_mac_inet_side=Parser.parse_mac,
b4_mac=Parser.parse_mac,
next_hop6_mac=Parser.parse_mac,
binding_table=Parser.parse_file_name,
hairpinning=Parser.parse_boolean,
icmpv6_rate_limiter_n_packets=Parser.parse_non_negative_number,
Expand All @@ -68,15 +68,15 @@ local lwaftr_conf_spec = {
aftr_ipv6_ip=required('aftr_ipv6_ip'),
aftr_mac_b4_side=required('aftr_mac_b4_side'),
aftr_mac_inet_side=required('aftr_mac_inet_side'),
b4_mac=required_at_least_one_of('b4_mac', 'next_hop_ipv6_addr'),
next_hop6_mac=required_at_least_one_of('next_hop6_mac', 'next_hop_ipv6_addr'),
binding_table=required('binding_table'),
hairpinning=default(true),
icmpv6_rate_limiter_n_packets=default(6e5),
icmpv6_rate_limiter_n_seconds=default(2),
inet_mac=required('inet_mac'),
ipv4_mtu=default(1460),
ipv6_mtu=default(1500),
next_hop_ipv6_addr = required_at_least_one_of('next_hop_ipv6_addr', 'b4_mac'),
next_hop_ipv6_addr = required_at_least_one_of('next_hop_ipv6_addr', 'next_hop6_mac'),
policy_icmpv4_incoming=default(policies.ALLOW),
policy_icmpv4_outgoing=default(policies.ALLOW),
policy_icmpv6_incoming=default(policies.ALLOW),
Expand Down Expand Up @@ -120,7 +120,7 @@ function selftest()
aftr_ipv6_ip = 8:9:a:b:c:d:e:f
aftr_mac_b4_side = 22:22:22:22:22:22
aftr_mac_inet_side = 12:12:12:12:12:12
b4_mac = 44:44:44:44:44:44
next_hop6_mac = 44:44:44:44:44:44
binding_table = "foo-table.txt"
hairpinning = false
icmpv6_rate_limiter_n_packets=6e3
Expand All @@ -141,7 +141,7 @@ function selftest()
aftr_ipv6_ip = ipv6:pton('8:9:a:b:c:d:e:f'),
aftr_mac_b4_side = ethernet:pton("22:22:22:22:22:22"),
aftr_mac_inet_side = ethernet:pton("12:12:12:12:12:12"),
b4_mac = ethernet:pton("44:44:44:44:44:44"),
next_hop6_mac = ethernet:pton("44:44:44:44:44:44"),
binding_table = "foo-table.txt",
hairpinning = false,
icmpv6_rate_limiter_n_packets=6e3,
Expand Down
2 changes: 1 addition & 1 deletion src/apps/lwaftr/dump.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ end
function dump_configuration(lwstate)
print("Dump configuration")
local result = {}
local etharr = set('aftr_mac_b4_side', 'aftr_mac_inet_side', 'b4_mac', 'inet_mac')
local etharr = set('aftr_mac_b4_side', 'aftr_mac_inet_side', 'next_hop6_mac', 'inet_mac')
local ipv4arr = set('aftr_ipv4_ip')
local ipv6arr = set('aftr_ipv6_ip')
local val
Expand Down
10 changes: 5 additions & 5 deletions src/apps/lwaftr/lwaftr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function LwAftr:new(conf)
o.aftr_ipv6_ip = conf.aftr_ipv6_ip
o.aftr_mac_b4_side = conf.aftr_mac_b4_side
o.aftr_mac_inet_side = conf.aftr_mac_inet_side
o.b4_mac = conf.b4_mac or ethernet:pton("00:00:00:00:00:00")
o.next_hop6_mac = conf.next_hop6_mac or ethernet:pton("00:00:00:00:00:00")
o.hairpinning = conf.hairpinning
o.icmpv6_rate_limiter_n_packets = conf.icmpv6_rate_limiter_n_packets
o.icmpv6_rate_limiter_n_seconds = conf.icmpv6_rate_limiter_n_seconds
Expand Down Expand Up @@ -296,7 +296,7 @@ local function icmp_b4_lookup_failed(lwstate, pkt, to_ip)
local icmp_config = {type = constants.icmpv6_dst_unreachable,
code = constants.icmpv6_failed_ingress_egress_policy,
}
local b4fail_icmp = icmp.new_icmpv6_packet(lwstate.aftr_mac_b4_side, lwstate.b4_mac,
local b4fail_icmp = icmp.new_icmpv6_packet(lwstate.aftr_mac_b4_side, lwstate.next_hop6_mac,
lwstate.aftr_ipv6_ip, to_ip, pkt,
ethernet_header_size, icmp_config)
transmit_icmpv6_with_rate_limit(lwstate.o6, b4fail_icmp)
Expand Down Expand Up @@ -401,7 +401,7 @@ local function icmpv4_incoming(lwstate, pkt)
-- Otherwise, the packet MUST be forwarded
local next_hdr = proto_ipv4
return ipv6_encapsulate(lwstate, pkt, next_hdr, ipv6_src, ipv6_dst,
lwstate.aftr_mac_b4_side, lwstate.b4_mac)
lwstate.aftr_mac_b4_side, lwstate.next_hop6_mac)
end

-- The incoming packet is a complete one with ethernet headers.
Expand Down Expand Up @@ -439,7 +439,7 @@ local function from_inet(lwstate, pkt)
end

local ether_src = lwstate.aftr_mac_b4_side
local ether_dst = lwstate.b4_mac -- FIXME: this should probaby use NDP
local ether_dst = lwstate.next_hop6_mac

-- Do not encapsulate packets that now have a ttl of zero or wrapped around
local ttl = decrement_ttl(pkt)
Expand Down Expand Up @@ -569,7 +569,7 @@ local function from_b4(lwstate, pkt)
if lwstate.hairpinning and ipv4_in_binding_table(lwstate, ipv4_dst_ip) then
-- Remove IPv6 header.
packet.shiftleft(pkt, ipv6_fixed_header_size)
write_eth_header(pkt.data, lwstate.b4_mac, lwstate.aftr_mac_b4_side,
write_eth_header(pkt.data, lwstate.next_hop6_mac, lwstate.aftr_mac_b4_side,
n_ethertype_ipv4)
-- TODO: refactor so this doesn't actually seem to be from the internet?
return from_inet(lwstate, pkt)
Expand Down
4 changes: 4 additions & 0 deletions src/program/lwaftr/doc/README.breaking_changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Breaking changes since the October 2015 alpha release

- b4_mac has been renamed next_hop6_mac, as the next hop on the internal IPv6
network is not actually a B4, just on the route to them.
4 changes: 2 additions & 2 deletions src/program/lwaftr/doc/README.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ aftr_ipv4_ip = 10.10.10.10
aftr_ipv6_ip = 8:9:a:b:c:d:e:f
aftr_mac_b4_side = 22:22:22:22:22:22
aftr_mac_inet_side = 12:12:12:12:12:12
b4_mac = 44:44:44:44:44:44
next_hop6_mac = 44:44:44:44:44:44
binding_table = path/to/binding.table
hairpinning = true
icmpv6_rate_limiter_n_packets=3e5
Expand Down Expand Up @@ -51,7 +51,7 @@ it will talk directly to only one host on each side, and specifies their MAC
addresses for the outgoing packets.

```lua
b4_mac = 44:44:44:44:44:44
next_hop6_mac = 44:44:44:44:44:44
inet_mac = 68:68:68:68:68:68
```

Expand Down
2 changes: 1 addition & 1 deletion src/program/lwaftr/setup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function lwaftr_app(c, conf)
{ mtu=conf.ipv6_mtu })
config.app(c, "ndp", ipv6_apps.NDP,
{ src_ipv6 = conf.aftr_ipv6_ip, src_eth = conf.aftr_mac_b4_side,
dst_eth = conf.b4_mac, dst_ipv6 = conf.next_hop_ipv6_addr,
dst_eth = conf.next_hop6_mac, dst_ipv6 = conf.next_hop_ipv6_addr,
all_ipv6_addrs = conf.preloaded_binding_table:get_br_addresses() })

local preprocessing_apps_v4 = { "reassemblerv4" }
Expand Down
2 changes: 1 addition & 1 deletion src/program/lwaftr/tests/data/icmp_on_fail.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1460,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = DROP,
policy_icmpv6_incoming = DROP,
policy_icmpv4_outgoing = ALLOW,
Expand Down
2 changes: 1 addition & 1 deletion src/program/lwaftr/tests/data/icmp_on_fail_vlan.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1460,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = DROP,
policy_icmpv6_incoming = DROP,
policy_icmpv4_outgoing = ALLOW,
Expand Down
2 changes: 1 addition & 1 deletion src/program/lwaftr/tests/data/no_hairpin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = false,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1460,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = DROP,
policy_icmpv6_incoming = DROP,
policy_icmpv4_outgoing = DROP,
Expand Down
2 changes: 1 addition & 1 deletion src/program/lwaftr/tests/data/no_hairpin_vlan.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = false,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1460,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = DROP,
policy_icmpv6_incoming = DROP,
policy_icmpv4_outgoing = DROP,
Expand Down
2 changes: 1 addition & 1 deletion src/program/lwaftr/tests/data/no_icmp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1460,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = DROP,
policy_icmpv6_incoming = DROP,
policy_icmpv4_outgoing = DROP,
Expand Down
2 changes: 1 addition & 1 deletion src/program/lwaftr/tests/data/no_icmp_vlan.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1460,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = DROP,
policy_icmpv6_incoming = DROP,
policy_icmpv4_outgoing = DROP,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1460,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = DROP,
policy_icmpv6_incoming = DROP,
policy_icmpv4_outgoing = DROP,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1460,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = DROP,
policy_icmpv6_incoming = DROP,
policy_icmpv4_outgoing = DROP,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1460,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = DROP,
policy_icmpv6_incoming = DROP,
policy_icmpv4_outgoing = DROP,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1460,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = DROP,
policy_icmpv6_incoming = DROP,
policy_icmpv4_outgoing = DROP,
Expand Down
2 changes: 1 addition & 1 deletion src/program/lwaftr/tests/data/small_ipv4_mtu_icmp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 576,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = ALLOW,
policy_icmpv6_incoming = ALLOW,
policy_icmpv4_outgoing = ALLOW,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 576,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = ALLOW,
policy_icmpv6_incoming = ALLOW,
policy_icmpv4_outgoing = ALLOW,
Expand Down
2 changes: 1 addition & 1 deletion src/program/lwaftr/tests/data/small_ipv6_mtu_no_icmp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1500,
ipv6_mtu = 1280,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = DROP,
policy_icmpv6_incoming = DROP,
policy_icmpv4_outgoing = DROP,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1500,
ipv6_mtu = 1280,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = DROP,
policy_icmpv6_incoming = DROP,
policy_icmpv4_outgoing = DROP,
Expand Down
2 changes: 1 addition & 1 deletion src/program/lwaftr/tests/data/tunnel_icmp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1460,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = ALLOW,
policy_icmpv6_incoming = ALLOW,
policy_icmpv4_outgoing = ALLOW,
Expand Down
2 changes: 1 addition & 1 deletion src/program/lwaftr/tests/data/tunnel_icmp_vlan.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ aftr_ipv4_ip = 10.10.10.10,
aftr_ipv6_ip = 8:9:a:b:c:d:e:f,
aftr_mac_b4_side = 22:22:22:22:22:22,
aftr_mac_inet_side = 12:12:12:12:12:12,
b4_mac = 44:44:44:44:44:44,
binding_table = binding-table.txt,
hairpinning = true,
icmpv6_rate_limiter_n_packets=6e5,
icmpv6_rate_limiter_n_seconds=2,
inet_mac = 68:68:68:68:68:68,
ipv4_mtu = 1460,
ipv6_mtu = 1500,
next_hop6_mac = 44:44:44:44:44:44,
policy_icmpv4_incoming = ALLOW,
policy_icmpv6_incoming = ALLOW,
policy_icmpv4_outgoing = ALLOW,
Expand Down
Loading

0 comments on commit 95c8725

Please sign in to comment.