From aa9928f8051fc4a6746ff6f77eeff9643598ecba Mon Sep 17 00:00:00 2001 From: M_ars Date: Wed, 27 Jan 2021 14:00:46 +0100 Subject: [PATCH 1/3] ipv6: hash is calculated but not used afterwards ipv6: hash is calculated but not used afterwards hash is declared and assigned but not used anymore. ipv6_addr_hash() exhibit no side-effects. Signed-off-by: Hagen Paul Pfeifer Signed-off-by: David S. Miller see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/net/ipv6/addrconf.c?h=v3.19&id=96d796a38e9ec9a7c04a6cda3fc15d79efebb008 --- release/src-rt-6.x.4708/linux/linux-2.6.36/net/ipv6/addrconf.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/release/src-rt-6.x.4708/linux/linux-2.6.36/net/ipv6/addrconf.c b/release/src-rt-6.x.4708/linux/linux-2.6.36/net/ipv6/addrconf.c index 6ad694416f..2887e33019 100644 --- a/release/src-rt-6.x.4708/linux/linux-2.6.36/net/ipv6/addrconf.c +++ b/release/src-rt-6.x.4708/linux/linux-2.6.36/net/ipv6/addrconf.c @@ -712,12 +712,9 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) struct inet6_ifaddr *ifa, *ifn; struct inet6_dev *idev = ifp->idev; int state; - int hash; int deleted = 0, onlink = 0; unsigned long expires = jiffies; - hash = ipv6_addr_hash(&ifp->addr); - spin_lock_bh(&ifp->state_lock); state = ifp->state; ifp->state = INET6_IFADDR_STATE_DEAD; From 4d46e0c54bd8852702ea2ab2e52f29e289591e5b Mon Sep 17 00:00:00 2001 From: M_ars Date: Wed, 27 Jan 2021 14:21:34 +0100 Subject: [PATCH 2/3] ipv6: addrconf.c: Checkpatch cleanups net/ipv6/addrconf.c: Checkpatch cleanups net/ipv6/addrconf.c:340: WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable net/ipv6/addrconf.c:342: ERROR: "foo * bar" should be "foo *bar" net/ipv6/addrconf.c:444: ERROR: "foo * bar" should be "foo *bar" net/ipv6/addrconf.c:1337: WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable net/ipv6/addrconf.c:1526: ERROR: "(foo*)" should be "(foo *)" net/ipv6/addrconf.c:1671: ERROR: open brace '{' following function declarations go on the next line net/ipv6/addrconf.c:1914: ERROR: "foo * bar" should be "foo *bar" net/ipv6/addrconf.c:2368: ERROR: "foo * bar" should be "foo *bar" net/ipv6/addrconf.c:2370: ERROR: "foo * bar" should be "foo *bar" net/ipv6/addrconf.c:2416: ERROR: "foo * bar" should be "foo *bar" net/ipv6/addrconf.c:2437: ERROR: "foo * bar" should be "foo *bar" net/ipv6/addrconf.c:2573: ERROR: "foo * bar" should be "foo *bar" net/ipv6/addrconf.c:3797: ERROR: "foo* bar" should be "foo *bar" Signed-off-by: Eldad Zack Signed-off-by: David S. Miller see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v3.19&id=8e5e8f30d0dea1db2c8e2a78802e7e57f796f339 --- .../linux/linux-2.6.36/net/ipv6/addrconf.c | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/release/src-rt-6.x.4708/linux/linux-2.6.36/net/ipv6/addrconf.c b/release/src-rt-6.x.4708/linux/linux-2.6.36/net/ipv6/addrconf.c index 2887e33019..5f6c53e404 100644 --- a/release/src-rt-6.x.4708/linux/linux-2.6.36/net/ipv6/addrconf.c +++ b/release/src-rt-6.x.4708/linux/linux-2.6.36/net/ipv6/addrconf.c @@ -338,10 +338,9 @@ void in6_dev_finish_destroy(struct inet6_dev *idev) snmp6_free_dev(idev); call_rcu(&idev->rcu, in6_dev_finish_destroy_rcu); } - EXPORT_SYMBOL(in6_dev_finish_destroy); -static struct inet6_dev * ipv6_add_dev(struct net_device *dev) +static struct inet6_dev *ipv6_add_dev(struct net_device *dev) { struct inet6_dev *ndev; @@ -442,7 +441,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) return ndev; } -static struct inet6_dev * ipv6_find_idev(struct net_device *dev) +static struct inet6_dev *ipv6_find_idev(struct net_device *dev) { struct inet6_dev *idev; @@ -1339,7 +1338,6 @@ int ipv6_chk_prefix(struct in6_addr *addr, struct net_device *dev) rcu_read_unlock(); return onlink; } - EXPORT_SYMBOL(ipv6_chk_prefix); struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, const struct in6_addr *addr, @@ -1526,7 +1524,7 @@ static int addrconf_ifid_arcnet(u8 *eui, struct net_device *dev) if (dev->addr_len != ARCNET_ALEN) return -1; memset(eui, 0, 7); - eui[7] = *(u8*)dev->dev_addr; + eui[7] = *(u8 *)dev->dev_addr; return 0; } @@ -1654,7 +1652,8 @@ out: in6_dev_put(idev); } -static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr) { +static int __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr) +{ int ret = 0; if (tmpaddr && memcmp(idev->rndid, &tmpaddr->s6_addr[8], 8) == 0) @@ -1861,7 +1860,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) /* Try to figure out our local address for this prefix */ if (pinfo->autoconf && in6_dev->cnf.autoconf) { - struct inet6_ifaddr * ifp; + struct inet6_ifaddr *ifp; struct in6_addr addr; int create = 0, update_lft = 0; @@ -2287,9 +2286,9 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) } for_each_netdev(net, dev) { - struct in_device * in_dev = __in_dev_get_rtnl(dev); + struct in_device *in_dev = __in_dev_get_rtnl(dev); if (in_dev && (dev->flags & IFF_UP)) { - struct in_ifaddr * ifa; + struct in_ifaddr *ifa; int flag = scope; @@ -2335,7 +2334,7 @@ static void init_loopback(struct net_device *dev) static void addrconf_add_linklocal(struct inet6_dev *idev, struct in6_addr *addr) { - struct inet6_ifaddr * ifp; + struct inet6_ifaddr *ifp; u32 addr_flags = IFA_F_PERMANENT; #ifdef CONFIG_IPV6_OPTIMISTIC_DAD @@ -2356,7 +2355,7 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, struct in6_addr *addr static void addrconf_dev_config(struct net_device *dev) { struct in6_addr addr; - struct inet6_dev * idev; + struct inet6_dev *idev; ASSERT_RTNL(); @@ -2469,7 +2468,7 @@ static void addrconf_ip6_tnl_config(struct net_device *dev) } static int addrconf_notify(struct notifier_block *this, unsigned long event, - void * data) + void *data) { struct net_device *dev = (struct net_device *) data; struct inet6_dev *idev = __in6_dev_get(dev); @@ -3697,7 +3696,7 @@ static int inet6_dump_ifacaddr(struct sk_buff *skb, struct netlink_callback *cb) return inet6_dump_addr(skb, cb, type); } -static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr* nlh, +static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg) { struct net *net = sock_net(in_skb->sk); From e08d2f6310b95861cf03e0e3560baa851b7843aa Mon Sep 17 00:00:00 2001 From: M_ars Date: Thu, 28 Jan 2021 08:41:28 +0100 Subject: [PATCH 3/3] GUI: advanced-dhcpdns.asp - add Fast RA mode option Note: dnsmasq advertises the IPv6 prefix frequently (every ~10 seconds) for the first minute, and then drops back to sending maintenance advertisements every 10 minutes. This option forces dnsmasq to send RAs every 15 seconds ==> can help some devices to not lose conectivity --- release/src-rt-6.x.4708/router/httpd/tomato.c | 1 + release/src-rt-6.x.4708/router/rc/services.c | 5 ++++- release/src-rt-6.x.4708/router/shared/defaults.c | 1 + release/src-rt-6.x.4708/router/www/advanced-dhcpdns.asp | 8 +++++++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/release/src-rt-6.x.4708/router/httpd/tomato.c b/release/src-rt-6.x.4708/router/httpd/tomato.c index a88d8254a6..17626c3480 100644 --- a/release/src-rt-6.x.4708/router/httpd/tomato.c +++ b/release/src-rt-6.x.4708/router/httpd/tomato.c @@ -866,6 +866,7 @@ static const nvset_t nvset_list[] = { { "ipv6_dhcpd", V_01 }, { "ipv6_lease_time", V_RANGE(1, 720) }, // 1 ... up to 720 hours (30 days) IPv6 lease time { "ipv6_accept_ra", V_NUM }, + { "ipv6_fast_ra", V_01 }, // fast RA option --> send frequent RAs { "ipv6_tun_addr", V_IPV6(1) }, { "ipv6_tun_addrlen", V_RANGE(3, 127) }, { "ipv6_ifname", V_LENGTH(0, 8) }, diff --git a/release/src-rt-6.x.4708/router/rc/services.c b/release/src-rt-6.x.4708/router/rc/services.c index ff137722b7..9d899c76d8 100644 --- a/release/src-rt-6.x.4708/router/rc/services.c +++ b/release/src-rt-6.x.4708/router/rc/services.c @@ -523,8 +523,11 @@ void start_dnsmasq() ipv6_lease = 12; /* enable-ra should be enabled in both cases */ - if ((nvram_get_int("ipv6_radvd")) || (nvram_get_int("ipv6_dhcpd"))) + if ((nvram_get_int("ipv6_radvd")) || (nvram_get_int("ipv6_dhcpd"))) { fprintf(f, "enable-ra\n"); + if (nvram_get_int("ipv6_fast_ra")) + fprintf(f, "ra-param=br*, 15, 600\n"); /* interface = br*, ra-interval = 15 sec, router-lifetime = 600 sec (10 min) */ + } /* only SLAAC and NO DHCPv6 */ if ((nvram_get_int("ipv6_radvd")) && (!nvram_get_int("ipv6_dhcpd"))) diff --git a/release/src-rt-6.x.4708/router/shared/defaults.c b/release/src-rt-6.x.4708/router/shared/defaults.c index 7d7938bff1..9690b5d74b 100644 --- a/release/src-rt-6.x.4708/router/shared/defaults.c +++ b/release/src-rt-6.x.4708/router/shared/defaults.c @@ -301,6 +301,7 @@ struct nvram_tuple router_defaults[] = { { "ipv6_dhcpd", "1" , 0 }, // Enable DHCPv6 { "ipv6_lease_time", "12" , 0 }, // DHCP IPv6 default lease time in hours { "ipv6_accept_ra", "1" , 0 }, // Enable Accept RA on WAN (bit 0) and/or LAN (bit 1) interfaces (br0...br3 if available) + { "ipv6_fast_ra", "0" , 0 }, // Enable fast RA option --> send frequent RAs { "ipv6_ifname", "six0" , 0 }, // The interface facing the rest of the IPv6 world { "ipv6_tun_v4end", "0.0.0.0" , 0 }, // Foreign IPv4 endpoint of SIT tunnel { "ipv6_relay", "1" , 0 }, // Foreign IPv4 endpoint host of SIT tunnel 192.88.99.? diff --git a/release/src-rt-6.x.4708/router/www/advanced-dhcpdns.asp b/release/src-rt-6.x.4708/router/www/advanced-dhcpdns.asp index 8a2699b881..bb50351b82 100644 --- a/release/src-rt-6.x.4708/router/www/advanced-dhcpdns.asp +++ b/release/src-rt-6.x.4708/router/www/advanced-dhcpdns.asp @@ -18,7 +18,7 @@ @@ -194,6 +194,7 @@ function save() { /* IPV6-BEGIN */ fom.ipv6_radvd.value = fom._f_ipv6_radvd.checked ? 1 : 0; fom.ipv6_dhcpd.value = fom._f_ipv6_dhcpd.checked ? 1 : 0; + fom.ipv6_fast_ra.value = fom._f_ipv6_fast_ra.checked ? 1 : 0; fom.ipv6_lease_time.value = fom._f_ipv6_lease_time.value; /* IPV6-END */ fom.dnsmasq_q.value = 0; @@ -305,6 +306,7 @@ function init() { + @@ -425,6 +427,7 @@ function init() { /* IPV6-BEGIN */ { title: 'Announce IPv6 on LAN (SLAAC)', name: 'f_ipv6_radvd', type: 'checkbox', value: nvram.ipv6_radvd == '1' }, { title: 'Announce IPv6 on LAN (DHCP)', name: 'f_ipv6_dhcpd', type: 'checkbox', value: nvram.ipv6_dhcpd == '1' }, + { title: 'Fast RA mode', name: 'f_ipv6_fast_ra', type: 'checkbox', value: nvram.ipv6_fast_ra == '1' }, { title: 'DHCP IPv6 lease time', name: 'f_ipv6_lease_time', type: 'text', maxlen: 3, size: 8, suffix: ' (in hours)<\/small>', value: nvram.ipv6_lease_time || 12 }, /* IPV6-END */ { title: 'Mute dhcpv4 logging', name: 'f_dnsmasq_q4', type: 'checkbox', value: (nvram.dnsmasq_q & 1) }, @@ -468,6 +471,9 @@ function init() {
  • Use user-entered gateway if WAN is disabled - DHCP will use the IP address of the router as the default gateway on each LAN.
  • Ignore DHCP requests (...) - Dnsmasq will ignore DHCP requests to only MAC addresses listed on the Static DHCP/ARP page won't be able to obtain an IP address through DHCP.
  • Static lease time - Absolute maximum amount of time allowed for any DHCP lease to be valid.
  • + +
  • Fast RA mode - Forces dnsmasq to be always in frequent RA mode. (Recommendation: enable also "Mute RA logging" option)
  • +
  • Custom configuration - Extra options to be added to the Dnsmasq configuration file.