def create_tcpdump_line_v6()

in tools/tcpdump_encap_helper/tcpdump_encap_helper.py [0:0]


def create_tcpdump_line_v6(args, offset):
    """
     @param args cli arguments
     @param int offset of internal header compare to external one
     @return None
     IPv6 Header Format

    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |Version| Traffic Class |           Flow Label                  |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |         Payload Length        |  Next Header  |   Hop Limit   |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    +                                                               +
    |                                                               |
    +                         Source Address                        +
    |                                                               |
    +                                                               +
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    +                                                               +
    |                                                               |
    +                      Destination Address                      +
    |                                                               |
    +                                                               +
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    """
    tcpdump_filters = []
    if args.src:
        chunk_offset = 0
        for v6_chunk in ip6_exploded(args.src):
            tcpdump_filters = modify_filter(
                tcpdump_filters,
                v6_chunk,
                offset + V6_SRC_OFFSET + chunk_offset,
                V6_PART_SIZE,
                True,
            )
            chunk_offset += V6_PART_SIZE
    if args.dst:
        chunk_offset = 0
        for v6_chunk in ip6_exploded(args.dst):
            tcpdump_filters = modify_filter(
                tcpdump_filters,
                v6_chunk,
                offset + V6_DST_OFFSET + chunk_offset,
                V6_PART_SIZE,
                True,
            )
            chunk_offset += V6_PART_SIZE
    if args.proto:
        tcpdump_filters = modify_filter(
            tcpdump_filters, args.proto, offset + V6_PROTO_OFFSET, PROTO_SIZE, True
        )
    if args.sport:
        tcpdump_filters = modify_filter(
            tcpdump_filters,
            args.sport,
            offset + V6_HDR_SIZE + SPORT_OFFSET,
            PORT_SIZE,
            True,
        )
    if args.dport:
        tcpdump_filters = modify_filter(
            tcpdump_filters,
            args.dport,
            offset + V6_HDR_SIZE + DPORT_OFFSET,
            PORT_SIZE,
            True,
        )
    print('"(' + " and ".join(tcpdump_filters) + ')"')