]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_ecommunity.c
Merge pull request #3502 from donaldsharp/socket_to_me_baby
[mirror_frr.git] / bgpd / bgp_ecommunity.c
index 8029164184fe46d566e2967c32a1be210d8c8f4b..ed0900a7218c93b14df79672bc6f52541631d6e7 100644 (file)
@@ -688,9 +688,23 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter)
                        /* Low-order octet of type. */
                        sub_type = *pnt++;
                        if (sub_type != ECOMMUNITY_ROUTE_TARGET
-                           && sub_type != ECOMMUNITY_SITE_ORIGIN)
-                               unk_ecom = 1;
-                       else
+                           && sub_type != ECOMMUNITY_SITE_ORIGIN) {
+                               if (sub_type ==
+                                   ECOMMUNITY_FLOWSPEC_REDIRECT_IPV4 &&
+                                   type == ECOMMUNITY_ENCODE_IP) {
+                                       struct in_addr *ipv4 =
+                                               (struct in_addr *)pnt;
+                                       char ipv4str[INET_ADDRSTRLEN];
+
+                                       inet_ntop(AF_INET, ipv4,
+                                                 ipv4str,
+                                                 INET_ADDRSTRLEN);
+                                       len = sprintf(str_buf + str_pnt,
+                                                     "NH:%s:%d",
+                                                     ipv4str, pnt[5]);
+                               } else
+                                       unk_ecom = 1;
+                       } else
                                len = ecommunity_rt_soo_str(str_buf + str_pnt,
                                                            pnt, type, sub_type,
                                                            format);