Messages in this thread Patch in this message |  | | Date | Tue, 7 Nov 2000 15:55:27 +0100 | From | Jan Rekorajski <> | Subject | [PATCH] /proc/sys/net/ipv6/conf/*/autoconf_route |
| |
Hi, This patch adds /proc/sys/net/ipv6/conf/*/autoconf_route that controls if default route is added or not if there are no routers on the link, it also makes use of gcc struct initializers. If putting new members inside a struct or enum is a wrong thing here I can change it. The patch is against 2.4.0-test9,10.
Jan -- Jan Rękorajski | ALL SUSPECTS ARE GUILTY. PERIOD! baggins<at>mimuw.edu.pl | OTHERWISE THEY WOULDN'T BE SUSPECTS, WOULD THEY? BOFH, type MANIAC | -- TROOPS by Kevin Rubio diff -ur linux.orig/include/linux/sysctl.h linux.v6/include/linux/sysctl.h --- linux.orig/include/linux/sysctl.h Fri Sep 22 23:21:22 2000 +++ linux.v6/include/linux/sysctl.h Sat Oct 14 21:41:18 2000 @@ -342,10 +342,11 @@ NET_IPV6_ACCEPT_RA=4, NET_IPV6_ACCEPT_REDIRECTS=5, NET_IPV6_AUTOCONF=6, - NET_IPV6_DAD_TRANSMITS=7, - NET_IPV6_RTR_SOLICITS=8, - NET_IPV6_RTR_SOLICIT_INTERVAL=9, - NET_IPV6_RTR_SOLICIT_DELAY=10 + NET_IPV6_AUTOCONF_ROUTE=7, + NET_IPV6_DAD_TRANSMITS=8, + NET_IPV6_RTR_SOLICITS=9, + NET_IPV6_RTR_SOLICIT_INTERVAL=10, + NET_IPV6_RTR_SOLICIT_DELAY=11 }; /* /proc/sys/net/<protocol>/neigh/<dev> */ diff -ur linux.orig/include/net/if_inet6.h linux.v6/include/net/if_inet6.h --- linux.orig/include/net/if_inet6.h Tue Sep 19 00:04:13 2000 +++ linux.v6/include/net/if_inet6.h Sat Oct 14 21:38:40 2000 @@ -82,6 +82,7 @@ int accept_ra; int accept_redirects; int autoconf; + int autoconf_route; int dad_transmits; int rtr_solicits; int rtr_solicit_interval; diff -ur linux.orig/net/ipv6/addrconf.c linux.v6/net/ipv6/addrconf.c --- linux.orig/net/ipv6/addrconf.c Wed May 3 10:48:03 2000 +++ linux.v6/net/ipv6/addrconf.c Sun Oct 15 00:59:36 2000 @@ -21,6 +21,8 @@ * <chexum@bankinf.banki.hu> * Andi Kleen : kill doube kfree on module * unload. + * Jan Rekorajski : added autoconf_route sysctl + * <baggins@mimuw.edu.pl> */ #include <linux/config.h> @@ -96,30 +98,32 @@ struct ipv6_devconf ipv6_devconf = { - 0, /* forwarding */ - IPV6_DEFAULT_HOPLIMIT, /* hop limit */ - IPV6_MIN_MTU, /* mtu */ - 1, /* accept RAs */ - 1, /* accept redirects */ - 1, /* autoconfiguration */ - 1, /* dad transmits */ - MAX_RTR_SOLICITATIONS, /* router solicits */ - RTR_SOLICITATION_INTERVAL, /* rtr solicit interval */ - MAX_RTR_SOLICITATION_DELAY, /* rtr solicit delay */ + forwarding: 0, + hop_limit: IPV6_DEFAULT_HOPLIMIT, + mtu6: IPV6_MIN_MTU, + accept_ra: 1, + accept_redirects: 1, + autoconf: 1, + autoconf_route: 1, + dad_transmits: 1, + rtr_solicits: MAX_RTR_SOLICITATIONS, + rtr_solicit_interval: RTR_SOLICITATION_INTERVAL, + rtr_solicit_delay: MAX_RTR_SOLICITATION_DELAY, }; static struct ipv6_devconf ipv6_devconf_dflt = { - 0, /* forwarding */ - IPV6_DEFAULT_HOPLIMIT, /* hop limit */ - IPV6_MIN_MTU, /* mtu */ - 1, /* accept RAs */ - 1, /* accept redirects */ - 1, /* autoconfiguration */ - 1, /* dad transmits */ - MAX_RTR_SOLICITATIONS, /* router solicits */ - RTR_SOLICITATION_INTERVAL, /* rtr solicit interval */ - MAX_RTR_SOLICITATION_DELAY, /* rtr solicit delay */ + forwarding: 0, + hop_limit: IPV6_DEFAULT_HOPLIMIT, + mtu6: IPV6_MIN_MTU, + accept_ra: 1, + accept_redirects: 1, + autoconf: 1, + autoconf_route: 1, + dad_transmits: 1, + rtr_solicits: MAX_RTR_SOLICITATIONS, + rtr_solicit_interval: RTR_SOLICITATION_INTERVAL, + rtr_solicit_delay: MAX_RTR_SOLICITATION_DELAY, }; int ipv6_addr_type(struct in6_addr *addr) @@ -1430,15 +1434,17 @@ printk(KERN_DEBUG "%s: no IPv6 routers present\n", ifp->idev->dev->name); - memset(&rtmsg, 0, sizeof(struct in6_rtmsg)); - rtmsg.rtmsg_type = RTMSG_NEWROUTE; - rtmsg.rtmsg_metric = IP6_RT_PRIO_ADDRCONF; - rtmsg.rtmsg_flags = (RTF_ALLONLINK | RTF_ADDRCONF | - RTF_DEFAULT | RTF_UP); + if (ifp->idev->cnf.autoconf_route) { + memset(&rtmsg, 0, sizeof(struct in6_rtmsg)); + rtmsg.rtmsg_type = RTMSG_NEWROUTE; + rtmsg.rtmsg_metric = IP6_RT_PRIO_ADDRCONF; + rtmsg.rtmsg_flags = (RTF_ALLONLINK | RTF_ADDRCONF | + RTF_DEFAULT | RTF_UP); - rtmsg.rtmsg_ifindex = ifp->idev->dev->ifindex; + rtmsg.rtmsg_ifindex = ifp->idev->dev->ifindex; - ip6_route_add(&rtmsg); + ip6_route_add(&rtmsg); + } } out: @@ -1883,7 +1889,7 @@ static struct addrconf_sysctl_table { struct ctl_table_header *sysctl_header; - ctl_table addrconf_vars[11]; + ctl_table addrconf_vars[12]; ctl_table addrconf_dev[2]; ctl_table addrconf_conf_dir[2]; ctl_table addrconf_proto_dir[2]; @@ -1912,6 +1918,10 @@ {NET_IPV6_AUTOCONF, "autoconf", &ipv6_devconf.autoconf, sizeof(int), 0644, NULL, + &proc_dointvec}, + + {NET_IPV6_AUTOCONF_ROUTE, "autoconf_route", + &ipv6_devconf.autoconf_route, sizeof(int), 0644, NULL, &proc_dointvec}, {NET_IPV6_DAD_TRANSMITS, "dad_transmits", |  |