aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2013-12-07 13:26:53 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-09 20:56:12 -0500
commit1f9248e5606afc6485255e38ad57bdac08fa7711 (patch)
treeef0c88bbc7d05fb3dcbb15e167eb8ef5505bc667 /net/ipv6
parent65be6291c856bee0308c535287f813418402d8b3 (diff)
neigh: convert parms to an array
This patch converts the neigh param members to an array. This allows easier manipulation which will be needed later on to provide better management of default values. Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/addrconf.c12
-rw-r--r--net/ipv6/ndisc.c43
2 files changed, 31 insertions, 24 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 5087cc5cb810..55dc56f9072c 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1071,7 +1071,7 @@ retry:
1071 1071
1072 regen_advance = idev->cnf.regen_max_retry * 1072 regen_advance = idev->cnf.regen_max_retry *
1073 idev->cnf.dad_transmits * 1073 idev->cnf.dad_transmits *
1074 idev->nd_parms->retrans_time / HZ; 1074 NEIGH_VAR(idev->nd_parms, RETRANS_TIME) / HZ;
1075 write_unlock_bh(&idev->lock); 1075 write_unlock_bh(&idev->lock);
1076 1076
1077 /* A temporary address is created only if this calculated Preferred 1077 /* A temporary address is created only if this calculated Preferred
@@ -1888,7 +1888,8 @@ static void ipv6_regen_rndid(unsigned long data)
1888 1888
1889 expires = jiffies + 1889 expires = jiffies +
1890 idev->cnf.temp_prefered_lft * HZ - 1890 idev->cnf.temp_prefered_lft * HZ -
1891 idev->cnf.regen_max_retry * idev->cnf.dad_transmits * idev->nd_parms->retrans_time - 1891 idev->cnf.regen_max_retry * idev->cnf.dad_transmits *
1892 NEIGH_VAR(idev->nd_parms, RETRANS_TIME) -
1892 idev->cnf.max_desync_factor * HZ; 1893 idev->cnf.max_desync_factor * HZ;
1893 if (time_before(expires, jiffies)) { 1894 if (time_before(expires, jiffies)) {
1894 pr_warn("%s: too short regeneration interval; timer disabled for %s\n", 1895 pr_warn("%s: too short regeneration interval; timer disabled for %s\n",
@@ -3188,7 +3189,8 @@ static void addrconf_dad_timer(unsigned long data)
3188 } 3189 }
3189 3190
3190 ifp->dad_probes--; 3191 ifp->dad_probes--;
3191 addrconf_mod_dad_timer(ifp, ifp->idev->nd_parms->retrans_time); 3192 addrconf_mod_dad_timer(ifp,
3193 NEIGH_VAR(ifp->idev->nd_parms, RETRANS_TIME));
3192 spin_unlock(&ifp->lock); 3194 spin_unlock(&ifp->lock);
3193 write_unlock(&idev->lock); 3195 write_unlock(&idev->lock);
3194 3196
@@ -3509,7 +3511,7 @@ restart:
3509 !(ifp->flags&IFA_F_TENTATIVE)) { 3511 !(ifp->flags&IFA_F_TENTATIVE)) {
3510 unsigned long regen_advance = ifp->idev->cnf.regen_max_retry * 3512 unsigned long regen_advance = ifp->idev->cnf.regen_max_retry *
3511 ifp->idev->cnf.dad_transmits * 3513 ifp->idev->cnf.dad_transmits *
3512 ifp->idev->nd_parms->retrans_time / HZ; 3514 NEIGH_VAR(ifp->idev->nd_parms, RETRANS_TIME) / HZ;
3513 3515
3514 if (age >= ifp->prefered_lft - regen_advance) { 3516 if (age >= ifp->prefered_lft - regen_advance) {
3515 struct inet6_ifaddr *ifpub = ifp->ifpub; 3517 struct inet6_ifaddr *ifpub = ifp->ifpub;
@@ -4231,7 +4233,7 @@ static int inet6_fill_ifla6_attrs(struct sk_buff *skb, struct inet6_dev *idev)
4231 ci.max_reasm_len = IPV6_MAXPLEN; 4233 ci.max_reasm_len = IPV6_MAXPLEN;
4232 ci.tstamp = cstamp_delta(idev->tstamp); 4234 ci.tstamp = cstamp_delta(idev->tstamp);
4233 ci.reachable_time = jiffies_to_msecs(idev->nd_parms->reachable_time); 4235 ci.reachable_time = jiffies_to_msecs(idev->nd_parms->reachable_time);
4234 ci.retrans_time = jiffies_to_msecs(idev->nd_parms->retrans_time); 4236 ci.retrans_time = jiffies_to_msecs(NEIGH_VAR(idev->nd_parms, RETRANS_TIME));
4235 if (nla_put(skb, IFLA_INET6_CACHEINFO, sizeof(ci), &ci)) 4237 if (nla_put(skb, IFLA_INET6_CACHEINFO, sizeof(ci), &ci))
4236 goto nla_put_failure; 4238 goto nla_put_failure;
4237 nla = nla_reserve(skb, IFLA_INET6_CONF, DEVCONF_MAX * sizeof(s32)); 4239 nla = nla_reserve(skb, IFLA_INET6_CONF, DEVCONF_MAX * sizeof(s32));
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 300865171394..0da0986a9292 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -125,17 +125,19 @@ struct neigh_table nd_tbl = {
125 .id = "ndisc_cache", 125 .id = "ndisc_cache",
126 .parms = { 126 .parms = {
127 .tbl = &nd_tbl, 127 .tbl = &nd_tbl,
128 .base_reachable_time = ND_REACHABLE_TIME,
129 .retrans_time = ND_RETRANS_TIMER,
130 .gc_staletime = 60 * HZ,
131 .reachable_time = ND_REACHABLE_TIME, 128 .reachable_time = ND_REACHABLE_TIME,
132 .delay_probe_time = 5 * HZ, 129 .data = {
133 .queue_len_bytes = 64*1024, 130 [NEIGH_VAR_MCAST_PROBES] = 3,
134 .ucast_probes = 3, 131 [NEIGH_VAR_UCAST_PROBES] = 3,
135 .mcast_probes = 3, 132 [NEIGH_VAR_RETRANS_TIME] = ND_RETRANS_TIMER,
136 .anycast_delay = 1 * HZ, 133 [NEIGH_VAR_BASE_REACHABLE_TIME] = ND_REACHABLE_TIME,
137 .proxy_delay = (8 * HZ) / 10, 134 [NEIGH_VAR_DELAY_PROBE_TIME] = 5 * HZ,
138 .proxy_qlen = 64, 135 [NEIGH_VAR_GC_STALETIME] = 60 * HZ,
136 [NEIGH_VAR_QUEUE_LEN_BYTES] = 64 * 1024,
137 [NEIGH_VAR_PROXY_QLEN] = 64,
138 [NEIGH_VAR_ANYCAST_DELAY] = 1 * HZ,
139 [NEIGH_VAR_PROXY_DELAY] = (8 * HZ) / 10,
140 },
139 }, 141 },
140 .gc_interval = 30 * HZ, 142 .gc_interval = 30 * HZ,
141 .gc_thresh1 = 128, 143 .gc_thresh1 = 128,
@@ -656,14 +658,14 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
656 if (skb && ipv6_chk_addr(dev_net(dev), &ipv6_hdr(skb)->saddr, dev, 1)) 658 if (skb && ipv6_chk_addr(dev_net(dev), &ipv6_hdr(skb)->saddr, dev, 1))
657 saddr = &ipv6_hdr(skb)->saddr; 659 saddr = &ipv6_hdr(skb)->saddr;
658 660
659 if ((probes -= neigh->parms->ucast_probes) < 0) { 661 if ((probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES)) < 0) {
660 if (!(neigh->nud_state & NUD_VALID)) { 662 if (!(neigh->nud_state & NUD_VALID)) {
661 ND_PRINTK(1, dbg, 663 ND_PRINTK(1, dbg,
662 "%s: trying to ucast probe in NUD_INVALID: %pI6\n", 664 "%s: trying to ucast probe in NUD_INVALID: %pI6\n",
663 __func__, target); 665 __func__, target);
664 } 666 }
665 ndisc_send_ns(dev, neigh, target, target, saddr); 667 ndisc_send_ns(dev, neigh, target, target, saddr);
666 } else if ((probes -= neigh->parms->app_probes) < 0) { 668 } else if ((probes -= NEIGH_VAR(neigh->parms, APP_PROBES)) < 0) {
667 neigh_app_ns(neigh); 669 neigh_app_ns(neigh);
668 } else { 670 } else {
669 addrconf_addr_solict_mult(target, &mcaddr); 671 addrconf_addr_solict_mult(target, &mcaddr);
@@ -790,7 +792,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
790 if (!(NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED) && 792 if (!(NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED) &&
791 skb->pkt_type != PACKET_HOST && 793 skb->pkt_type != PACKET_HOST &&
792 inc && 794 inc &&
793 idev->nd_parms->proxy_delay != 0) { 795 NEIGH_VAR(idev->nd_parms, PROXY_DELAY) != 0) {
794 /* 796 /*
795 * for anycast or proxy, 797 * for anycast or proxy,
796 * sender should delay its response 798 * sender should delay its response
@@ -1210,7 +1212,7 @@ skip_defrtr:
1210 rtime = (rtime*HZ)/1000; 1212 rtime = (rtime*HZ)/1000;
1211 if (rtime < HZ/10) 1213 if (rtime < HZ/10)
1212 rtime = HZ/10; 1214 rtime = HZ/10;
1213 in6_dev->nd_parms->retrans_time = rtime; 1215 NEIGH_VAR_SET(in6_dev->nd_parms, RETRANS_TIME, rtime);
1214 in6_dev->tstamp = jiffies; 1216 in6_dev->tstamp = jiffies;
1215 inet6_ifinfo_notify(RTM_NEWLINK, in6_dev); 1217 inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
1216 } 1218 }
@@ -1222,9 +1224,11 @@ skip_defrtr:
1222 if (rtime < HZ/10) 1224 if (rtime < HZ/10)
1223 rtime = HZ/10; 1225 rtime = HZ/10;
1224 1226
1225 if (rtime != in6_dev->nd_parms->base_reachable_time) { 1227 if (rtime != NEIGH_VAR(in6_dev->nd_parms, BASE_REACHABLE_TIME)) {
1226 in6_dev->nd_parms->base_reachable_time = rtime; 1228 NEIGH_VAR_SET(in6_dev->nd_parms,
1227 in6_dev->nd_parms->gc_staletime = 3 * rtime; 1229 BASE_REACHABLE_TIME, rtime);
1230 NEIGH_VAR_SET(in6_dev->nd_parms,
1231 GC_STALETIME, 3 * rtime);
1228 in6_dev->nd_parms->reachable_time = neigh_rand_reach_time(rtime); 1232 in6_dev->nd_parms->reachable_time = neigh_rand_reach_time(rtime);
1229 in6_dev->tstamp = jiffies; 1233 in6_dev->tstamp = jiffies;
1230 inet6_ifinfo_notify(RTM_NEWLINK, in6_dev); 1234 inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
@@ -1665,8 +1669,9 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void __user *bu
1665 ret = -1; 1669 ret = -1;
1666 1670
1667 if (write && ret == 0 && dev && (idev = in6_dev_get(dev)) != NULL) { 1671 if (write && ret == 0 && dev && (idev = in6_dev_get(dev)) != NULL) {
1668 if (ctl->data == &idev->nd_parms->base_reachable_time) 1672 if (ctl->data == &NEIGH_VAR(idev->nd_parms, BASE_REACHABLE_TIME))
1669 idev->nd_parms->reachable_time = neigh_rand_reach_time(idev->nd_parms->base_reachable_time); 1673 idev->nd_parms->reachable_time =
1674 neigh_rand_reach_time(NEIGH_VAR(idev->nd_parms, BASE_REACHABLE_TIME));
1670 idev->tstamp = jiffies; 1675 idev->tstamp = jiffies;
1671 inet6_ifinfo_notify(RTM_NEWLINK, idev); 1676 inet6_ifinfo_notify(RTM_NEWLINK, idev);
1672 in6_dev_put(idev); 1677 in6_dev_put(idev);