} catch (NotOpenException e) {
e.printStackTrace();
}
}
else if (packet.contains(ArpPacket.class)) {
ArpPacket ap = packet.get(ArpPacket.class);
if (
!ap.getHeader().getOperation().equals(ArpOperation.REQUEST)
) { return; }
if (!ap.getHeader().getDstProtocolAddr().equals(address)) {
return;
}
EthernetPacket.Builder eb
= (EthernetPacket.Builder)packet.getBuilder();
ArpPacket.Builder ab = eb.get(ArpPacket.Builder.class);
ab.srcHardwareAddr(MAC_ADDR)
.dstHardwareAddr(ap.getHeader().getSrcHardwareAddr())
.srcProtocolAddr(ap.getHeader().getDstProtocolAddr())
.dstProtocolAddr(ap.getHeader().getSrcProtocolAddr())
.operation(ArpOperation.REPLY);
eb.dstAddr(ap.getHeader().getSrcHardwareAddr())
.srcAddr(MAC_ADDR);
try {
handle4send.sendPacket(eb.build());
} catch (PcapNativeException e) {