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
@@ -124,11 +120,9 @@ static inline void addrconf_sysctl_unregister(struct inet6_dev *idev)
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 );
@@ -183,13 +177,11 @@ static struct ipv6_devconf ipv6_devconf __read_mostly = {
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 ,
@@ -221,13 +213,11 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
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 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)
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 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)
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 ))
@@ -865,12 +854,10 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
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 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
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 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
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 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
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 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *i
1116
1101
out :
1117
1102
return ret ;
1118
1103
}
1119
- #endif
1120
1104
1121
1105
/*
1122
1106
* Choose an appropriate source address (RFC3484)
@@ -1131,9 +1115,7 @@ enum {
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 @@ static int ipv6_get_saddr_eval(struct net *net,
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 @@ static int ipv6_get_saddr_eval(struct net *net,
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 @@ static void addrconf_dad_stop(struct inet6_ifaddr *ifp, int dad_failed)
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 @@ static void addrconf_dad_stop(struct inet6_ifaddr *ifp, int dad_failed)
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 @@ static int ipv6_inherit_eui64(u8 *eui, struct inet6_dev *idev)
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 @@ static void __ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmp
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.
@@ -2207,9 +2183,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
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 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
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 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
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 @@ static int addrconf_ifdown(struct net_device *dev, int how)
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 @@ static int addrconf_ifdown(struct net_device *dev, int how)
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 @@ static void addrconf_verify(unsigned long foo)
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 @@ static void addrconf_verify(unsigned long foo)
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 ))
@@ -4128,13 +4097,11 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
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 @@ static struct addrconf_sysctl_table
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 @@ static struct addrconf_sysctl_table
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 ,
0 commit comments