+ /*
+ * See https://bugs.opendaylight.org/show_bug.cgi?id=8469#c1 why this is necessary.
+ *
+ * TL;DR The sourceEid field in the MapRequestBuilder object will be serialized to a packet on the wire, and
+ * a Map-Request can't store the prefix length in the source EID.
+ *
+ * Since we store all prefixes as binary internally, we only care about and fix those address types.
+ */
+ private Eid fixSrcEidMask(Eid eid) {
+ Address address = eid.getAddress();
+ if (address instanceof Ipv4PrefixBinary) {
+ return new EidBuilder(eid).setAddress(new Ipv4PrefixBinaryBuilder((Ipv4PrefixBinary) address)
+ .setIpv4MaskLength(MaskUtil.IPV4_MAX_MASK).build()).build();
+ } else if (address instanceof Ipv6PrefixBinary) {
+ return new EidBuilder(eid).setAddress(new Ipv6PrefixBinaryBuilder((Ipv6PrefixBinary) address)
+ .setIpv6MaskLength(MaskUtil.IPV6_MAX_MASK).build()).build();
+ }
+ return eid;
+ }
+