Skip to content

interface: handle name@link from iproute2 #1393

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bjacquin
Copy link

@bjacquin bjacquin commented Jun 15, 2025

Since #1090, iproute2 is preferred over ifconfig, however iproute2 provide the list of network interface in name@link in case an interface is bound to another one (such as macvtap for example), while the real interface name is not.

  $ ip link show
  2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
      link/ether 48:21:0b:52:19:22 brd ff:ff:ff:ff:ff:ff
  4: eth0.128@eth0: <BROADCAST,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
      link/ether 48:21:0b:52:19:22 brd ff:ff:ff:ff:ff:ff

bash-completion using name@link as provided by iproute2 output then provide such name in auto completion list, leading to invalid interface name when auto completing tcpdump arguments.

  $ tcpdump -i <TAB>
  eth0      eth0.128@eth0

This commit handle this use case to drop link name after name@.

  $ tcpdump -i <TAB>
  eth0      eth0.128

See: #1090
See: https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/lib/utils.c?h=v6.15.0#n1306

Since scop#1090, iproute2 is preferred over ifconfig, however iproute2
provide the list of network interface in name@link in case an interface
is bound to another one (such as macvtap for example), while the real
interface name is not.

  $ ip link show
  2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
      link/ether 48:21:0b:52:19:22 brd ff:ff:ff:ff:ff:ff
  4: eth0.128@eth0: <BROADCAST,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
      link/ether 48:21:0b:52:19:22 brd ff:ff:ff:ff:ff:ff

bash-completion using name@link as provided by iproute2 output then
provide such name in auto completion list, leading to invalid interface
name when auto completing tcpdump arguments.

  $ tcpdump -i <TAB>
  eth0      eth0.128@eth0

This commit handle this use case to drop link name after name@.

  $ tcpdump -i <TAB>
  eth0      eth0.128

See: scop#1090
See: https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/lib/utils.c?h=v6.15.0#n1306
@bjacquin bjacquin force-pushed the dev/beber/iproute2 branch from 6a5ff11 to e91ae59 Compare June 16, 2025 17:21
@yedayak
Copy link
Collaborator

yedayak commented Jun 16, 2025

Can you fix the commit title and body? The title needs to be in the conventional commit syntax, fix(<something): . The body just needs to be wrapped at 80 characters.

yedayak added a commit to yedayak/bash-completion that referenced this pull request Jun 16, 2025
@yedayak
Copy link
Collaborator

yedayak commented Jun 16, 2025

I created #1395 (depends on #1394) which should test this works as expected.

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

Successfully merging this pull request may close these issues.

3 participants