diff --git a/src/apps/bridge/flooding.lua b/src/apps/bridge/flooding.lua index 6bac5f9196..7001ad7c83 100644 --- a/src/apps/bridge/flooding.lua +++ b/src/apps/bridge/flooding.lua @@ -21,20 +21,18 @@ function bridge:new (arg) end function bridge:push() - local src_ports = self._src_ports + local ports = self._ports local dst_ports = self._dst_ports - local output = self.output local i = 1 - while src_ports[i] do - local src_port = src_ports[i] - local l_in = self.input[src_port] + while ports[i] do + local l_in = ports[i].l_in while not empty(l_in) do - local ports = dst_ports[src_port] + local dst = dst_ports[i] local p = receive(l_in) - transmit(output[ports[1]], p) + transmit(ports[dst[1]].l_out, p) local j = 2 - while ports[j] do - transmit(output[ports[j]], clone(p)) + while dst[j] do + transmit(ports[dst[j]].l_out, clone(p)) j = j + 1 end end diff --git a/src/core/packet.lua b/src/core/packet.lua index 143bfdf920..1f8fc579a8 100644 --- a/src/core/packet.lua +++ b/src/core/packet.lua @@ -129,12 +129,6 @@ function free (p) free_internal(p) end --- Return pointer to packet data. -function data (p) return p.data end - --- Return packet data length. -function length (p) return p.length end - -- Set packet data length. function resize (p, len) assert(len <= max_payload, "packet payload overflow") diff --git a/src/lib/ipsec/esp.lua b/src/lib/ipsec/esp.lua index e8409acf39..5df0fdc6db 100644 --- a/src/lib/ipsec/esp.lua +++ b/src/lib/ipsec/esp.lua @@ -199,17 +199,17 @@ ABCDEFGHIJKLMNOPQRSTUVWXYZ local p_min = packet.from_string("012345678901234567890123456789012345678901234567890123") p_min.data[18] = 0 -- Set IPv6 payload length to zero p_min.data[19] = 0 -- ... - assert(packet.length(p_min) == PAYLOAD_OFFSET) - print("original", lib.hexdump(ffi.string(packet.data(p_min), packet.length(p_min)))) + assert(p_min.length == PAYLOAD_OFFSET) + print("original", lib.hexdump(ffi.string(p_min.data, p_min.length))) local e_min = packet.clone(p_min) assert(enc:encapsulate(e_min)) - print("encrypted", lib.hexdump(ffi.string(packet.data(e_min), packet.length(e_min)))) - assert(packet.length(e_min) == dec.MIN_SIZE+PAYLOAD_OFFSET) + print("encrypted", lib.hexdump(ffi.string(e_min.data, e_min.length))) + assert(e_min.length == dec.MIN_SIZE+PAYLOAD_OFFSET) assert(dec:decapsulate(e_min)) - print("decrypted", lib.hexdump(ffi.string(packet.data(e_min), packet.length(e_min)))) - assert(packet.length(e_min) == PAYLOAD_OFFSET) - assert(packet.length(p_min) == packet.length(e_min) - and C.memcmp(p_min, e_min, packet.length(p_min)) == 0, + print("decrypted", lib.hexdump(ffi.string(e_min.data, e_min.length))) + assert(e_min.length == PAYLOAD_OFFSET) + assert(p_min.length == e_min.length + and C.memcmp(p_min, e_min, p_min.length) == 0, "integrity check failed") -- Check transmitted Sequence Number wrap around enc.seq:low(0)