Bug 1341343
| Summary: | Support listing interfaces by type or master | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Phil Sutter <psutter> |
| Component: | iproute | Assignee: | Phil Sutter <psutter> |
| Status: | CLOSED ERRATA | QA Contact: | Jaroslav Aster <jaster> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.3 | CC: | aloughla, atragler, jaster |
| Target Milestone: | rc | Keywords: | FutureFeature |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | iproute-3.10.0-67.el7 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-11-03 23:39:31 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Here's one more:
commit 417b2180a57b0335981bdaaaaa017a48d1a84b72
Author: Vadim Kochan <vadim4j>
Date: Fri Dec 26 04:46:20 2014 +0200
man ip-link: Small example of 'ip link show master'
Signed-off-by: Vadim Kochan <vadim4j>
Hi Phil, I found some issues related to type and master. 1, Sets of possible types are different between ip address help, man ip-address, ip link help and man ip-link. for example: # diff ip-address-help.txt ip-address-man.txt 2d1 < bond_slave 4c3 < bridge_slave --- > can 8a8 > hsr 15a16 > lowpan 23d23 < vrf Sets should be the same. 2, Is it possible to filter Ethernet type? There is no mention about it. 3, It is possible to specify nonsense type. # ip link show type blablablablabla && echo ok || echo fail ok I know, there is only simple filter in the code which compares type typed by user and device type, but it does not look good. Switching to assigned state. At least documentation should be fixed. Hi Jaroslav, (In reply to Jaroslav Aster from comment #4) > 1, Sets of possible types are different between ip address help, man > ip-address, ip link help and man ip-link. > > for example: > > # diff ip-address-help.txt ip-address-man.txt > 2d1 > < bond_slave > 4c3 > < bridge_slave > --- > > can > 8a8 > > hsr > 15a16 > > lowpan > 23d23 > < vrf > > Sets should be the same. Yes, you're right. I will make sure this is fixed. > 2, Is it possible to filter Ethernet type? There is no mention about it. > > 3, It is possible to specify nonsense type. > > # ip link show type blablablablabla && echo ok || echo fail > ok > > I know, there is only simple filter in the code which compares type typed by > user and device type, but it does not look good. The functionality is indeed quite simple. With the above (correct) analysis in mind, I am also not overly happy with having the list of possible interface types hard-coded in help text and man page. Maybe I can get a simple statement à la "whatever 'ip link' displays can be used to select type" as an alternative upstream. > Switching to assigned state. At least documentation should be fixed. OK. Thanks for looking into this! Cheers, Phil Hi Phil (In reply to Phil Sutter from comment #5) > > 3, It is possible to specify nonsense type. > > > > # ip link show type blablablablabla && echo ok || echo fail > > ok > > > > I know, there is only simple filter in the code which compares type typed by > > user and device type, but it does not look good. > > The functionality is indeed quite simple. With the above (correct) analysis > in mind, I am also not overly happy with having the list of possible > interface types hard-coded in help text and man page. Maybe I can get a > simple statement à la "whatever 'ip link' displays can be used to select > type" as an alternative upstream. I agree with you, that hard-coded types in help and man page do not make sense when you can type whatever you want. It's better to describe how filter works and where I can find right values for the filter, plus some examples for more common types. Now, it appears that only named names are allowed for the filter and it is not true. I found one issue/in-consistence in ip-link man page, where ip link delete is described. ip link delete section in ip-link man page does not contain description of type option. It describes only dev option.
ip link delete - delete virtual link
DEVICE specifies the virtual device to act operate on. TYPE specifies the type of the device.
dev DEVICE
specifies the physical device to act operate on.
Hi Jaroslav, (In reply to Jaroslav Aster from comment #6) > (In reply to Phil Sutter from comment #5) > > > > 3, It is possible to specify nonsense type. > > > > > > # ip link show type blablablablabla && echo ok || echo fail > > > ok > > > > > > I know, there is only simple filter in the code which compares type typed by > > > user and device type, but it does not look good. > > > > The functionality is indeed quite simple. With the above (correct) analysis > > in mind, I am also not overly happy with having the list of possible > > interface types hard-coded in help text and man page. Maybe I can get a > > simple statement à la "whatever 'ip link' displays can be used to select > > type" as an alternative upstream. > > I agree with you, that hard-coded types in help and man page do not make > sense when you can type whatever you want. It's better to describe how > filter works and where I can find right values for the filter, plus some > examples for more common types. Now, it appears that only named names are > allowed for the filter and it is not true. I gave this an additional thought and decided to leave the type list where it is. The reason is it's sometimes tricky to spot the type name in 'ip -d l' output - it's not always there and in case of enslaved devices there's a line following it with the *_slave options. So presenting the user with a list of valid types is still quite helpful, but I have nevertheless added a paragraph explaining why there is no validation for the type argument in iproute. (In reply to Jaroslav Aster from comment #7) > I found one issue/in-consistence in ip-link man page, where ip link delete > is described. ip link delete section in ip-link man page does not contain > description of type option. It describes only dev option. > > ip link delete - delete virtual link > DEVICE specifies the virtual device to act operate on. TYPE > specifies the type of the device. > > dev DEVICE > specifies the physical device to act operate on. This was fixed by some completely unrelated commit (yay), so I could not just backport something to get rid of the broken formatting. Instead I applied the desired changes from that commit by hand. VERIFIED: /CoreOS/iproute/Sanity/bz1341343-Support-listing-interfaces-by-type-or-master iproute-3.10.0-71.el7 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Test :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ PASS ] :: Checking there is 'type' option in ip-link man page. (Expected 0, got 0) :: [ PASS ] :: Checking there is 'type' option in ip-address man page. (Expected 0, got 0) :: [ PASS ] :: Searching there is 'master' option ip link help. (Expected 0, got 0) :: [ PASS ] :: Searching there is 'master' option ip address help. (Expected 0, got 0) :: [ PASS ] :: Command 'ip link show type dummy | grep 'testDummy1:'' (Expected 0, got 0) :: [ PASS ] :: Command 'ip link show type dummy | grep 'testDummy2:'' (Expected 0, got 0) :: [ PASS ] :: Command 'ip link show type dummy | grep 'testDummy3:'' (Expected 0, got 0) :: [ PASS ] :: Command 'ip link show type dummy | grep 'testBridge:'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip link show type bridge | grep 'testBridge:'' (Expected 0, got 0) :: [ PASS ] :: Command 'ip link show type bridge | grep 'testDummy1:'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip link show type bridge | grep 'testDummy2:'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip link show type bridge | grep 'testDummy3:'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip link show master testBridge | grep 'testDummy1:'' (Expected 0, got 0) :: [ PASS ] :: Command 'ip link show master testBridge | grep 'testDummy2:'' (Expected 0, got 0) :: [ PASS ] :: Command 'ip link show master testBridge | grep 'testDummy3:'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip link show master testBridge | grep 'testBridge:'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip address show type dummy | grep '172.29.28.31/24'' (Expected 0, got 0) :: [ PASS ] :: Command 'ip address show type dummy | grep '172.29.28.32/24'' (Expected 0, got 0) :: [ PASS ] :: Command 'ip address show type dummy | grep '172.29.28.33/24'' (Expected 0, got 0) :: [ PASS ] :: Command 'ip address show type dummy | grep '172.29.28.30/24'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip address show type bridge | grep '172.29.28.30/24'' (Expected 0, got 0) :: [ PASS ] :: Command 'ip address show type bridge | grep '172.29.28.31/24'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip address show type bridge | grep '172.29.28.32/24'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip address show type bridge | grep '172.29.28.33/24'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip address show master testBridge | grep '172.29.28.31/24'' (Expected 0, got 0) :: [ PASS ] :: Command 'ip address show master testBridge | grep '172.29.28.32/24'' (Expected 0, got 0) :: [ PASS ] :: Command 'ip address show master testBridge | grep '172.29.28.33/24'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip address show master testBridge | grep '172.29.28.30/24'' (Expected 1, got 1) :: [ LOG ] :: Duration: 3s :: [ LOG ] :: Assertions: 28 good, 0 bad :: [ PASS ] :: RESULT: Test iproute-3.10.0-54.el7_2.1 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Test :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ PASS ] :: Checking there is 'type' option in ip-link man page. (Expected 0, got 0) :: [ FAIL ] :: Checking there is 'type' option in ip-address man page. (Expected 0, got 1) :: [ PASS ] :: Searching there is 'master' option ip link help. (Expected 0, got 0) :: [ FAIL ] :: Searching there is 'master' option ip address help. (Expected 0, got 1) :: [ FAIL ] :: Command 'ip link show type dummy | grep 'testDummy1:'' (Expected 0, got 1) :: [ FAIL ] :: Command 'ip link show type dummy | grep 'testDummy2:'' (Expected 0, got 1) :: [ FAIL ] :: Command 'ip link show type dummy | grep 'testDummy3:'' (Expected 0, got 1) :: [ PASS ] :: Command 'ip link show type dummy | grep 'testBridge:'' (Expected 1, got 1) :: [ FAIL ] :: Command 'ip link show type bridge | grep 'testBridge:'' (Expected 0, got 1) :: [ PASS ] :: Command 'ip link show type bridge | grep 'testDummy1:'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip link show type bridge | grep 'testDummy2:'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip link show type bridge | grep 'testDummy3:'' (Expected 1, got 1) :: [ FAIL ] :: Command 'ip link show master testBridge | grep 'testDummy1:'' (Expected 0, got 1) :: [ FAIL ] :: Command 'ip link show master testBridge | grep 'testDummy2:'' (Expected 0, got 1) :: [ PASS ] :: Command 'ip link show master testBridge | grep 'testDummy3:'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip link show master testBridge | grep 'testBridge:'' (Expected 1, got 1) :: [ FAIL ] :: Command 'ip address show type dummy | grep '172.29.28.31/24'' (Expected 0, got 1) :: [ FAIL ] :: Command 'ip address show type dummy | grep '172.29.28.32/24'' (Expected 0, got 1) :: [ FAIL ] :: Command 'ip address show type dummy | grep '172.29.28.33/24'' (Expected 0, got 1) :: [ PASS ] :: Command 'ip address show type dummy | grep '172.29.28.30/24'' (Expected 1, got 1) :: [ FAIL ] :: Command 'ip address show type bridge | grep '172.29.28.30/24'' (Expected 0, got 1) :: [ PASS ] :: Command 'ip address show type bridge | grep '172.29.28.31/24'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip address show type bridge | grep '172.29.28.32/24'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip address show type bridge | grep '172.29.28.33/24'' (Expected 1, got 1) :: [ FAIL ] :: Command 'ip address show master testBridge | grep '172.29.28.31/24'' (Expected 0, got 1) :: [ FAIL ] :: Command 'ip address show master testBridge | grep '172.29.28.32/24'' (Expected 0, got 1) :: [ PASS ] :: Command 'ip address show master testBridge | grep '172.29.28.33/24'' (Expected 1, got 1) :: [ PASS ] :: Command 'ip address show master testBridge | grep '172.29.28.30/24'' (Expected 1, got 1) :: [ LOG ] :: Duration: 3s :: [ LOG ] :: Assertions: 14 good, 14 bad :: [ FAIL ] :: RESULT: Test Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHEA-2016-2162.html |
This is a feature upstream has since the end of 2014 and a real benefit in my point of view. Two simple examples: List all bridges: # ip link show type bridge List slaves of br0: # ip link show master br0 In theory, this works with 'ip address' as well, though there's a bug upstream which prevents that with the 'type' keyword. Another nice thing: All this is a pure user-space feature, no kernel support is required (apart from it exporting interface type and assigned master device, which is standard). Patches to backport: commit 1b94414854d71a6b6df367644ae9b06a54278daf Author: Vadim Kochan <vadim4j> Date: Sat Nov 29 11:27:41 2014 -0800 ip link: Allow to filter devices by master dev Added 'master' option to 'ip link show' command to filter devices by master dev. Signed-off-by: Vadim Kochan <vadim4j> commit 712249d8fac88bcf3a9fd0b1de2263074075873b Author: Vadim Kochan <vadim4j> Date: Wed Dec 10 10:11:29 2014 +0200 ip link: Show devices by type Added new option 'type' to 'ip link show' command which allows to filter devices by type: ip link show type bridge ip link show type vlan Signed-off-by: Vadim Kochan <vadim4j> And a yet to be submitted fix from me.