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

get_docker_networking() matches (and thus excludes) interfaces it shouldn't #41

Open
cmsj opened this issue Jun 1, 2024 · 0 comments
Open

Comments

@cmsj
Copy link

cmsj commented Jun 1, 2024

In tools.sh is this line:

https://github.com/binhex/arch-int-vpn/blob/623db6937ba455ba39f4793cb18e1534b321d08a/run/root/tools.sh#L52C22-L52C143

The final grep will exclude any interface with lo in the name, but really it should only be excluding interfaces based on their full name.

Docker has the ability to name network interfaces, which can be very useful for disambiguating which interfaces are connected to which networks, for example:

networks:
  downloaders:
    external: false
    driver: bridge
    name: downloaders
    driver_opts:
      com.docker.network.bridge.name: br-downloaders
      com.docker.network.container_iface_prefix: downloaders

This will result in any container attached to the downloaders network having an interface named downloaders0. You can probably see where this is going already :)

Here is what happens to the command in tools.sh with/without the final grep:

[root@1402fcdd8e21 /]# ip link show | grep -v 'state DOWN' | cut -d ' ' -f 2 | grep -P -o '^[^@:]+'
lo
downloaders0
[root@1402fcdd8e21 /]# ip link show | grep -v 'state DOWN' | cut -d ' ' -f 2 | grep -P -o '^[^@:]+' | grep -P -v "lo"
[root@1402fcdd8e21 /]#

I would suggest that a better version of that grep would be:

[root@1402fcdd8e21 /]# ip link show | grep -v 'state DOWN' | cut -d ' ' -f 2 | grep -P -o '^[^@:]+' | grep -P -v "^(lo|tun0)$"
downloaders0
cmsj added a commit to cmsj/arch-int-vpn that referenced this issue Jun 1, 2024
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

1 participant