/** * {@inheritDoc} */ @Override public void setDescription(StringBuilder builder) { Ip4Network src = getSourceAddress(); Ip4Network dst = getDestinationAddress(); int proto = (int)getProtocol(); int dscp = (int)getDscp(); builder.append("Inet4[src=").append(src.getText()). append(",dst=").append(dst.getText()). append(",proto=").append(proto). append(",dscp=").append(dscp).append(']'); } }
/** * Send a packet for probing the specified host. * * @param ident The identifier for the target vBridge. * @param outq An {@link PacketOutQueue} instance associated with the * current MD-SAL datastore transaction. * @param egress A {@link SalPort} instance that specifies the egress * switch port. * @param vid A VLAN ID to be set in an ARP request. * @param tha The target hardware address. * @param tpa The target protocol address. */ private void probe(BridgeIdentifier<Vbridge> ident, PacketOutQueue outq, SalPort egress, int vid, EtherAddress tha, IpAddress tpa) { if (tpa != null) { Ip4Network ip4 = Ip4Network.create(tpa.getIpv4Address()); if (ip4 != null) { // Send an ARP request. if (LOG.isTraceEnabled()) { LOG.trace("{}: Sending an ARP request: mac={}, ip={}, " + "vid={}, port={}", ident, tha.getText(), ip4.getText(), vid, egress); } Ethernet ether = new ArpPacketBuilder(vid). build(senderAddress, tha, ip4); outq.enqueue(egress, ether); } } }
/** * Try to probe IP address of the source address of this packet. */ public void probeInetAddress() { Inet4Packet ipv4 = getInet4Packet(); if (ipv4 != null) { // Send an ARP request to the source address of this packet. EtherAddress src = getControllerAddress(); Ip4Network tpa = ipv4.getSourceAddress(); EtherAddress dst = etherFrame.getSourceAddress(); int vlan = etherFrame.getOriginalVlan(); Ethernet ether = new ArpPacketBuilder(vlan).build(src, dst, tpa); SalPort sport = ingressPort; if (LOG.isTraceEnabled()) { String dstmac = dst.getText(); String target = tpa.getText(); LOG.trace("Sending an ARP request to detect IP address: " + "dst={}, tpa={}, vlan={}, port={}", dstmac, target, vlan, sport); } transmit(sport, ether); } }