Commit 5d9efa7ee99eed58388f186c13cf2e2a87e9ceb4
1 parent
d5d45d4294
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
ipv6: Remove privacy config option.
The code for privacy extentions is very mature, and making it configurable only gives marginal memory/code savings in exchange for obfuscation and hard to read code via CPP ifdef'ery. Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 4 changed files with 4 additions and 62 deletions Side-by-side Diff
include/linux/ipv6.h
... | ... | @@ -21,13 +21,11 @@ |
21 | 21 | __s32 force_mld_version; |
22 | 22 | __s32 mldv1_unsolicited_report_interval; |
23 | 23 | __s32 mldv2_unsolicited_report_interval; |
24 | -#ifdef CONFIG_IPV6_PRIVACY | |
25 | 24 | __s32 use_tempaddr; |
26 | 25 | __s32 temp_valid_lft; |
27 | 26 | __s32 temp_prefered_lft; |
28 | 27 | __s32 regen_max_retry; |
29 | 28 | __s32 max_desync_factor; |
30 | -#endif | |
31 | 29 | __s32 max_addresses; |
32 | 30 | __s32 accept_ra_defrtr; |
33 | 31 | __s32 accept_ra_pinfo; |
include/net/if_inet6.h
... | ... | @@ -66,11 +66,10 @@ |
66 | 66 | struct hlist_node addr_lst; |
67 | 67 | struct list_head if_list; |
68 | 68 | |
69 | -#ifdef CONFIG_IPV6_PRIVACY | |
70 | 69 | struct list_head tmp_list; |
71 | 70 | struct inet6_ifaddr *ifpub; |
72 | 71 | int regen_count; |
73 | -#endif | |
72 | + | |
74 | 73 | bool tokenized; |
75 | 74 | |
76 | 75 | struct rcu_head rcu; |
77 | 76 | |
... | ... | @@ -192,11 +191,9 @@ |
192 | 191 | __u32 if_flags; |
193 | 192 | int dead; |
194 | 193 | |
195 | -#ifdef CONFIG_IPV6_PRIVACY | |
196 | 194 | u8 rndid[8]; |
197 | 195 | struct timer_list regen_timer; |
198 | 196 | struct list_head tempaddr_list; |
199 | -#endif | |
200 | 197 | |
201 | 198 | struct in6_addr token; |
202 | 199 |
net/ipv6/Kconfig
... | ... | @@ -21,24 +21,6 @@ |
21 | 21 | |
22 | 22 | if IPV6 |
23 | 23 | |
24 | -config IPV6_PRIVACY | |
25 | - bool "IPv6: Privacy Extensions (RFC 3041) support" | |
26 | - ---help--- | |
27 | - Privacy Extensions for Stateless Address Autoconfiguration in IPv6 | |
28 | - support. With this option, additional periodically-altered | |
29 | - pseudo-random global-scope unicast address(es) will be assigned to | |
30 | - your interface(s). | |
31 | - | |
32 | - We use our standard pseudo-random algorithm to generate the | |
33 | - randomized interface identifier, instead of one described in RFC 3041. | |
34 | - | |
35 | - By default the kernel does not generate temporary addresses. | |
36 | - To use temporary addresses, do | |
37 | - | |
38 | - echo 2 >/proc/sys/net/ipv6/conf/all/use_tempaddr | |
39 | - | |
40 | - See <file:Documentation/networking/ip-sysctl.txt> for details. | |
41 | - | |
42 | 24 | config IPV6_ROUTER_PREF |
43 | 25 | bool "IPv6: Router Preference (RFC 4191) support" |
44 | 26 | ---help--- |
net/ipv6/addrconf.c
... | ... | @@ -83,11 +83,7 @@ |
83 | 83 | #include <linux/if_tunnel.h> |
84 | 84 | #include <linux/rtnetlink.h> |
85 | 85 | #include <linux/netconf.h> |
86 | - | |
87 | -#ifdef CONFIG_IPV6_PRIVACY | |
88 | 86 | #include <linux/random.h> |
89 | -#endif | |
90 | - | |
91 | 87 | #include <linux/uaccess.h> |
92 | 88 | #include <asm/unaligned.h> |
93 | 89 | |
94 | 90 | |
... | ... | @@ -124,11 +120,9 @@ |
124 | 120 | } |
125 | 121 | #endif |
126 | 122 | |
127 | -#ifdef CONFIG_IPV6_PRIVACY | |
128 | 123 | static void __ipv6_regen_rndid(struct inet6_dev *idev); |
129 | 124 | static void __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr); |
130 | 125 | static void ipv6_regen_rndid(unsigned long data); |
131 | -#endif | |
132 | 126 | |
133 | 127 | static int ipv6_generate_eui64(u8 *eui, struct net_device *dev); |
134 | 128 | static int ipv6_count_addresses(struct inet6_dev *idev); |
135 | 129 | |
... | ... | @@ -183,13 +177,11 @@ |
183 | 177 | .rtr_solicits = MAX_RTR_SOLICITATIONS, |
184 | 178 | .rtr_solicit_interval = RTR_SOLICITATION_INTERVAL, |
185 | 179 | .rtr_solicit_delay = MAX_RTR_SOLICITATION_DELAY, |
186 | -#ifdef CONFIG_IPV6_PRIVACY | |
187 | 180 | .use_tempaddr = 0, |
188 | 181 | .temp_valid_lft = TEMP_VALID_LIFETIME, |
189 | 182 | .temp_prefered_lft = TEMP_PREFERRED_LIFETIME, |
190 | 183 | .regen_max_retry = REGEN_MAX_RETRY, |
191 | 184 | .max_desync_factor = MAX_DESYNC_FACTOR, |
192 | -#endif | |
193 | 185 | .max_addresses = IPV6_MAX_ADDRESSES, |
194 | 186 | .accept_ra_defrtr = 1, |
195 | 187 | .accept_ra_pinfo = 1, |
196 | 188 | |
... | ... | @@ -221,13 +213,11 @@ |
221 | 213 | .rtr_solicits = MAX_RTR_SOLICITATIONS, |
222 | 214 | .rtr_solicit_interval = RTR_SOLICITATION_INTERVAL, |
223 | 215 | .rtr_solicit_delay = MAX_RTR_SOLICITATION_DELAY, |
224 | -#ifdef CONFIG_IPV6_PRIVACY | |
225 | 216 | .use_tempaddr = 0, |
226 | 217 | .temp_valid_lft = TEMP_VALID_LIFETIME, |
227 | 218 | .temp_prefered_lft = TEMP_PREFERRED_LIFETIME, |
228 | 219 | .regen_max_retry = REGEN_MAX_RETRY, |
229 | 220 | .max_desync_factor = MAX_DESYNC_FACTOR, |
230 | -#endif | |
231 | 221 | .max_addresses = IPV6_MAX_ADDRESSES, |
232 | 222 | .accept_ra_defrtr = 1, |
233 | 223 | .accept_ra_pinfo = 1, |
... | ... | @@ -371,7 +361,6 @@ |
371 | 361 | } |
372 | 362 | #endif |
373 | 363 | |
374 | -#ifdef CONFIG_IPV6_PRIVACY | |
375 | 364 | INIT_LIST_HEAD(&ndev->tempaddr_list); |
376 | 365 | setup_timer(&ndev->regen_timer, ipv6_regen_rndid, (unsigned long)ndev); |
377 | 366 | if ((dev->flags&IFF_LOOPBACK) || |
... | ... | @@ -384,7 +373,7 @@ |
384 | 373 | in6_dev_hold(ndev); |
385 | 374 | ipv6_regen_rndid((unsigned long) ndev); |
386 | 375 | } |
387 | -#endif | |
376 | + | |
388 | 377 | ndev->token = in6addr_any; |
389 | 378 | |
390 | 379 | if (netif_running(dev) && addrconf_qdisc_ok(dev)) |
391 | 380 | |
... | ... | @@ -865,12 +854,10 @@ |
865 | 854 | /* Add to inet6_dev unicast addr list. */ |
866 | 855 | ipv6_link_dev_addr(idev, ifa); |
867 | 856 | |
868 | -#ifdef CONFIG_IPV6_PRIVACY | |
869 | 857 | if (ifa->flags&IFA_F_TEMPORARY) { |
870 | 858 | list_add(&ifa->tmp_list, &idev->tempaddr_list); |
871 | 859 | in6_ifa_hold(ifa); |
872 | 860 | } |
873 | -#endif | |
874 | 861 | |
875 | 862 | in6_ifa_hold(ifa); |
876 | 863 | write_unlock(&idev->lock); |
... | ... | @@ -913,7 +900,7 @@ |
913 | 900 | spin_unlock_bh(&addrconf_hash_lock); |
914 | 901 | |
915 | 902 | write_lock_bh(&idev->lock); |
916 | -#ifdef CONFIG_IPV6_PRIVACY | |
903 | + | |
917 | 904 | if (ifp->flags&IFA_F_TEMPORARY) { |
918 | 905 | list_del(&ifp->tmp_list); |
919 | 906 | if (ifp->ifpub) { |
... | ... | @@ -922,7 +909,6 @@ |
922 | 909 | } |
923 | 910 | __in6_ifa_put(ifp); |
924 | 911 | } |
925 | -#endif | |
926 | 912 | |
927 | 913 | list_for_each_entry_safe(ifa, ifn, &idev->addr_list, if_list) { |
928 | 914 | if (ifa == ifp) { |
... | ... | @@ -1013,7 +999,6 @@ |
1013 | 999 | in6_ifa_put(ifp); |
1014 | 1000 | } |
1015 | 1001 | |
1016 | -#ifdef CONFIG_IPV6_PRIVACY | |
1017 | 1002 | static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *ift) |
1018 | 1003 | { |
1019 | 1004 | struct inet6_dev *idev = ifp->idev; |
... | ... | @@ -1116,7 +1101,6 @@ |
1116 | 1101 | out: |
1117 | 1102 | return ret; |
1118 | 1103 | } |
1119 | -#endif | |
1120 | 1104 | |
1121 | 1105 | /* |
1122 | 1106 | * Choose an appropriate source address (RFC3484) |
1123 | 1107 | |
... | ... | @@ -1131,9 +1115,7 @@ |
1131 | 1115 | #endif |
1132 | 1116 | IPV6_SADDR_RULE_OIF, |
1133 | 1117 | IPV6_SADDR_RULE_LABEL, |
1134 | -#ifdef CONFIG_IPV6_PRIVACY | |
1135 | 1118 | IPV6_SADDR_RULE_PRIVACY, |
1136 | -#endif | |
1137 | 1119 | IPV6_SADDR_RULE_ORCHID, |
1138 | 1120 | IPV6_SADDR_RULE_PREFIX, |
1139 | 1121 | IPV6_SADDR_RULE_MAX |
... | ... | @@ -1247,7 +1229,6 @@ |
1247 | 1229 | &score->ifa->addr, score->addr_type, |
1248 | 1230 | score->ifa->idev->dev->ifindex) == dst->label; |
1249 | 1231 | break; |
1250 | -#ifdef CONFIG_IPV6_PRIVACY | |
1251 | 1232 | case IPV6_SADDR_RULE_PRIVACY: |
1252 | 1233 | { |
1253 | 1234 | /* Rule 7: Prefer public address |
... | ... | @@ -1259,7 +1240,6 @@ |
1259 | 1240 | ret = (!(score->ifa->flags & IFA_F_TEMPORARY)) ^ preftmp; |
1260 | 1241 | break; |
1261 | 1242 | } |
1262 | -#endif | |
1263 | 1243 | case IPV6_SADDR_RULE_ORCHID: |
1264 | 1244 | /* Rule 8-: Prefer ORCHID vs ORCHID or |
1265 | 1245 | * non-ORCHID vs non-ORCHID |
... | ... | @@ -1588,7 +1568,6 @@ |
1588 | 1568 | if (dad_failed) |
1589 | 1569 | ipv6_ifa_notify(0, ifp); |
1590 | 1570 | in6_ifa_put(ifp); |
1591 | -#ifdef CONFIG_IPV6_PRIVACY | |
1592 | 1571 | } else if (ifp->flags&IFA_F_TEMPORARY) { |
1593 | 1572 | struct inet6_ifaddr *ifpub; |
1594 | 1573 | spin_lock_bh(&ifp->lock); |
... | ... | @@ -1602,7 +1581,6 @@ |
1602 | 1581 | spin_unlock_bh(&ifp->lock); |
1603 | 1582 | } |
1604 | 1583 | ipv6_del_addr(ifp); |
1605 | -#endif | |
1606 | 1584 | } else |
1607 | 1585 | ipv6_del_addr(ifp); |
1608 | 1586 | } |
... | ... | @@ -1851,7 +1829,6 @@ |
1851 | 1829 | return err; |
1852 | 1830 | } |
1853 | 1831 | |
1854 | -#ifdef CONFIG_IPV6_PRIVACY | |
1855 | 1832 | /* (re)generation of randomized interface identifier (RFC 3041 3.2, 3.5) */ |
1856 | 1833 | static void __ipv6_regen_rndid(struct inet6_dev *idev) |
1857 | 1834 | { |
... | ... | @@ -1919,7 +1896,6 @@ |
1919 | 1896 | if (tmpaddr && memcmp(idev->rndid, &tmpaddr->s6_addr[8], 8) == 0) |
1920 | 1897 | __ipv6_regen_rndid(idev); |
1921 | 1898 | } |
1922 | -#endif | |
1923 | 1899 | |
1924 | 1900 | /* |
1925 | 1901 | * Add prefix route. |
1926 | 1902 | |
... | ... | @@ -2207,9 +2183,7 @@ |
2207 | 2183 | if (ifp) { |
2208 | 2184 | int flags; |
2209 | 2185 | unsigned long now; |
2210 | -#ifdef CONFIG_IPV6_PRIVACY | |
2211 | 2186 | struct inet6_ifaddr *ift; |
2212 | -#endif | |
2213 | 2187 | u32 stored_lft; |
2214 | 2188 | |
2215 | 2189 | /* update lifetime (RFC2462 5.5.3 e) */ |
... | ... | @@ -2250,7 +2224,6 @@ |
2250 | 2224 | } else |
2251 | 2225 | spin_unlock(&ifp->lock); |
2252 | 2226 | |
2253 | -#ifdef CONFIG_IPV6_PRIVACY | |
2254 | 2227 | read_lock_bh(&in6_dev->lock); |
2255 | 2228 | /* update all temporary addresses in the list */ |
2256 | 2229 | list_for_each_entry(ift, &in6_dev->tempaddr_list, |
... | ... | @@ -2315,7 +2288,7 @@ |
2315 | 2288 | } else { |
2316 | 2289 | read_unlock_bh(&in6_dev->lock); |
2317 | 2290 | } |
2318 | -#endif | |
2291 | + | |
2319 | 2292 | in6_ifa_put(ifp); |
2320 | 2293 | addrconf_verify(0); |
2321 | 2294 | } |
... | ... | @@ -2995,7 +2968,6 @@ |
2995 | 2968 | if (!how) |
2996 | 2969 | idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY); |
2997 | 2970 | |
2998 | -#ifdef CONFIG_IPV6_PRIVACY | |
2999 | 2971 | if (how && del_timer(&idev->regen_timer)) |
3000 | 2972 | in6_dev_put(idev); |
3001 | 2973 | |
... | ... | @@ -3015,7 +2987,6 @@ |
3015 | 2987 | in6_ifa_put(ifa); |
3016 | 2988 | write_lock_bh(&idev->lock); |
3017 | 2989 | } |
3018 | -#endif | |
3019 | 2990 | |
3020 | 2991 | while (!list_empty(&idev->addr_list)) { |
3021 | 2992 | ifa = list_first_entry(&idev->addr_list, |
... | ... | @@ -3528,7 +3499,6 @@ |
3528 | 3499 | in6_ifa_put(ifp); |
3529 | 3500 | goto restart; |
3530 | 3501 | } |
3531 | -#ifdef CONFIG_IPV6_PRIVACY | |
3532 | 3502 | } else if ((ifp->flags&IFA_F_TEMPORARY) && |
3533 | 3503 | !(ifp->flags&IFA_F_TENTATIVE)) { |
3534 | 3504 | unsigned long regen_advance = ifp->idev->cnf.regen_max_retry * |
... | ... | @@ -3556,7 +3526,6 @@ |
3556 | 3526 | } else if (time_before(ifp->tstamp + ifp->prefered_lft * HZ - regen_advance * HZ, next)) |
3557 | 3527 | next = ifp->tstamp + ifp->prefered_lft * HZ - regen_advance * HZ; |
3558 | 3528 | spin_unlock(&ifp->lock); |
3559 | -#endif | |
3560 | 3529 | } else { |
3561 | 3530 | /* ifp->prefered_lft <= ifp->valid_lft */ |
3562 | 3531 | if (time_before(ifp->tstamp + ifp->prefered_lft * HZ, next)) |
3563 | 3532 | |
... | ... | @@ -4128,13 +4097,11 @@ |
4128 | 4097 | jiffies_to_msecs(cnf->mldv1_unsolicited_report_interval); |
4129 | 4098 | array[DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL] = |
4130 | 4099 | jiffies_to_msecs(cnf->mldv2_unsolicited_report_interval); |
4131 | -#ifdef CONFIG_IPV6_PRIVACY | |
4132 | 4100 | array[DEVCONF_USE_TEMPADDR] = cnf->use_tempaddr; |
4133 | 4101 | array[DEVCONF_TEMP_VALID_LFT] = cnf->temp_valid_lft; |
4134 | 4102 | array[DEVCONF_TEMP_PREFERED_LFT] = cnf->temp_prefered_lft; |
4135 | 4103 | array[DEVCONF_REGEN_MAX_RETRY] = cnf->regen_max_retry; |
4136 | 4104 | array[DEVCONF_MAX_DESYNC_FACTOR] = cnf->max_desync_factor; |
4137 | -#endif | |
4138 | 4105 | array[DEVCONF_MAX_ADDRESSES] = cnf->max_addresses; |
4139 | 4106 | array[DEVCONF_ACCEPT_RA_DEFRTR] = cnf->accept_ra_defrtr; |
4140 | 4107 | array[DEVCONF_ACCEPT_RA_PINFO] = cnf->accept_ra_pinfo; |
... | ... | @@ -4828,7 +4795,6 @@ |
4828 | 4795 | .mode = 0644, |
4829 | 4796 | .proc_handler = proc_dointvec_ms_jiffies, |
4830 | 4797 | }, |
4831 | -#ifdef CONFIG_IPV6_PRIVACY | |
4832 | 4798 | { |
4833 | 4799 | .procname = "use_tempaddr", |
4834 | 4800 | .data = &ipv6_devconf.use_tempaddr, |
... | ... | @@ -4864,7 +4830,6 @@ |
4864 | 4830 | .mode = 0644, |
4865 | 4831 | .proc_handler = proc_dointvec, |
4866 | 4832 | }, |
4867 | -#endif | |
4868 | 4833 | { |
4869 | 4834 | .procname = "max_addresses", |
4870 | 4835 | .data = &ipv6_devconf.max_addresses, |