Skip to content

libnet_build_ipv6_destopts() alters the payload #34

@koeppea

Description

@koeppea

Hi,

I have problems generating a IPv6 destination option in a packet using the libnet_build_ipv6_destopts() function.
The following test code I'm using:

t = LIBNET_PTAG_INITIALIZER;

t = libnet_build_icmpv6_echo(ICMP6_ECHO, 0, 0, 1, 0, NULL, 
      0, l, t);

t = libnet_build_ipv6_destopts(
      IPPROTO_ICMP6, 
      0,
      "\x80\x01\x00\x00\x00\x00",
      6,
      l,
      0);


libnet_build_ipv6(
      0,
      0,
      LIBNET_ICMPV6_H + LIBNET_IPV6_DESTOPTS_H, 
      IPPROTO_DSTOPTS, 
      64, 
      src_ip, 
      dst_ip, 
      NULL, 
      0, 
      l, 
      0);

Before sending it via libnet_write() I dump the pblock using libnet_diag_dump_pblock() and the output is:

pblock type:    unrecognized pblock
ptag number:    1
pblock address: 0x8178190
next pblock 0x81781c8 (ipv6_destopts)
prev pblock (nil) 
buf:        8000000000010000
buffer length:  8
checksum flag:  Yes
chksum length:  0
bytes copied:   8

pblock type:    ipv6_destopts
ptag number:    2
pblock address: 0x81781c8
next pblock 0x8178200 (ipv6)
prev pblock 0x8178190 (unrecognized pblock)
buf:        3a00800100000000
buffer length:  8
checksum flag:  No
bytes copied:   8

pblock type:    ipv6
ptag number:    3
pblock address: 0x8178200
next pblock (nil) 
prev pblock 0x81781c8 (ipv6_destopts)
buf:        60000000000a3c4020014dd0ff00842102242bfffe69c29b20014dd0ff0084210224fefffec9b185
buffer length:  40
checksum flag:  No
bytes copied:   40

This looks good but the packet shows something different:
2013-08-10-145513_1024x600_scrot

It seems that libnet_write() modifies the data passed as destination option payload.
Or do I use the function in a wrong way? I read the documentation about the function and the payload interface but couldn't find any special I'm doing wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions