]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Revert "Merge pull request #16439 from louis-6wind/fix-ipv4-mapped-ipv6"
authorJafar Al-Gharaibeh <jafar@atcorp.com>
Wed, 21 Aug 2024 18:26:50 +0000 (13:26 -0500)
committerJafar Al-Gharaibeh <jafar@atcorp.com>
Wed, 21 Aug 2024 18:26:50 +0000 (13:26 -0500)
This reverts commit cc0fdd3b1d1b3554896fc03eec16379b7bae2b40, reversing
changes made to 4e208087fd854e3e1528519745447f69691b04ad.

bgpd/bgp_nht.c
bgpd/bgp_updgrp_packet.c
tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json
tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json

index 8da7521ffc129d6abcb67d26b94ce72cc735b6e7..504428b0d6b3d943ca92c4707ce2ea6f163694a7 100644 (file)
@@ -351,9 +351,7 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
                        }
                        return 0;
                }
-               if (afi == AFI_IP6 && p.family == AF_INET)
-                       /* IPv4 mapped IPv6 nexthop address */
-                       afi = AFI_IP;
+
                srte_color = bgp_attr_get_color(pi->attr);
 
        } else if (peer) {
@@ -1080,25 +1078,14 @@ static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p)
                                                        &ipv4);
                                                p->u.prefix4 = ipv4;
                                                p->prefixlen = IPV4_MAX_BITLEN;
-                                               p->family = AF_INET;
                                        } else
                                                p->u.prefix6 =
                                                        pi->attr->mp_nexthop_global;
                                } else
                                        p->u.prefix6 =
                                                pi->attr->mp_nexthop_local;
-                       } else {
-                               if (IS_MAPPED_IPV6(
-                                           &pi->attr->mp_nexthop_global)) {
-                                       ipv4_mapped_ipv6_to_ipv4(&pi->attr->mp_nexthop_global,
-                                                                &ipv4);
-                                       p->u.prefix4 = ipv4;
-                                       p->prefixlen = IPV4_MAX_BITLEN;
-                                       p->family = AF_INET;
-                               } else
-                                       p->u.prefix6 =
-                                               pi->attr->mp_nexthop_global;
-                       }
+                       } else
+                               p->u.prefix6 = pi->attr->mp_nexthop_global;
                }
                break;
        default:
index 0f47388389b0340fd5461839e4cff0ea14beb02c..b7d5f664509debb339a1f0f60669d10cae84fae4 100644 (file)
@@ -508,9 +508,6 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt,
                                gnh_modified = 1;
                        }
                } else if (IN6_IS_ADDR_UNSPECIFIED(&v6nhglobal)) {
-                       /* the UPDATE is originating from the local router.
-                        * Build the global nexthop.
-                        */
                        mod_v6nhg = &peer->nexthop.v6_global;
                        gnh_modified = 1;
                } else if ((peer->sort == BGP_PEER_EBGP)
@@ -524,32 +521,18 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt,
                         */
                        mod_v6nhg = &peer->nexthop.v6_global;
                        gnh_modified = 1;
-               } else if (IS_MAPPED_IPV6(&v6nhglobal) &&
-                          !IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_global)) {
-                       /* prefer a IPv6 native global address over
-                        * an IPv4-mapped IPv6 address as nexthop when
-                        * forwarding UPDATEs.
-                        */
-                       mod_v6nhg = &peer->nexthop.v6_global;
-                       gnh_modified = 1;
                }
 
                if (peer->nexthop.v4.s_addr != INADDR_ANY &&
                    (IN6_IS_ADDR_UNSPECIFIED(mod_v6nhg) ||
                     (IN6_IS_ADDR_LINKLOCAL(mod_v6nhg) &&
-                     ((peer->connection->su.sa.sa_family == AF_INET6 &&
-                       paf->afi == AFI_IP) ||
-                      (peer->connection->su.sa.sa_family == AF_INET &&
-                       paf->afi == AFI_IP6))))) {
+                     peer->connection->su.sa.sa_family == AF_INET6 &&
+                     paf->afi == AFI_IP))) {
                        ipv4_to_ipv4_mapped_ipv6(mod_v6nhg, peer->nexthop.v4);
                        gnh_modified = 1;
                }
 
                if (IS_MAPPED_IPV6(&peer->nexthop.v6_global)) {
-                       /* If the interface to the peer has no global IPv6
-                        * address, replace the nexthop in UPDATE with
-                        * the IPv4-mapped IPv6 address if any.
-                        */
                        mod_v6nhg = &peer->nexthop.v6_global;
                        gnh_modified = 1;
                }
index 6738d45750721151c73eee550d79cc03e1fa55cd..21f36089b6dde250d4ec5b0a5bb6d0f3f76f3579 100644 (file)
@@ -6,11 +6,6 @@
         "bestpath": true,
         "path": "65100",
         "nexthops": [
-          {
-            "ip": "::ffff:ac10:1",
-            "afi": "ipv6",
-            "scope": "global"
-          },
           {
             "afi": "ipv6",
             "scope": "link-local",
index 807806ff8db0c3576eea3ed7e4722cf877b27491..21f36089b6dde250d4ec5b0a5bb6d0f3f76f3579 100644 (file)
@@ -6,11 +6,6 @@
         "bestpath": true,
         "path": "65100",
         "nexthops": [
-          {
-            "ip": "::ffff:ac10:101",
-            "afi": "ipv6",
-            "scope": "global"
-          },
           {
             "afi": "ipv6",
             "scope": "link-local",