Jira (FACT-2887) retrieve_default_interface uses incorrect method and doesn't work when IPv6-only

11 views
Skip to first unread message

Kenyon Ralph (Jira)

unread,
Dec 5, 2020, 10:23:04 PM12/5/20
to puppe...@googlegroups.com
Kenyon Ralph created an issue
 
Facter / Bug FACT-2887
retrieve_default_interface uses incorrect method and doesn't work when IPv6-only
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2020/12/05 7:22 PM
Priority: Normal Normal
Reporter: Kenyon Ralph

Here: https://github.com/puppetlabs/facter/blob/2c87e9e700dc1f75bda71f3a7805449f37fa1945/lib/facter/resolvers/networking_linux_resolver.rb#L144

ip route get 1 is not the right way to get the default route egress interface. That's the equivalent of ip route get 1.0.0.0. There is nothing special about the 1.0.0.0 address, so it should not be treated like a way to find out the default route egress interface.

A better way to get the default route egress interface would be to use the output of ip route show default.

Also, this method currently neglects to take IPv6 into consideration. There should be a retrieve_default_interface_v6 method that looks at ip -6 route show default and populates a networking.primary6 fact.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Kenyon Ralph (Jira)

unread,
Dec 5, 2020, 11:00:04 PM12/5/20
to puppe...@googlegroups.com
Kenyon Ralph updated an issue
Change By: Kenyon Ralph
Here: https://github.com/puppetlabs/facter/blob/2c87e9e700dc1f75bda71f3a7805449f37fa1945/lib/facter/resolvers/networking_linux_resolver.rb#L144

{{ip route get 1}} is not the right way to get the default route egress interface. That's the equivalent of {{ip route get 1.0.0.0}}. There is nothing special about the 1.0.0.0 address, so it should not be treated like a way to find out the default route egress interface.

A better way to get the default route egress interface would be to use the output of {{ip route show default}}.
This is how it's done with the old tools here: https://github.com/puppetlabs/facter/blob/23a6be6494c0729eaf439e173020bb3be88b75c6/lib/facter/resolvers/networking_resolver.rb#L23

Also, this method currently neglects to take IPv6 into consideration. There should be a retrieve_default_interface_v6 method that looks at {{ip -6 route show default}} and populates a {{networking.primary6}} fact.

Mihai Buzgau (Jira)

unread,
Dec 7, 2020, 2:52:04 AM12/7/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Dec 7, 2020, 2:53:03 AM12/7/20
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Dec 7, 2020, 2:53:04 AM12/7/20
to puppe...@googlegroups.com

Sebastian Miclea (Jira)

unread,
Dec 7, 2020, 6:08:03 AM12/7/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Dec 8, 2020, 3:50:03 AM12/8/20
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages