I was able to create a persistent tap interface using this reference. Now I am trying to make the interface up using like this:
fd = iff_alloc(tap_name, IFF_TAP|IFF_NO_PI|IFF_UP);
However, I still see that the interface is down when I use the command ip link show
:
`~/eclipse-workspace/RTI-swapper$ ip link show | grep tap0
6: tap0: <POINTOPOINT,MULTICAST,NOARP> mtu 1500 qdisc pfifo_fast state
DOWN mode DEFAULT group default qlen 500`
Also, I am unable to see this interface in Wireshark. I can only see a tap interface on Wireshark when I create it manually from the terminal, for example:
openvpn --mktun --dev tap0
ip link set tap0 up
ip addr add 10.0.0.1/24 dev tap0
Could anyone help me know how to make a new tap interface visible to wireshark from my C++ code ?