[patch]: Allow user to set metric on default route learned via Router…#182
Closed
praveen-li wants to merge 1 commit intosonic-net:201811from
Closed
[patch]: Allow user to set metric on default route learned via Router…#182praveen-li wants to merge 1 commit intosonic-net:201811from
praveen-li wants to merge 1 commit intosonic-net:201811from
Conversation
… Advertisement.
Allow user to set metric on default route learned via Router Advertisement.
Note: RFC 4191 does not say anything for metric for IPv6 default route.
Fix:
For IPv4, default route is learned via DHCPv4 and user is allowed to change
metric using config in etc/network/interfaces. But for IPv6, default route can
be learned via RA, for which, currently a fixed metric value 1024 is used.
Ideally, user should be able to configure metric on default route for IPv6
similar to IPv4. This fix adds sysctl for the same.
Logs:
----------------------------------------------------------------
For IPv4:
----------------------------------------------------------------
Config in etc/network/interfaces
----------------------------------------------------------------
```
auto eth0
iface eth0 inet dhcp
metric 4261413864
```
IPv4 Kernel Route Table:
----------------------------------------------------------------
```
$ sudo route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.11.44.1 0.0.0.0 UG -33553432 0 0 eth0
```
FRR Table, if default route is learned via routing protocol too.
----------------------------------------------------------------
```
Codes: K - kernel route, C - connected, S - static, R - RIP,
O - OSPF, I - IS-IS, B - BGP, P - PIM, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
> - selected route, * - FIB route
S>* 0.0.0.0/0 [20/0] is directly connected, eth0, 00:00:03
K 0.0.0.0/0 [254/1000] via 172.21.47.1, eth0, 6d08h51m
```
----------------------------------------------------------------
i.e. User can prefer Default Router learned via Routing Protocol,
Similar behavior is not possible for IPv6, without this fix.
----------------------------------------------------------------
After fix [for IPv6]:
----------------------------------------------------------------
```
sudo sysctl -w net.ipv6.conf.eth0.net.ipv6.conf.eth0.accept_ra_defrtr_metric=0x770003e9
```
IP monitor:
----------------------------------------------------------------
```
default via fe80::be16:65ff:feb3:ce8e dev eth0 proto ra metric 1996489705 pref high
```
Kernel IPv6 routing table
----------------------------------------------------------------
```
Destination Next Hop Flag Met Ref Use If
::/0 fe80::be16:65ff:feb3:ce8e UGDAe 1996489705 0
0 eth0
```
FRR Routing Table, if default route is learned via routing protocol.
----------------------------------------------------------------
Codes: K - kernel route, C - connected, S - static, R - RIPng,
O - OSPFv3, I - IS-IS, B - BGP, N - NHRP, T - Table,
v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
> - selected route, * - FIB route
S>* ::/0 [20/0] is directly connected, eth0, 00:00:06
K ::/0 [119/1001] via fe80::be16:65ff:feb3:ce8e, eth0, 6d07h43m
----------------------------------------------------------------
Signed-off-by: Praveen Chaudhary<pchaudhary@linkedin.com>
RB=
G=lnos-reviewers
R=pchaudhary,pmao,rmolina,samaity,sfardeen,zxu
A=
Contributor
|
Is that the same as merge/pull request #180? |
Member
Author
Yes it is, both fixes are almost similar except route structure is changed from rt6_info to fib6_info, so I have to adjust fix as below in one line: Replace "rt->fib6_metric" with "rt->rt6i_metric" for previous version. |
Contributor
|
why do we have two pr then? can you delete one? |
Member
Author
@lguohan : I am not able to build the same patch for 4.9.168, So raised it, thinking, we have build tests for the 201811 branch as well. I will mark this as a Draft as well. Note: Both PRs are in the draft as of now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… Advertisement.
Allow user to set metric on default route learned via Router Advertisement.
Note: RFC 4191 does not say anything for metric for IPv6 default route.
Fix:
For IPv4, default route is learned via DHCPv4 and user is allowed to change
metric using config in etc/network/interfaces. But for IPv6, default route can
be learned via RA, for which, currently a fixed metric value 1024 is used.
Ideally, user should be able to configure metric on default route for IPv6
similar to IPv4. This fix adds sysctl for the same.
Logs:
For IPv4:
Config in etc/network/interfaces
IPv4 Kernel Route Table:
FRR Table, if default route is learned via routing protocol too.
i.e. User can prefer Default Router learned via Routing Protocol,
Similar behavior is not possible for IPv6, without this fix.
After fix [for IPv6]:
IP monitor:
Kernel IPv6 routing table
FRR Routing Table, if default route is learned via routing protocol.