aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2006-03-20 20:04:53 -0500
committerDavid S. Miller <davem@davemloft.net>2006-03-20 20:04:53 -0500
commitebacaaa0fdf4402cdf4c8e569f54af36b6f0aa2d (patch)
tree5d1cc0c6d94b5226507434bb86e6e2a69fdd4204 /net/ipv6/route.c
parent8238dd0698b480e432acd955c45f9f907b8d27de (diff)
[IPV6]: ROUTE: Add support for Router Preference (RFC4191).
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 6a068e7f81f1..a7030fed1a18 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -251,8 +251,11 @@ static int rt6_score_route(struct rt6_info *rt, int oif,
251 int m = rt6_check_dev(rt, oif); 251 int m = rt6_check_dev(rt, oif);
252 if (!m && (strict & RT6_SELECT_F_IFACE)) 252 if (!m && (strict & RT6_SELECT_F_IFACE))
253 return -1; 253 return -1;
254#ifdef CONFIG_IPV6_ROUTER_PREF
255 m |= IPV6_DECODE_PREF(IPV6_EXTRACT_PREF(rt->rt6i_flags)) << 2;
256#endif
254 if (rt6_check_neigh(rt)) 257 if (rt6_check_neigh(rt))
255 m |= 4; 258 m |= 16;
256 else if (strict & RT6_SELECT_F_REACHABLE) 259 else if (strict & RT6_SELECT_F_REACHABLE)
257 return -1; 260 return -1;
258 return m; 261 return m;
@@ -1256,7 +1259,8 @@ struct rt6_info *rt6_get_dflt_router(struct in6_addr *addr, struct net_device *d
1256} 1259}
1257 1260
1258struct rt6_info *rt6_add_dflt_router(struct in6_addr *gwaddr, 1261struct rt6_info *rt6_add_dflt_router(struct in6_addr *gwaddr,
1259 struct net_device *dev) 1262 struct net_device *dev,
1263 unsigned int pref)
1260{ 1264{
1261 struct in6_rtmsg rtmsg; 1265 struct in6_rtmsg rtmsg;
1262 1266
@@ -1264,7 +1268,8 @@ struct rt6_info *rt6_add_dflt_router(struct in6_addr *gwaddr,
1264 rtmsg.rtmsg_type = RTMSG_NEWROUTE; 1268 rtmsg.rtmsg_type = RTMSG_NEWROUTE;
1265 ipv6_addr_copy(&rtmsg.rtmsg_gateway, gwaddr); 1269 ipv6_addr_copy(&rtmsg.rtmsg_gateway, gwaddr);
1266 rtmsg.rtmsg_metric = 1024; 1270 rtmsg.rtmsg_metric = 1024;
1267 rtmsg.rtmsg_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT | RTF_UP | RTF_EXPIRES; 1271 rtmsg.rtmsg_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT | RTF_UP | RTF_EXPIRES |
1272 RTF_PREF(pref);
1268 1273
1269 rtmsg.rtmsg_ifindex = dev->ifindex; 1274 rtmsg.rtmsg_ifindex = dev->ifindex;
1270 1275