dhcpcd-discuss

Looking for a way to obtain offered gateway(s) from a link's DHCP but not apply them.

Malcolm Bofors

Wed Mar 11 23:17:19 2015

Hello, Gentlemen.

(Slackware distro of Linux 3.14.x w/grsecurity patches on x86_64 assumed for the purposes of this discussion.)

I've been using multi-homed uplink connections at home for many years, but up to this point, they've involved statically configured routes that are easily managed.

I lost one of those and am trying on "Time Warner Business Cable", for better or for worse, but they only seem to offer DHCP. I didn't think too much about it until I went to adapt my scripts, which consist of some shell scripts string and duct tape to obtain interface information and then configuring the kernel routing and packet marking rules according via iproute2.

It worked very well, and allowed me to do some things that seem well out of reach of most home users (load balancing to use different uplinks on a socket-by-socket basis, auto-failover, binding certain services to use a preferred uplink if it's available, etc).

One of the vital bits of information my scripts need is a given link's gateway to provide to iproute2's route. When I use DHCP, it seems there's no way I can obtain that information when an already-existing default gateway is configured outside of dhcpcd.

I've dumped the lease file and enabled DEBUG logging, to no avail. All I see is a "dummy" localhost gateway and the assigned host IP#.

Is it possible to obtain the details of the offered gateway from the exchange, or do I need to look into a patch to provide this? I'm happy to write it, but initial efforts by hammering on nc_route() in ipv4.c proved unfruitful. I suspect there's some "editing" of the obtained routes in get_routes() in ipv4.c. I'll look into that logic next, but it looks a bit messy and that part of the kernel's structures are unfamiliar to me, so it's slower-going than usual.

Thanks,
Malcolm


Follow-Ups:
Re: Looking for a way to obtain offered gateway(s) from a link's DHCP but not apply them.Roy Marples
Archive administrator: postmaster@marples.name