summaryrefslogtreecommitdiffstats
path: root/if-linux.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-09-12 18:08:07 +0000
committerRoy Marples <roy@marples.name>2008-09-12 18:08:07 +0000
commit441f7d159dbb8448f075e177f9c3770503fc6aa4 (patch)
treed15137305cff6bf6da5a7343f88691f17fa79859 /if-linux.c
parentbe070f751ba8033aebb08e1cece0f0081d9c2a88 (diff)
downloaddhcpcd-441f7d159dbb8448f075e177f9c3770503fc6aa4.tar.xz
Remove remembering routes per interface and have a global routing table so we can change routes depending on interface state. This is very useful for the BSD's where there is no route metric.
Diffstat (limited to 'if-linux.c')
-rw-r--r--if-linux.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/if-linux.c b/if-linux.c
index 3840f931..4a9dd61b 100644
--- a/if-linux.c
+++ b/if-linux.c
@@ -365,7 +365,10 @@ if_route(const struct interface *iface,
else {
nlm->hdr.nlmsg_flags |= NLM_F_CREATE | NLM_F_EXCL;
/* We only change route metrics for kernel routes */
- nlm->rt.rtm_protocol = action ? RTPROT_BOOT : RTPROT_KERNEL;
+ if (action == 0 && netmask->s_addr == iface->net.s_addr)
+ nlm->rt.rtm_protocol = RTPROT_KERNEL;
+ else
+ nlm->rt.rtm_protocol = RTPROT_BOOT;
if (gateway->s_addr == INADDR_ANY)
nlm->rt.rtm_scope = RT_SCOPE_LINK;
else