-
Notifications
You must be signed in to change notification settings - Fork 246
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
Update 310_network_devices.sh #2907
Conversation
Select all available NICs (IPv4 & IPv6) for the rescue environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me from plain looking at the code changes.
Actually the new code looks better (much simpler).
But I did not test it.
@hpannenb Could you please add a reference to your issue
so others can later easily understand the reason behind, |
Updated the comments on request.
@hpannenb |
@rear/contributors |
I am checking how it behaves on a machine with many NICs. |
On a machine with 6 NICs, 2 of which are configured: ip r | awk '$2 == "dev" && $8 == "src" { print $3 }' | sort -u
ls /sys/class/net/
|
I have not yet found a case where the new code produces a different output from the old code, but so far I have not invested much in it. I still feel that it would be better to keep the old code. I believe there is probably a good reason to keep only interfaces with routing information and I am afraid of breaking it. Unfortunately, currently I have very little time for investigating it. |
I have finally found one meaningful difference between the result of the old code and of the proposed code. diff -U10 -r /var/tmp/rear.cjIYxe4t6h4ksM2/rootfs/etc/scripts/system-setup.d/60-network-devices.sh /var/tmp/rear.PgacJne54eJTRRI/rootfs/etc/scripts/system-setup.d/60-network-devices.sh --- /var/tmp/rear.cjIYxe4t6h4ksM2/rootfs/etc/scripts/system-setup.d/60-network-devices.sh 2023-01-12 18:43:30.128396285 -0500
+++ /var/tmp/rear.PgacJne54eJTRRI/rootfs/etc/scripts/system-setup.d/60-network-devices.sh 2023-01-12 04:00:48.923395070 -0500
@@ -18,10 +18,12 @@
# The following is autogenerated code to setup network interfaces
# in the recovery system which have all these on the original system:
# - they are UP
# - they have an IP address
# - they are somehow linked to a physical device
# For details see the rescue/GNU/Linux/310_network_devices.sh script.
ip link set dev eno1 up
ip link set dev eno1 mtu 1500
ip addr add 10.16.216.49/23 dev eno1
ip addr add 2620:52:0:10d8:1658:d0ff:fed3:31ab/64 dev eno1
+ip link set dev eno2 up
+ip link set dev eno2 mtu 1500 This is on a machine with two interfaces, one of them (
is no longer correct with the proposed code. |
@pcahyna Well done and valid point. So the task in the code is to gather all interfaces that are configured with an IP (either IPv4 and/or IPv6). |
Hello, |
@rmetrich What @pcahyna reports in his above
I think this means the connected but not configured interface I think any interface that is "somehow linked to a physical device" In particular for third party backup tools normally I wonder if ReaR should automatically exclude something I think something should be automatically excluded only when I am not a sufficient networking expert to make a decision |
Added comment that also appears in network_devices_setup_script that shows the idea behind which interfaces are selected, see #2907 (comment)
Via This is only to show how the current code (without this change here) |
@rmetrich Thanks for the insights. Indeed this is how this mechanism works (well documented by You in the code). The interesting question to me is what YOur intentions was to change the network interface selection mechanism from previous approach to "select IPv4 with routing NICs only". BTW, so far this seems to have worked flawlessly. |
Honestly I cannot remember. Probably I never got a pure IPv6 system and never saw any Red Hat customer have such, so in the end restoring the network for IPv4 only was sufficient. |
@jsmeix Likewise. But it seems this has never been (reported as) an issue until now with either the old or the new approach of collecting the network interfaces. |
Sure. I just raised the questions because it could have been a special decision by You to do so.
The system I am dealing with is a hybrid: E.g. the management interface is IPv4 only whereas the connection to the backup service is via IPv6 only. |
@jsmeix Under point 4 in my #2902 (comment) I mentioned it is possible to exclude NICs with BTW, from purely looking at the code this approach should have made the test passed of @pcahyna putting the |
Removed the comments about IP addresses for - network_devices_setup_script - the explanation of the algorithm used - and the part about "Collect list of all network interfaces to deal with." Added comment about EXCLUDE_NETWORK_INTERFACES directive. ref. to rear#2902
I adjusted the comments in my PR to align it with my code change. Since this change is working as such (as already shown with earlier ReaR versions) my opinion is my PR is a lightweight change to support IPv4 and IPv6 NICs in the rescue environment. @jsmeix @rmetrich @rear/contributors : Please leave Your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this change, code is much easier to read and makes more sense to check for interfaces instead of for routing entries.
I'd have expected to find something like ip link list
or such here, and if we target not too ancient systems we can use JSON output to process it, like this:
$ ip -json link list | jq -r '.[] | .ifname'
lo
eno1
docker0
veth9bdabf8
veth7f188b3
vboxnet0
$ ls -l /sys/class/net/
total 0
drwxr-xr-x 2 root root 0 Feb 16 18:57 ./
drwxr-xr-x 73 root root 0 Feb 16 18:56 ../
lrwxrwxrwx 1 root root 0 Feb 16 19:03 docker0 -> ../../devices/virtual/net/docker0/
lrwxrwxrwx 1 root root 0 Feb 16 19:03 eno1 -> ../../devices/pci0000:00/0000:00:19.0/net/eno1/
lrwxrwxrwx 1 root root 0 Feb 16 19:03 lo -> ../../devices/virtual/net/lo/
lrwxrwxrwx 1 root root 0 Feb 16 19:03 vboxnet0 -> ../../devices/virtual/net/vboxnet0/
lrwxrwxrwx 1 root root 0 Feb 16 19:03 veth7f188b3 -> ../../devices/virtual/net/veth7f188b3/
lrwxrwxrwx 1 root root 0 Feb 16 19:03 veth9bdabf8 -> ../../devices/virtual/net/veth9bdabf8/
But as I said, nice and simple change, big thanks!
What is keeping us from merging this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve it "bona fide" because it was
tested by @hpannenb and it works for him
and the new code looks better (much simpler).
But I did not (and cannot properly) test it
(I use only DHCP with a single network interface
which works for me and matches my networking skills).
It is a great piece of code @rmetrich provided since it covers almost any situation in different NIC setups already. I just changed a single line of code to include IPv6 only NICs again. @schlomo @jsmeix Appreciate both Your approvals on this; waiting for @pcahyna about his view/thoughts on my change. |
Added comment that also appears in network_devices_setup_script that shows the idea behind which interfaces are selected, see rear#2907 (comment)
@pcahyna any comments from you or can we merge this? |
@rear/contributors @pcahyna |
Relax-and-Recover (ReaR) Pull Request Template
Please fill in the following items before submitting a new pull request:
Pull Request Details:
Type: Bug Fix
Impact: Normal
Reference to related issue (URL):
Rescue/recovery networking does not work with IPv6 only NICs. #2902
How was this pull request tested?
Tested on a CentOS7 VM with two NICs; 2nd NIC IPv6 only;
tested on lab and production RHEL7 VMs with hybrid IPv4/6 and IPv6 only NICs.
Brief description of the changes in this pull request:
With this PR all available intefaces (IPv4 & IPv6) will be chosen for the rescue environment.
Previously just IPv4 interfaces with IP addresses and routing only were selected.