Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 76694 - net-misc/dhcpcd: patch to enable route metric option
Summary: net-misc/dhcpcd: patch to enable route metric option
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: High enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 98852 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-01-04 15:25 UTC by Andy Dustman
Modified: 2005-07-13 00:05 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
dhcpcd-1.3.22_p4-routemetric.diff (dhcpcd-1.3.22_p4-routemetric.diff,2.92 KB, patch)
2005-01-04 15:25 UTC, Andy Dustman
Details | Diff
dhcpcd.ebuild.diff (dhcpcd.ebuild.diff,675 bytes, patch)
2005-01-04 15:27 UTC, Andy Dustman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Dustman 2005-01-04 15:25:10 UTC
It's not too uncommon to have two public network interfaces, and to prefer one over another. The primary example is a laptop with both ethernet and wireless. ifplugd is good for managing the interfaces, but it has no means of doing anything with the default route. dhcpcd normally installs a default route for the interface, but does not have a means for setting the route metric/preference.

The folllowing patch add the -m routemetric option to dhcpcd, which allows you to set the route metric when it creates the default route. Then you can do stuff like this in /etc/conf.d/net:

dhcpcd_eth0="-m 1" # ethernet
dhcpcd_eth1="-m 2" # wireless

eth0 is then used as the default route; if eth0 is down, then eth1 is used:

# ip route
198.137.24.0/24 dev eth1  proto kernel  scope link  src 198.137.24.187
128.192.120.0/22 dev eth0  proto kernel  scope link  src 128.192.123.45
127.0.0.0/8 dev lo  scope link
default via 128.192.120.1 dev eth0
default via 198.137.24.1 dev eth1  metric 1

Note that dhcpcd normally uses a metric of 1 or 0; therefore the patch uses a default (and minimum) value of 1, and in certain cases, reduces the metric by 1. You can see this in the example ip route output above. If -m is not supplied, you keep the default behavior.

Two attachments to follow.
Comment 1 Andy Dustman 2005-01-04 15:25:59 UTC
Created attachment 47661 [details, diff]
dhcpcd-1.3.22_p4-routemetric.diff

Patch to enable -m routemetric option
Comment 2 Andy Dustman 2005-01-04 15:27:23 UTC
Created attachment 47662 [details, diff]
dhcpcd.ebuild.diff

Patch to ebuild (-r7) to apply routemetric patch against
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-01-06 03:04:55 UTC
what is the origin of the route metric patch? did you write it yourself? (once burned on patch licenses, twice shy...).
Comment 4 Andy Dustman 2005-01-06 13:53:40 UTC
I wrote this patch myself, and consider it too trivial to consider anything other than public domain.
Comment 5 Roy Marples (RETIRED) gentoo-dev 2005-06-01 08:30:37 UTC
Fixed in -r8
Thanks Andy!
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-07-13 00:05:13 UTC
*** Bug 98852 has been marked as a duplicate of this bug. ***