Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PacketSender does not deliver packet through specified interface #231

Open
steven-chien opened this issue Jul 30, 2017 · 1 comment
Open

Comments

@steven-chien
Copy link
Contributor

The follow dummy program is used to illustrate the issue. There are two interfaces on my device (Raspberry Pi): tun0 connecting to a VPN server and eth0 connecting to LAN.

I created a packet sender and explicitly ask for default interface to be eth0. (I used open_l3_socket() because in my project there are multiple writers sharing the socket from different threads). I also explicitly asked for send to deliver the packet through "eth0".

#include <iostream>
#include <tins/tins.h>

int main(int argc, char *argv[])
{
        Tins::PacketSender *sender = new Tins::PacketSender();
        sender->default_interface("eth0");
        sender->open_l3_socket(Tins::PacketSender::IP_TCP_SOCKET);

        Tins::IP ip_pkt("216.58.200.99", "192.168.1.210");

        Tins::TCP tcp_pkt(80, 8888);
        tcp_pkt.set_flag(Tins::TCP::SYN, 1);
        tcp_pkt.seq(1733878791);
        tcp_pkt.ack_seq(0);

        ip_pkt = ip_pkt / tcp_pkt;

        sender->send(ip_pkt, "eth0");
        return 0;
}

However the packet was still delivered through tun0 as shown from wireshare.

alt text

@mfontanini
Copy link
Owner

mfontanini commented Jul 30, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants