TCP/IP stack bypass

This is a discussion on TCP/IP stack bypass within the Linux Programming forums, part of the Platform Specific Boards category; Hi there, I have an embedded device running linux which has 2 ethernet interfaces (eth0, eth1). I need to decouple ...

  1. #1
    Registered User
    Join Date
    Sep 2007
    Location
    South Africa
    Posts
    20

    TCP/IP stack bypass

    Hi there,

    I have an embedded device running linux which has 2 ethernet interfaces (eth0, eth1).

    I need to decouple the linux tcp/ip stack from eth1 so that I can access the drivers for this device directly. Then I will have an external tcp/ip stack using eth1.

    I am just doing some preliminary information gathering on the cleanest way to do this.

    My first thought was to use raw sockets to do this, but i feel that this may cause some issues and that accessing eth1 directly would be cleaner than:
    external stack->linux stack(raw sockets)->eth1

    Does anyone know how to:
    1) stop the linux stack from accessing eth1? Is it as simple as "ifdown eth1"?
    2)find the API to use to access eth1 directly? I looked at using a library like libpcap, but it only supports reading packets from the device and not sending.

    Thanks,
    Kyle

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Can you describe, in a different way, what you are trying to do.

    What does "external tcp/ip stack" mean? A "non-kernel" tcp/ip stack?

    Why do you want to do that? What would the end result be?

    Have you considered that many modern ehternet controllers do some parts of the IP stack work in hardware - so you may not be able to turn it off.

    I think ifconfig eth1 down will actually unload the driver entirely, which would not be what you want to do...

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Sep 2007
    Location
    South Africa
    Posts
    20
    Hi Mats,

    You are correct. By "external" I mean, non kernel. Provided by a third party. Our customer does not want to use the linux stack. They have implemented their own stack that they want us to use.

    The end result:
    The embedded device will boot up linux and run the customers software. For ip connectivity they will be using their own stack which will interface to a ethernet driver. I will have to write a wrapper to the linux ethernet driver so fit the customers specified API. It sounds crazy not to use the stack thats already there, but the customer is insisting.

    The level at which their stack interfaces with the ethernet interface is quite simple. We need to pass up packets received but the ethernet device to the stack. Send out packets given to us by the stack. Set multicast filters etc.

    Hope that clears it up a little

  4. #4
    khn
    khn is offline
    Registered User
    Join Date
    Aug 2009
    Posts
    2
    Create a TAP interface, this will pass all ethernet frames directly to that interface and you are able to pocess them in any way you want.

  5. #5
    Registered User
    Join Date
    Sep 2007
    Location
    South Africa
    Posts
    20
    Hi knh,

    I thought a TUN/TAP was a virtual ethernet interface driver. So in my basic understanding, a TUN/TAP, instead of receiving packets from a physical
    media, receives them from user space program and instead of sending
    packets via physical media sends them to the user space program. I don't see how I can use this to get ethernet packets from say "eth1" and pass them to the external stack as opposed to the linux stack. Could you maybe elaborate?

    -kyle

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. stack and pointer problem
    By ramaadhitia in forum C Programming
    Replies: 2
    Last Post: 09-12-2006, 12:41 AM
  2. infix evaluation using stack
    By lewissi in forum C++ Programming
    Replies: 0
    Last Post: 11-03-2005, 02:56 AM
  3. Question about a stack using array of pointers
    By Ricochet in forum C++ Programming
    Replies: 6
    Last Post: 11-17-2003, 10:12 PM
  4. error trying to compile stack program
    By KristTlove in forum C++ Programming
    Replies: 2
    Last Post: 11-03-2003, 06:27 PM
  5. Stack Program Here
    By Troll_King in forum C Programming
    Replies: 7
    Last Post: 10-15-2001, 06:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21