InetAddress dIP = NetUtils.getInetAddress(pkt.getDestinationAddress()); if (dIP == null) { return;
@Override public void populateMatch(Match match) { match.setField(MatchType.NW_SRC, NetUtils.getInetAddress(this.getSourceAddress())); match.setField(MatchType.NW_DST, NetUtils.getInetAddress(this.getDestinationAddress())); match.setField(MatchType.NW_PROTO, this.getProtocol()); match.setField(MatchType.NW_TOS, this.getDiffServ()); } }
/** * Extract the details of the source machine that sent this packet 'inPkt' * @param inPkt Packet that is received by the controller * @return Details of the source machine in Client object. */ public Client getClientFromPacket(IPv4 inPkt){ lbuLogger.trace("Find client information from packet : {}",inPkt.toString()); String ip = NetUtils.getInetAddress(inPkt.getSourceAddress()).getHostAddress(); String protocol = IPProtocols.getProtocolName(inPkt.getProtocol()); lbuLogger.trace("client ip {} and protocl {}",ip,protocol); Packet tpFrame= inPkt.getPayload(); lbuLogger.trace("Get protocol layer {}",tpFrame.toString()); short port = 0; if(protocol.equals(IPProtocols.TCP.toString())){ TCP tcpFrame = (TCP)tpFrame; port = tcpFrame.getSourcePort(); }else{ UDP udpFrame = (UDP)tpFrame; port = udpFrame.getSourcePort(); } lbuLogger.trace("Found port {}",port); Client source = new Client(ip, protocol,port); lbuLogger.trace("Client information : {}",source.toString()); return source; }
String ip = NetUtils.getInetAddress(inPkt.getDestinationAddress()).getHostAddress();
private void handlePuntedIPPacket(IPv4 pkt, NodeConnector incomingNodeConnector, boolean allowAddPending) { InetAddress dIP = NetUtils.getInetAddress(pkt.getDestinationAddress()); if (dIP == null || hostTracker == null) { log.debug("Invalid param(s) in handlePuntedIPPacket.. DestIP: {}. hostTracker: {}", dIP, hostTracker);
.getInetAddress(ofMatch.getNetworkSource()), NetUtils.getInetNetworkMask( ofMatch.getNetworkSourceMaskLen(), NetUtils.getInetAddress(ofMatch .getNetworkDestination()), NetUtils.getInetNetworkMask( } else if (v6Match.getNetworkSource() != 0) { salMatch.setField(MatchType.NW_SRC, NetUtils .getInetAddress(v6Match.getNetworkSource()), NetUtils.getInetNetworkMask( v6Match.getNetworkSourceMaskLen(), } else if (v6Match.getNetworkDestination() != 0) { salMatch.setField(MatchType.NW_DST, NetUtils.getInetAddress(v6Match .getNetworkDestination()), NetUtils.getInetNetworkMask(
InetAddress address = NetUtils.getInetAddress(match.getNetworkSource()); InetAddress mask = NetUtils.getInetNetworkMask(match.getNetworkSourceMaskLen(), false); this.setNetworkSource(address, mask); InetAddress address = NetUtils.getInetAddress(match.getNetworkDestination()); InetAddress mask = NetUtils.getInetNetworkMask(match.getNetworkDestinationMaskLen(), false); this.setNetworkDestination(address, mask);