/** * Construct a new PACKET_IN event. * * @param listener A PACKET_IN event listener. * @param notification A PACKET_IN notification. * @param ingress A {@link SalPort} instance which specifies the * ingress switch port. * @return A {@link PacketInEvent} instance if the given notification * should be delivered to listeners. * {@code null} if the given notification should be ignored. */ private PacketInEvent newPacketInEvent( VTNPacketListener listener, PacketReceived notification, SalPort ingress) { PacketInEvent ev; try { ev = new PacketInEvent(listener, notification, ingress); } catch (IllegalArgumentException e) { LOG.debug("Ignore received packet.", e); return null; } catch (Exception e) { LOG.error("Failed to create PacketInEvent: " + notification, e); return null; } if (ev.getEthernet().getEtherType() == EtherTypes.LLDP.shortValue()) { // Ignore LLDP packet. return null; } return ev; }
if (payload instanceof ARP) { ARP arp = (ARP)payload; if (arp.getProtocolType() == EtherTypes.IPV4.shortValue()) { byte[] sender = arp.getSenderProtocolAddress();
setProtocolType(EtherTypes.IPV4.shortValue()). setHardwareAddressLength((byte)EtherAddress.SIZE). setProtocolAddressLength((byte)Ip4Network.SIZE). setTargetHardwareAddress(tha).setTargetProtocolAddress(tpa); short ethType = EtherTypes.ARP.shortValue(); Packet payload = arp; if (vlanId != EtherHeader.VLAN_NONE) { tag.setCfi((byte)0).setPcp((byte)0).setVid((short)vlanId). setEtherType(ethType).setPayload(arp); ethType = EtherTypes.VLAN.shortValue(); payload = tag;
ether.setEtherType(EtherTypes.VLAN.shortValue());