aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2006-08-22 03:01:08 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 17:55:12 -0400
commit86872cb57925c46a6499887d77afb880a892c0ec (patch)
treebc0442efb85226adac5c7ae43e632639dd1b6899 /net/ipv6/addrconf.c
parent40e22e8f3d4d4f1ff68fb03683f007c53ee8b348 (diff)
[IPv6] route: FIB6 configuration using struct fib6_config
Replaces the struct in6_rtmsg based interface orignating from the ioctl interface with a struct fib6_config based on. Allows changing the interface without breaking the ioctl interface and avoids passing on tons of parameters. The recently introduced struct nl_info is used to pass on netlink authorship information for notifications. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c65
1 files changed, 31 insertions, 34 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index aafba9ea9cb6..fc9cff3426c4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1509,59 +1509,56 @@ static void
1509addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev, 1509addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev,
1510 unsigned long expires, u32 flags) 1510 unsigned long expires, u32 flags)
1511{ 1511{
1512 struct in6_rtmsg rtmsg; 1512 struct fib6_config cfg = {
1513 .fc_table = RT6_TABLE_PREFIX,
1514 .fc_metric = IP6_RT_PRIO_ADDRCONF,
1515 .fc_ifindex = dev->ifindex,
1516 .fc_expires = expires,
1517 .fc_dst_len = plen,
1518 .fc_flags = RTF_UP | flags,
1519 };
1513 1520
1514 memset(&rtmsg, 0, sizeof(rtmsg)); 1521 ipv6_addr_copy(&cfg.fc_dst, pfx);
1515 ipv6_addr_copy(&rtmsg.rtmsg_dst, pfx);
1516 rtmsg.rtmsg_dst_len = plen;
1517 rtmsg.rtmsg_metric = IP6_RT_PRIO_ADDRCONF;
1518 rtmsg.rtmsg_ifindex = dev->ifindex;
1519 rtmsg.rtmsg_info = expires;
1520 rtmsg.rtmsg_flags = RTF_UP|flags;
1521 rtmsg.rtmsg_type = RTMSG_NEWROUTE;
1522 1522
1523 /* Prevent useless cloning on PtP SIT. 1523 /* Prevent useless cloning on PtP SIT.
1524 This thing is done here expecting that the whole 1524 This thing is done here expecting that the whole
1525 class of non-broadcast devices need not cloning. 1525 class of non-broadcast devices need not cloning.
1526 */ 1526 */
1527 if (dev->type == ARPHRD_SIT && (dev->flags&IFF_POINTOPOINT)) 1527 if (dev->type == ARPHRD_SIT && (dev->flags & IFF_POINTOPOINT))
1528 rtmsg.rtmsg_flags |= RTF_NONEXTHOP; 1528 cfg.fc_flags |= RTF_NONEXTHOP;
1529 1529
1530 ip6_route_add(&rtmsg, NULL, NULL, NULL, RT6_TABLE_PREFIX); 1530 ip6_route_add(&cfg);
1531} 1531}
1532 1532
1533/* Create "default" multicast route to the interface */ 1533/* Create "default" multicast route to the interface */
1534 1534
1535static void addrconf_add_mroute(struct net_device *dev) 1535static void addrconf_add_mroute(struct net_device *dev)
1536{ 1536{
1537 struct in6_rtmsg rtmsg; 1537 struct fib6_config cfg = {
1538 1538 .fc_table = RT6_TABLE_LOCAL,
1539 memset(&rtmsg, 0, sizeof(rtmsg)); 1539 .fc_metric = IP6_RT_PRIO_ADDRCONF,
1540 ipv6_addr_set(&rtmsg.rtmsg_dst, 1540 .fc_ifindex = dev->ifindex,
1541 htonl(0xFF000000), 0, 0, 0); 1541 .fc_dst_len = 8,
1542 rtmsg.rtmsg_dst_len = 8; 1542 .fc_flags = RTF_UP,
1543 rtmsg.rtmsg_metric = IP6_RT_PRIO_ADDRCONF; 1543 };
1544 rtmsg.rtmsg_ifindex = dev->ifindex; 1544
1545 rtmsg.rtmsg_flags = RTF_UP; 1545 ipv6_addr_set(&cfg.fc_dst, htonl(0xFF000000), 0, 0, 0);
1546 rtmsg.rtmsg_type = RTMSG_NEWROUTE; 1546
1547 ip6_route_add(&rtmsg, NULL, NULL, NULL, RT6_TABLE_LOCAL); 1547 ip6_route_add(&cfg);
1548} 1548}
1549 1549
1550static void sit_route_add(struct net_device *dev) 1550static void sit_route_add(struct net_device *dev)
1551{ 1551{
1552 struct in6_rtmsg rtmsg; 1552 struct fib6_config cfg = {
1553 1553 .fc_table = RT6_TABLE_MAIN,
1554 memset(&rtmsg, 0, sizeof(rtmsg)); 1554 .fc_metric = IP6_RT_PRIO_ADDRCONF,
1555 1555 .fc_ifindex = dev->ifindex,
1556 rtmsg.rtmsg_type = RTMSG_NEWROUTE; 1556 .fc_dst_len = 96,
1557 rtmsg.rtmsg_metric = IP6_RT_PRIO_ADDRCONF; 1557 .fc_flags = RTF_UP | RTF_NONEXTHOP,
1558 };
1558 1559
1559 /* prefix length - 96 bits "::d.d.d.d" */ 1560 /* prefix length - 96 bits "::d.d.d.d" */
1560 rtmsg.rtmsg_dst_len = 96; 1561 ip6_route_add(&cfg);
1561 rtmsg.rtmsg_flags = RTF_UP|RTF_NONEXTHOP;
1562 rtmsg.rtmsg_ifindex = dev->ifindex;
1563
1564 ip6_route_add(&rtmsg, NULL, NULL, NULL, RT6_TABLE_MAIN);
1565} 1562}
1566 1563
1567static void addrconf_add_lroute(struct net_device *dev) 1564static void addrconf_add_lroute(struct net_device *dev)