+ private void logArpPacket(ARP pkt, NodeConnector p) {
+ try {
+ if (pkt.getOpCode() == ARP.REQUEST) {
+ log.trace("Received Arp Request with srcMac {} - srcIp {} - dstMac {} - dstIp {} - inport {}", HexEncode.bytesToHexString(pkt.getSenderHardwareAddress()),
+ InetAddress.getByAddress(pkt.getSenderProtocolAddress()), HexEncode.bytesToHexString(pkt.getTargetHardwareAddress()),
+ InetAddress.getByAddress(pkt.getTargetProtocolAddress()), p);
+ } else if(pkt.getOpCode() == ARP.REPLY) {
+ log.trace("Received Arp Reply with srcMac {} - srcIp {} - dstMac {} - dstIp {} - inport {}", HexEncode.bytesToHexString(pkt.getSenderHardwareAddress()),
+ InetAddress.getByAddress(pkt.getSenderProtocolAddress()), HexEncode.bytesToHexString(pkt.getTargetHardwareAddress()),
+ InetAddress.getByAddress(pkt.getTargetProtocolAddress()), p);
+ }
+ } catch(UnknownHostException e) {
+ log.warn("Illegal Ip Address in the ARP packet", e);
+ }
+ }
+