Skip to content

Replacing interface tap by feth couple of interfaces on macOS #991

@kabassanov

Description

@kabassanov

Hi,

I'm actually trying to change openvpn code in order to keep tap behavior without using actual tap interfaces on macOS clients. This relies on a couple of native feth interfaces. Different approaches are possible:

  • Using bpf interface for reading local packets and sending tunnel traffic to the interface through a socket
  • Using bpf interface for reading local packets and sending tunnel traffic through the same bpf interface
  • Creating a RW socket for the interface management in both directions.

For the moment, I'm working on the first one. This is what people suggest everytime somebody is talking about mac tap interfaces... The main issue is that bpf interface can put multiple packets into buffer during the same read action. I'm still looking for a simple solution to solve this. It is easy to get the first packet, the point is how to preserve remaining data until the next iteration of the tunnel_point_to_point loop. Probably with a secondary buffer and an additional TUN_READ_REMAIN status flag...

On the other hand, I wonder why the second approach is not suggested (all BPF)... What could be the issue with packet injections through the bpf?

Finally, the third approach seems to be more complex to implement, as actual socket management is related to c2 context and it will be necessary to get some socket functions widely visible.

What do you think?

Thanks.

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