MoonGen
 All Files Functions Variables Pages
arp.lua
Go to the documentation of this file.
1 ------------------------------------------------------------------------
2 --- @file arp.lua
3 --- @brief Address resolution protocol (ARP) utility.
4 --- Utility functions for the arp_header struct
5 --- defined in \ref headers.lua . \n
6 --- Includes:
7 --- - Arp constants
8 --- - Arp address utility
9 --- - Arp header utility
10 --- - Definition of Arp packets
11 --- - Arp handler task
12 ------------------------------------------------------------------------
13 
14 local ffi = require "ffi"
15 local pkt = require "packet"
16 
17 require "headers"
18 local dpdkc = require "dpdkc"
19 local dpdk = require "dpdk"
20 local memory = require "memory"
21 local filter = require "filter"
22 local ns = require "namespaces"
23 
24 local eth = require "proto.ethernet"
25 
26 local ntoh, hton = ntoh, hton
27 local ntoh16, hton16 = ntoh16, hton16
28 local bor, band, bnot, rshift, lshift= bit.bor, bit.band, bit.bnot, bit.rshift, bit.lshift
29 local format = string.format
30 local istype = ffi.istype
31 
32 
33 --------------------------------------------------------------------------------------------------------
34 ---- ARP constants (c.f. http://www.iana.org/assignments/arp-parameters/arp-parameters.xhtml)
35 --------------------------------------------------------------------------------------------------------
36 
37 --- Arp protocol constants
38 local arp = {}
39 
40 --- Hardware address type for ethernet
41 arp.HARDWARE_ADDRESS_TYPE_ETHERNET = 1
42 
43 --- Proto address type for IP (for ethernet based protocols uses etherType numbers \ref ethernet.lua)
44 arp.PROTO_ADDRESS_TYPE_IP = 0x0800
45 
46 --- Operation: request
47 arp.OP_REQUEST = 1
48 --- Operation: reply
49 arp.OP_REPLY = 2
50 
51 
52 --------------------------------------------------------------------------------------------------------
53 ---- ARP header
54 --------------------------------------------------------------------------------------------------------
55 
56 --- Module for arp_header struct (see \ref headers.lua).
57 local arpHeader = {}
58 arpHeader.__index = arpHeader
59 
60 --- Set the hardware address type.
61 --- @param int Type as 16 bit integer.
64  self.hrd = hton16(int)
65 end
66 
67 --- Retrieve the hardware address type.
68 --- @return Type as 16 bit integer.
70  return hton16(self.hrd)
71 end
72 
73 --- Retrieve the hardware address type.
74 --- @return Type in string format.
76  local type = self:getHardwareAddressType()
77  if type == arp.HARDWARE_ADDRESS_TYPE_ETHERNET then
78  return "Ethernet"
79  else
80  return format("0x%04x", type)
81  end
82 end
83 
84 --- Set the protocol address type.
85 --- @param int Type as 16 bit integer.
86 function arpHeader:setProtoAddressType(int)
87  int = int or arp.PROTO_ADDRESS_TYPE_IP
88  self.pro = hton16(int)
89 end
90 
91 --- Retrieve the protocol address type.
92 --- @return Type as 16 bit integer.
94  return hton16(self.pro)
95 end
96 
97 --- Retrieve the protocol address type.
98 --- @return Type in string format.
100  local type = self:getProtoAddressType()
101  if type == arp.PROTO_ADDR_TYPE_IP then
102  return "IPv4"
103  else
104  return format("0x%04x", type)
105  end
106 end
107 
108 --- Set the hardware address length.
109 --- @param int Length as 8 bit integer.
111  int = int or 6
112  self.hln = int
113 end
114 
115 --- Retrieve the hardware address length.
116 --- @return Length as 8 bit integer.
118  return self.hln
119 end
120 
121 --- Retrieve the hardware address length.
122 --- @return Length in string format.
124  return self:getHardwareAddressLength()
125 end
126 
127 --- Set the protocol address length.
128 --- @param int Length as 8 bit integer.
129 function arpHeader:setProtoAddressLength(int)
130  int = int or 4
131  self.pln = int
132 end
133 
134 --- Retrieve the protocol address length.
135 --- @return Length as 8 bit integer.
137  return self.pln
138 end
139 
140 --- Retrieve the protocol address length.
141 --- @return Length in string format.
143  return self:getProtoAddressLength()
144 end
145 
146 --- Set the operation.
147 --- @param int Operation as 16 bit integer.
148 function arpHeader:setOperation(int)
149  int = int or arp.OP_REQUEST
150  self.op = hton16(int)
151 end
152 
153 --- Retrieve the operation.
154 --- @return Operation as 16 bit integer.
155 function arpHeader:getOperation()
156  return hton16(self.op)
157 end
158 
159 --- Retrieve the operation.
160 --- @return Operation in string format.
161 function arpHeader:getOperationString()
162  local op = self:getOperation()
163  if op == arp.OP_REQUEST then
164  return "Request"
165  elseif op == arp.OP_REPLY then
166  return "Reply"
167  else
168  return op
169  end
170 end
171 
172 --- Set the hardware source address.
173 --- @param addr Address in 'struct mac_address' format.
174 function arpHeader:setHardwareSrc(addr)
175  self.sha:set(addr)
176 end
177 
178 --- Retrieve the hardware source address.
179 --- @return Address in 'struct mac_address' format.
180 function arpHeader:getHardwareSrc()
181  return self.sha:get()
182 end
183 
184 --- Set the hardware source address.
185 --- @param addr Address in string format.
186 function arpHeader:setHardwareSrcString(addr)
187  self.sha:setString(addr)
188 end
189 
190 --- Retrieve the hardware source address.
191 --- @return Address in string format.
193  return self.sha:getString()
194 end
195 
196 --- Set the hardware destination address.
197 --- @param addr Address in 'struct mac_address' format.
198 function arpHeader:setHardwareDst(addr)
199  self.tha:set(addr)
200 end
201 
202 --- Retrieve the hardware destination address.
203 --- @return Address in 'struct mac_address' format.
204 function arpHeader:getHardwareDst()
205  return self.tha:get()
206 end
207 
208 --- Set the hardware destination address.
209 --- @param addr Address in string format.
210 function arpHeader:setHardwareDstString(addr)
211  self.tha:setString(addr)
212 end
213 
214 --- Retrieve the hardware destination address.
215 --- @return Address in string format.
217  return self.tha:getString()
218 end
219 
220 --- Set the protocol source address.
221 --- @param addr Address in 'struct ip4_address' format.
222 function arpHeader:setProtoSrc(addr)
223  self.spa:set(addr)
224 end
226 --- Retrieve the protocol source address.
227 --- @return Address in 'struct ip4_address' format.
228 function arpHeader:getProtoSrc()
229  return self.spa:get()
230 end
231 
232 --- Set the protocol source address.
233 --- @param addr Address in source format.
234 function arpHeader:setProtoSrcString(addr)
235  self.spa:setString(addr)
236 end
238 --- Retrieve the protocol source address.
239 --- @return Address in string format.
240 function arpHeader:getProtoSrcString()
241  return self.spa:getString()
242 end
243 
244 --- Set the protocol destination address.
245 --- @param addr Address in 'struct ip4_address' format.
246 function arpHeader:setProtoDst(addr)
247  self.tpa:set(addr)
248 end
249 
250 --- Retrieve the protocol destination address.
251 --- @return Address in 'struct ip4_address' format.
252 function arpHeader:getProtoDst()
253  return self.tpa:get()
254 end
255 
256 --- Set the protocol destination address.
257 --- @param addr Address in string format.
258 function arpHeader:setProtoDstString(addr)
259  self.tpa:setString(addr)
260 end
261 
262 --- Retrieve the protocol destination address.
263 --- @return Address in string format.
264 function arpHeader:getProtoDstString()
265  return self.tpa:getString()
266 end
267 
268 --- Set all members of the ip header.
269 --- Per default, all members are set to default values specified in the respective set function.
270 --- Optional named arguments can be used to set a member to a user-provided value.
271 --- @param args Table of named arguments. Available arguments: HardwareAddressType, ProtoAddressType, HardwareAddressLength, ProtoAddressLength, Operation, HardwareSrc, HardwareDst, ProtoSrc, ProtoDst
272 --- @param pre prefix for namedArgs. Default 'arp'.
273 --- @code
274 --- fill() --- only default values
275 --- fill{ arpOperation=2, ipTTL=100 } --- all members are set to default values with the exception of arpOperation
276 --- @endcode
277 function arpHeader:fill(args, pre)
278  args = args or {}
279  pre = pre or "arp"
280 
281  self:setHardwareAddressType(args[pre .. "HardwareAddressType"])
282  self:setProtoAddressType(args[pre .. "ProtoAddressType"])
283  self:setHardwareAddressLength(args[pre .. "HardwareAddressLength"])
284  self:setProtoAddressLength(args[pre .. "ProtoAddressLength"])
285  self:setOperation(args[pre .. "Operation"])
286 
287  local hwSrc = pre .. "HardwareSrc"
288  local hwDst = pre .. "HardwareDst"
289  local prSrc = pre .. "ProtoSrc"
290  local prDst = pre .. "ProtoDst"
291  args[hwSrc] = args[hwSrc] or "01:02:03:04:05:06"
292  args[hwDst] = args[hwDst] or "07:08:09:0a:0b:0c"
293  args[prSrc] = args[prSrc] or "0.1.2.3"
294  args[prDst] = args[prDst] or "4.5.6.7"
295 
296  -- if for some reason the address is in 'struct mac_address'/'union ipv4_address' format, cope with it
297  if type(args[hwSrc]) == "string" then
298  self:setHardwareSrcString(args[hwSrc])
299  else
300  self:setHardwareSrc(args[hwSrc])
301  end
302  if type(args[hwDst]) == "string" then
303  self:setHardwareDstString(args[hwDst])
304  else
305  self:setHardwareDst(args[hwDst])
306  end
307 
308  if type(args[prSrc]) == "string" then
309  self:setProtoSrcString(args[prSrc])
310  else
311  self:setProtoSrc(args[prSrc])
312  end
313  if type(args[prDst]) == "string" then
314  self:setProtoDstString(args[prDst])
315  else
316  self:setProtoDst(args[prDst])
317  end
318 end
319 
320 --- Retrieve the values of all members.
321 --- @param pre prefix for namedArgs. Default 'arp'.
322 --- @return Table of named arguments. For a list of arguments see "See also".
323 --- @see arpHeader:fill
324 function arpHeader:get(pre)
325  pre = pre or "arp"
326 
327  local args = {}
328  args[pre .. "HardwareAddressType"] = self:getHardwareAddressType()
329  args[pre .. "ProtoAddressType"] = self:getProtoAddressType()
330  args[pre .. "HardwareAddressLength"] = self:getHardwareAddressLength()
331  args[pre .. "ProtoAddressLength"] = self:getProtoAddressLength()
332  args[pre .. "Operation"] = self:getOperation()
333  args[pre .. "HardwareSrc"] = self:getHardwareSrc()
334  args[pre .. "HardwareDst"] = self:getHardwareDst()
335  args[pre .. "ProtoSrc"] = self:getProtoSrc()
336  args[pre .. "ProtoDst"] = self:getProtoDst()
337 
338  return args
339 end
340 
341 --- Retrieve the values of all members.
342 --- @return Values in string format.
343 function arpHeader:getString()
344  local str = "ARP hrd " .. self:getHardwareAddressTypeString()
345  .. " (hln " .. self:getHardwareAddressLengthString()
346  .. ") pro " .. self:getProtoAddressTypeString()
347  .. " (pln " .. self:getProtoAddressLength(String)
348  .. ") op " .. self:getOperationString()
349 
350  local op = self:getOperation()
351  if op == arp.OP_REQUEST then
352  str = str .. " who-has " .. self:getProtoDstString()
353  .. " (" .. self:getHardwareDstString()
354  .. ") tell " .. self:getProtoSrcString()
355  .. " (" .. self:getHardwareSrcString()
356  .. ")"
357  elseif op == arp.OP_REPLY then
358  str = str .. " " .. self:getProtoSrcString()
359  .. " is-at " .. self:getHardwareSrcString()
360  .. " (for " .. self:getProtoDstString()
361  .. " @ " .. self:getHardwareDstString()
362  .. ")"
363  else
364  str = str .. " " .. self:getHardwareSrcString()
365  .. " > " .. self:getHardwareDstString()
366  .. " " .. self:getProtoSrcString()
367  .. " > " .. self:getProtoDstString()
368  end
369 
370  return str
371 end
372 
373 --- Resolve which header comes after this one (in a packet).
374 --- For instance: in tcp/udp based on the ports.
375 --- This function must exist and is only used when get/dump is executed on
376 --- an unknown (mbuf not yet casted to e.g. tcpv6 packet) packet (mbuf)
377 --- @return String next header (e.g. 'udp', 'icmp', nil)
378 function arpHeader:resolveNextHeader()
379  return nil
380 end
381 
382 --- Change the default values for namedArguments (for fill/get).
383 --- This can be used to for instance calculate a length value based on the total packet length.
384 --- See proto/ip4.setDefaultNamedArgs as an example.
385 --- This function must exist and is only used by packet.fill.
386 --- @param pre The prefix used for the namedArgs, e.g. 'arp'
387 --- @param namedArgs Table of named arguments (see See Also)
388 --- @param nextHeader The header following after this header in a packet
389 --- @param accumulatedLength The so far accumulated length for previous headers in a packet
390 --- @return Table of namedArgs
391 --- @see arpHeader:fill
392 function arpHeader:setDefaultNamedArgs(pre, namedArgs, nextHeader, accumulatedLength)
393  return namedArgs
394 end
395 
396 ---------------------------------------------------------------------------------
397 ---- Packets
398 ---------------------------------------------------------------------------------
399 
400 --- Cast the packet to an Arp packet
402 
403 
404 ---------------------------------------------------------------------------------
405 ---- ARP Handler Task
406 ---------------------------------------------------------------------------------
407 
408 --- Arp handler task, responds to ARP queries for given IPs and performs arp lookups
409 --- @todo TODO implement garbage collection/refreshing entries \n
410 --- the current implementation does not handle large tables efficiently \n
411 --- @todo TODO multi-NIC support
412 arp.arpTask = "__MG_ARP_TASK"
413 
414 --- Arp table
415 --- TODO docu
416 local arpTable = ns:get()
417 
418 --- Arp handler task
419 --- @param qs TODO
420 --- @todo TODO docu
421 local function arpTask(qs)
422  -- two ways to call this: single nic or array of nics
423  if qs[1] == nil and qs.rxQueue then
424  return arpTask({ qs })
425  end
426 
427  local ipToMac = {}
428  -- loop over NICs/Queues
429  for _, nic in pairs(qs) do
430  if nic.txQueue.dev ~= nic.rxQueue.dev then
431  error("both queues must belong to the same device")
432  end
433 
434  if type(nic.ips) == "string" then
435  nic.ips = { nic.ips }
436  end
437 
438  for _, ip in pairs(nic.ips) do
439  ipToMac[parseIPAddress(ip)] = nic.txQueue.dev:getMac()
440  end
441  nic.txQueue.dev:l2Filter(eth.TYPE_ARP, nic.rxQueue)
442  end
443 
444  local rxBufs = memory.createBufArray(1)
445  local txMem = memory.createMemPool(function(buf)
446  buf:getArpPacket():fill{
447  arpOperation = arp.OP_REPLY,
448  pktLength = 60
449  }
450  end)
451  local txBufs = txMem:bufArray(1)
452 
453  arpTable.taskRunning = true
454 
455  while dpdk.running() do
456 
457  for _, nic in pairs(qs) do
458  rx = nic.rxQueue:tryRecvIdle(rxBufs, 1000)
459  assert(rx <= 1)
460  if rx > 0 then
461  local rxPkt = rxBufs[1]:getArpPacket()
462  if rxPkt.eth:getType() == eth.TYPE_ARP then
463  if rxPkt.arp:getOperation() == arp.OP_REQUEST then
464  local ip = rxPkt.arp:getProtoDst()
465  local mac = ipToMac[ip]
466  if mac then
467  txBufs:alloc(60)
468  -- TODO: a single-packet API would be nice for things like this
469  local pkt = txBufs[1]:getArpPacket()
470  pkt.eth:setSrc(mac)
471  pkt.eth:setDst(rxPkt.eth:getSrc())
474  pkt.arp:setHardwareSrc(mac)
477  nic.txQueue:send(txBufs)
478  end
479  elseif rxPkt.arp:getOperation() == arp.OP_REPLY then
480  -- learn from all arp replies we see (arp cache poisoning doesn't matter here)
481  local mac = rxPkt.arp:getHardwareSrcString()
482  local ip = rxPkt.arp:getProtoSrcString()
483  arpTable[tostring(parseIPAddress(ip))] = { mac = mac, timestamp = dpdk.getTime() }
484  end
485  end
486  rxBufs:freeAll()
487  end
488  end
489 
490  -- send outstanding requests
491  arpTable:forEach(function(ip, value)
492  -- TODO: refresh or GC old entries
493  if value ~= "pending" then
494  return
495  end
496  arpTable[ip] = "requested"
497  -- TODO: the format should be compatible with parseIPAddress
498  ip = tonumber(ip)
499  txBufs:alloc(60)
500  local pkt = txBufs[1]:getArpPacket()
504  pkt.arp:setProtoDst(ip)
505  -- TODO: do not send requests on all devices, but only the relevant
506  for _, nic in pairs(qs) do
507  local mac = nic.txQueue.dev:getMac()
508  pkt.eth:setSrc(mac)
509  pkt.arp:setProtoSrc(parseIPAddress(nic.ips[1]))
510  pkt.arp:setHardwareSrc(mac)
511  nic.txQueue:send(txBufs)
512  end
513  end)
514  dpdk.sleepMillisIdle(1)
515  end
516 end
517 
518 --- Perform a lookup in the ARP table.
519 --- Lookup the MAC address for a given IP.
520 --- Blocks for up to 1 second if the arp task is not yet running
521 --- Caution: this function uses locks and namespaces, must not be used in the fast path
522 --- @param ip The ip address in string or cdata format to look up.
523 function arp.lookup(ip)
524  if type(ip) == "string" then
525  ip = parseIPAddress(ip)
526  elseif type(ip) == "cdata" then
527  ip = ip:get()
528  end
529  if not arpTable.taskRunning then
530  local waitForArpTask = 0
531  while not arpTable.taskRunning and waitForArpTask < 10 do
532  dpdk.sleepMillis(100)
533  end
534  if not arpTable.taskRunning then
535  error("ARP task is not running")
536  end
537  end
538  local mac = arpTable[tostring(ip)]
539  if type(mac) == "table" then
540  return mac.mac, mac.timestamp
541  end
542  arpTable.lock(function()
543  if not arpTable[tostring(ip)] then
544  arpTable[tostring(ip)] = "pending"
545  end
546  end)
547  return nil
548 end
549 
550 --- Perform a non-blocking lookup in the ARP table.
551 --- @param ip The ip address in string or cdata format to look up.
552 --- @param timeout TODO
553 --- @todo FIXME: this only sends a single request
554 function arp.blockingLookup(ip, timeout)
555  local timeout = dpdk.getTime() + timeout
556  repeat
557  local mac, ts = arp.lookup(ip)
558  if mac then
559  return mac, ts
560  end
561  dpdk.sleepMillisIdle(1000)
562  until dpdk.getTime() >= timeout
563 end
564 
565 __MG_ARP_TASK = arpTask
566 
567 
568 ---------------------------------------------------------------------------------
569 ---- Metatypes
570 ---------------------------------------------------------------------------------
571 
572 ffi.metatype("struct arp_header", arpHeader)
573 
574 return arp
575 
function mod sleepMillis(t)
Delay by t milliseconds.
function arpHeader getHardwareDstString()
Retrieve the hardware destination address.
local arpHeader
Module for arp_header struct (see headers.lua).
Definition: arp.lua:48
function etherHeader setDst(addr)
Set the destination MAC address.
function arpHeader setProtoDst(addr)
Set the protocol destination address.
local ffi
low-level dpdk wrapper
Definition: dpdkc.lua:6
function arpHeader getString()
Retrieve the values of all members.
function arpHeader setHardwareSrcString(addr)
Set the hardware source address.
function parseIPAddress(ip)
Parse a string to an IP address.
function arpHeader get(pre)
Retrieve the values of all members.
function etherHeader setSrc(addr)
Set the source MAC address.
eth TYPE_ARP
EtherType for Arp.
Definition: ethernet.lua:29
function etherHeader getSrc(addr)
Retrieve the source MAC address.
function packetCreate(...)
Create struct and functions for a new packet.
function arpHeader getProtoAddressType()
Retrieve the protocol address type.
function macAddr setString(mac)
Set the MAC address.
function arpHeader setProtoSrcString(addr)
Set the protocol source address.
function arpHeader getOperationString()
Retrieve the operation.
function arpHeader getProtoDstString()
Retrieve the protocol destination address.
function arpHeader getHardwareAddressType()
Retrieve the hardware address type.
function mod band(mask1, mask2, result)
Bitwise and.
function pkt dump(bytes)
Dumps the packet data cast to the best fitting packet struct.
function arpHeader setProtoDstString(addr)
Set the protocol destination address.
function arpHeader setHardwareAddressType(int)
Set the hardware address type.
function arpHeader setProtoAddressLength(int)
Set the protocol address length.
function arpHeader setProtoSrc(addr)
Set the protocol source address.
function ipsecICV set(icv)
Set the IPsec ICV.
pkt getArpPacket
Cast the packet to an Arp packet.
Definition: arp.lua:225
function arpHeader resolveNextHeader()
Resolve which header comes after this one (in a packet).
function etherHeader setDstString(str)
Set the destination MAC address.
function arpHeader getHardwareAddressLengthString()
Retrieve the hardware address length.
arp OP_REQUEST
Operation: request.
Definition: arp.lua:41
local udp
Udp protocol constants.
Definition: udp.lua:23
function arpHeader getProtoAddressLength()
Retrieve the protocol address length.
function mod bor(mask1, mask2, result)
Bitwise or.
local arp
Arp protocol constants.
Definition: arp.lua:32
arp OP_REPLY
Operation: reply.
Definition: arp.lua:43
function arpHeader getHardwareSrcString()
Retrieve the hardware source address.
arp HARDWARE_ADDRESS_TYPE_ETHERNET
Hardware address type for ethernet.
Definition: arp.lua:35
function arpHeader getProtoAddressTypeString()
Retrieve the protocol address type.
function mempool bufArray(n)
Create a new array of memory buffers (initialized to nil).
function arpHeader setProtoAddressType(int)
Set the protocol address type.
function arpHeader setHardwareSrc(addr)
Set the hardware source address.
function arpHeader getOperation()
Retrieve the operation.
arp PROTO_ADDRESS_TYPE_IP
Proto address type for IP (for ethernet based protocols uses etherType numbers ethernet.lua)
Definition: arp.lua:38
function arpHeader getProtoDst()
Retrieve the protocol destination address.
function arpHeader setHardwareDst(addr)
Set the hardware destination address.
local arpTable
Arp table TODO docu.
Definition: arp.lua:237
function arpHeader getHardwareDst()
Retrieve the hardware destination address.
function etherHeader getType()
Retrieve the EtherType.
function arpHeader setOperation(int)
Set the operation.
local eth
Ethernet protocol constants.
Definition: ethernet.lua:24
function mod createMemPool(...)
function rxQueue tryRecvIdle(bufArray, maxWait)
Receive packets from a rx queue with a timeout.
function mod getTime()
gets the time in seconds
function arpHeader fill(args, pre)
Set all members of the ip header.
function arpHeader getHardwareSrc()
Retrieve the hardware source address.
local ip
IP4 protocol constants.
Definition: ip4.lua:25
function arp lookup(ip)
Perform a lookup in the ARP table.
local pkt
Module for packets (rte_mbuf)
Definition: packet.lua:20
function mod bnot(mask, result)
Bitwise not.
eth BROADCAST
Ethernet broadcast address.
Definition: ethernet.lua:36
function bufArray freeAll()
Free all buffers in the array. Stops when it encounters the first one that is null.
function arpHeader getProtoSrcString()
Retrieve the protocol source address.
n
Create a new array of memory buffers (initialized to nil).
Definition: memory.lua:76
function arpHeader setDefaultNamedArgs(pre, namedArgs, nextHeader, accumulatedLength)
Change the default values for namedArguments (for fill/get).
function arpHeader getHardwareAddressLength()
Retrieve the hardware address length.
function mod sleepMillisIdle(t)
Sleep by t milliseconds by calling usleep().
function mod running(extraTime)
Returns false once the app receives SIGTERM or SIGINT, the time set via setRuntime expires...
namespace forEach(func)
Iterate over all keys/values in a namespace Note: namespaces do not offer a 'normal' iterator (e...
function arpHeader getProtoAddressLengthString()
Retrieve the protocol address length.
local icmp
Icmp4 protocol constants.
Definition: icmp.lua:25
function arpHeader getProtoSrc()
Retrieve the protocol source address.
function arpHeader getHardwareAddressTypeString()
Retrieve the hardware address type.
function arp blockingLookup(ip, timeout)
Perform a non-blocking lookup in the ARP table.
arp arpTask
Arp handler task, responds to ARP queries for given IPs and performs arp lookups. ...
Definition: arp.lua:233
function arpHeader setHardwareDstString(addr)
Set the hardware destination address.
function arpHeader setHardwareAddressLength(int)
Set the hardware address length.