]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ip6.c
Fix checksum calculation for IPv6 Segment Routing (SRv6) traffic
[tcpdump] / print-ip6.c
index b6893cf3998d0e7334db9210cfb071e678d1a486..9f8b4dbf63734ed7cf5f7fc3dd53eaf43723f36e 100644 (file)
@@ -53,6 +53,7 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst,
        const void *dst_addr;
        const struct ip6_rthdr *dp;
        const struct ip6_rthdr0 *dp0;
+       const struct ip6_srh *srh;
        const u_char *p;
        int i, len;
 
@@ -114,6 +115,19 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst,
                                        p += 16;
                                }
                                break;
+                       case IPV6_RTHDR_TYPE_4:
+                               /* IPv6 Segment Routing Header (SRH) */
+                               srh = (const struct ip6_srh *)dp;
+                               if (len % 2 == 1)
+                                       goto trunc;
+                               p = (const u_char *) srh->srh_segments;
+                               /*
+                                * The list of segments are encoded in the reverse order.
+                                * Accordingly, the final DA is encoded in srh_segments[0]
+                                */
+                               ND_TCHECK_16(p);
+                               dst_addr = (const void *)p;
+                               break;
 
                        default:
                                break;