Skip to content

write to tun device with ip packet, bad format #8

@chengen

Description

@chengen

i use:
tt.write(packet);
to send ip packet and than use tcp dump to capture the packet:
tcpdump -i tun8
it seems tcp dump can't recognize the packet.
here is my tun device setup:
tt = tuntap({
type: 'tun',
name: 'tun8',
mtu: 1500,
addr: '192.168.100.1',
dest: '192.168.100.2',
mask: '255.255.255.0',
ethtype_comp: 'none',
persist: true,
up: true,
running: true,
});

than i look into the code, and modify the code in
src/tuntap-itf/tuntap-itf-linux.inc.cc
while open the tun device, and add the flag as follows:

109 if(opts.mode == tuntap_itf_opts_t::MODE_TUN)
110 ifr.ifr_flags |= IFF_TUN;
111 else if(opts.mode == tuntap_itf_opts_t::MODE_TAP)
112 ifr.ifr_flags |= IFF_TAP;
113
114 //add by chengen
115 ifr.ifr_flags |= IFF_NO_PI;
116
117 MK_IOCTL(*fd, TUNSETIFF, &ifr)

line 115. and then it works. tcpdump can recognize the packet. is this a bug or i missed something on configuration?

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