IPAddressString ipAddrString = new IPAddressString("fe80::8b2:d61e:e5c:b333%15"); IPAddress addr = ipAddrString.getAddress(); if(addr.isIPv6()) { IPv6Address ipv6Addr = addr.toIPv6(); String zone = ipv6Addr.getZone(); IPv6Address noZoneAddr = new IPv6Address(ipv6Addr.getBytes()); System.out.println(zone); System.out.println(noZoneAddr); }
ip = (L3ModificationInstruction.ModIPInstruction) i; ip6 = ip.ip().getIp6Address(); oxm = factory.oxms().ipv6Src(IPv6Address.of(ip6.toOctets())); break; case IPV6_DST: ip = (L3ModificationInstruction.ModIPInstruction) i; ip6 = ip.ip().getIp6Address(); oxm = factory.oxms().ipv6Dst(IPv6Address.of(ip6.toOctets())); break; case IPV6_FLABEL:
Masked<IPv6Address> maskedIp = match.getMasked(MatchField.IPV6_SRC); ip6Prefix = Ip6Prefix.valueOf( maskedIp.getValue().getBytes(), maskedIp.getMask().asCidrMaskLength()); } else { ip6Prefix = Ip6Prefix.valueOf( match.get(MatchField.IPV6_SRC).getBytes(), Ip6Prefix.MAX_MASK_LENGTH); Masked<IPv6Address> maskedIp = match.getMasked(MatchField.IPV6_DST); ip6Prefix = Ip6Prefix.valueOf( maskedIp.getValue().getBytes(), maskedIp.getMask().asCidrMaskLength()); } else { ip6Prefix = Ip6Prefix.valueOf( match.get(MatchField.IPV6_DST).getBytes(), Ip6Prefix.MAX_MASK_LENGTH); case IPV6_ND_TARGET: ip6Address = Ip6Address.valueOf(match.get(MatchField.IPV6_ND_TARGET).getBytes()); builder.matchIPv6NDTargetAddress(ip6Address); break;
Ip6Address.makeMaskPrefix(ip6Prefix.prefixLength()); Masked<IPv6Address> maskedIp = Masked.of(IPv6Address.of(ip6Prefix.address().toString()), IPv6Address.of(maskAddr.toString())); mBuilder.setMasked(MatchField.IPV6_SRC, maskedIp); } else { mBuilder.setExact(MatchField.IPV6_SRC, IPv6Address.of(ip6Prefix.address().toString())); Ip6Address.makeMaskPrefix(ip6Prefix.prefixLength()); Masked<IPv6Address> maskedIp = Masked.of(IPv6Address.of(ip6Prefix.address().toString()), IPv6Address.of(maskAddr.toString())); mBuilder.setMasked(MatchField.IPV6_DST, maskedIp); } else { mBuilder.setExact(MatchField.IPV6_DST, IPv6Address.of(ip6Prefix.address().toString())); ip6Address = targetAddressCriterion.targetAddress(); mBuilder.setExact(MatchField.IPV6_ND_TARGET, IPv6Address.of(ip6Address.toOctets())); break; case IPV6_ND_SLL: