@@ -852,7 +852,7 @@ static void addrconf_forward_change(struct net *net, __s32 newf)
852
852
struct inet6_dev * idev ;
853
853
854
854
for_each_netdev (net , dev ) {
855
- idev = __in6_dev_get (dev );
855
+ idev = __in6_dev_get_rtnl_net (dev );
856
856
if (idev ) {
857
857
int changed = (!idev -> cnf .forwarding ) ^ (!newf );
858
858
@@ -865,13 +865,12 @@ static void addrconf_forward_change(struct net *net, __s32 newf)
865
865
866
866
static int addrconf_fixup_forwarding (const struct ctl_table * table , int * p , int newf )
867
867
{
868
- struct net * net ;
868
+ struct net * net = ( struct net * ) table -> extra2 ;
869
869
int old ;
870
870
871
- if (!rtnl_trylock ( ))
871
+ if (!rtnl_net_trylock ( net ))
872
872
return restart_syscall ();
873
873
874
- net = (struct net * )table -> extra2 ;
875
874
old = * p ;
876
875
WRITE_ONCE (* p , newf );
877
876
@@ -881,7 +880,7 @@ static int addrconf_fixup_forwarding(const struct ctl_table *table, int *p, int
881
880
NETCONFA_FORWARDING ,
882
881
NETCONFA_IFINDEX_DEFAULT ,
883
882
net -> ipv6 .devconf_dflt );
884
- rtnl_unlock ( );
883
+ rtnl_net_unlock ( net );
885
884
return 0 ;
886
885
}
887
886
@@ -903,7 +902,7 @@ static int addrconf_fixup_forwarding(const struct ctl_table *table, int *p, int
903
902
net -> ipv6 .devconf_all );
904
903
} else if ((!newf ) ^ (!old ))
905
904
dev_forward_change ((struct inet6_dev * )table -> extra1 );
906
- rtnl_unlock ( );
905
+ rtnl_net_unlock ( net );
907
906
908
907
if (newf )
909
908
rt6_purge_dflt_routers (net );
@@ -916,7 +915,7 @@ static void addrconf_linkdown_change(struct net *net, __s32 newf)
916
915
struct inet6_dev * idev ;
917
916
918
917
for_each_netdev (net , dev ) {
919
- idev = __in6_dev_get (dev );
918
+ idev = __in6_dev_get_rtnl_net (dev );
920
919
if (idev ) {
921
920
int changed = (!idev -> cnf .ignore_routes_with_linkdown ) ^ (!newf );
922
921
@@ -933,13 +932,12 @@ static void addrconf_linkdown_change(struct net *net, __s32 newf)
933
932
934
933
static int addrconf_fixup_linkdown (const struct ctl_table * table , int * p , int newf )
935
934
{
936
- struct net * net ;
935
+ struct net * net = ( struct net * ) table -> extra2 ;
937
936
int old ;
938
937
939
- if (!rtnl_trylock ( ))
938
+ if (!rtnl_net_trylock ( net ))
940
939
return restart_syscall ();
941
940
942
- net = (struct net * )table -> extra2 ;
943
941
old = * p ;
944
942
WRITE_ONCE (* p , newf );
945
943
@@ -950,7 +948,7 @@ static int addrconf_fixup_linkdown(const struct ctl_table *table, int *p, int ne
950
948
NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN ,
951
949
NETCONFA_IFINDEX_DEFAULT ,
952
950
net -> ipv6 .devconf_dflt );
953
- rtnl_unlock ( );
951
+ rtnl_net_unlock ( net );
954
952
return 0 ;
955
953
}
956
954
@@ -964,7 +962,8 @@ static int addrconf_fixup_linkdown(const struct ctl_table *table, int *p, int ne
964
962
NETCONFA_IFINDEX_ALL ,
965
963
net -> ipv6 .devconf_all );
966
964
}
967
- rtnl_unlock ();
965
+
966
+ rtnl_net_unlock (net );
968
967
969
968
return 1 ;
970
969
}
@@ -6370,7 +6369,7 @@ static void addrconf_disable_change(struct net *net, __s32 newf)
6370
6369
struct inet6_dev * idev ;
6371
6370
6372
6371
for_each_netdev (net , dev ) {
6373
- idev = __in6_dev_get (dev );
6372
+ idev = __in6_dev_get_rtnl_net (dev );
6374
6373
if (idev ) {
6375
6374
int changed = (!idev -> cnf .disable_ipv6 ) ^ (!newf );
6376
6375
@@ -6391,7 +6390,7 @@ static int addrconf_disable_ipv6(const struct ctl_table *table, int *p, int newf
6391
6390
return 0 ;
6392
6391
}
6393
6392
6394
- if (!rtnl_trylock ( ))
6393
+ if (!rtnl_net_trylock ( net ))
6395
6394
return restart_syscall ();
6396
6395
6397
6396
old = * p ;
@@ -6400,10 +6399,11 @@ static int addrconf_disable_ipv6(const struct ctl_table *table, int *p, int newf
6400
6399
if (p == & net -> ipv6 .devconf_all -> disable_ipv6 ) {
6401
6400
WRITE_ONCE (net -> ipv6 .devconf_dflt -> disable_ipv6 , newf );
6402
6401
addrconf_disable_change (net , newf );
6403
- } else if ((!newf ) ^ (!old ))
6402
+ } else if ((!newf ) ^ (!old )) {
6404
6403
dev_disable_change ((struct inet6_dev * )table -> extra1 );
6404
+ }
6405
6405
6406
- rtnl_unlock ( );
6406
+ rtnl_net_unlock ( net );
6407
6407
return 0 ;
6408
6408
}
6409
6409
@@ -6446,28 +6446,28 @@ static int addrconf_sysctl_proxy_ndp(const struct ctl_table *ctl, int write,
6446
6446
if (write && old != new ) {
6447
6447
struct net * net = ctl -> extra2 ;
6448
6448
6449
- if (!rtnl_trylock ( ))
6449
+ if (!rtnl_net_trylock ( net ))
6450
6450
return restart_syscall ();
6451
6451
6452
- if (valp == & net -> ipv6 .devconf_dflt -> proxy_ndp )
6452
+ if (valp == & net -> ipv6 .devconf_dflt -> proxy_ndp ) {
6453
6453
inet6_netconf_notify_devconf (net , RTM_NEWNETCONF ,
6454
6454
NETCONFA_PROXY_NEIGH ,
6455
6455
NETCONFA_IFINDEX_DEFAULT ,
6456
6456
net -> ipv6 .devconf_dflt );
6457
- else if (valp == & net -> ipv6 .devconf_all -> proxy_ndp )
6457
+ } else if (valp == & net -> ipv6 .devconf_all -> proxy_ndp ) {
6458
6458
inet6_netconf_notify_devconf (net , RTM_NEWNETCONF ,
6459
6459
NETCONFA_PROXY_NEIGH ,
6460
6460
NETCONFA_IFINDEX_ALL ,
6461
6461
net -> ipv6 .devconf_all );
6462
- else {
6462
+ } else {
6463
6463
struct inet6_dev * idev = ctl -> extra1 ;
6464
6464
6465
6465
inet6_netconf_notify_devconf (net , RTM_NEWNETCONF ,
6466
6466
NETCONFA_PROXY_NEIGH ,
6467
6467
idev -> dev -> ifindex ,
6468
6468
& idev -> cnf );
6469
6469
}
6470
- rtnl_unlock ( );
6470
+ rtnl_net_unlock ( net );
6471
6471
}
6472
6472
6473
6473
return ret ;
@@ -6487,7 +6487,7 @@ static int addrconf_sysctl_addr_gen_mode(const struct ctl_table *ctl, int write,
6487
6487
.mode = ctl -> mode ,
6488
6488
};
6489
6489
6490
- if (!rtnl_trylock ( ))
6490
+ if (!rtnl_net_trylock ( net ))
6491
6491
return restart_syscall ();
6492
6492
6493
6493
new_val = * ((u32 * )ctl -> data );
@@ -6517,7 +6517,7 @@ static int addrconf_sysctl_addr_gen_mode(const struct ctl_table *ctl, int write,
6517
6517
6518
6518
WRITE_ONCE (net -> ipv6 .devconf_dflt -> addr_gen_mode , new_val );
6519
6519
for_each_netdev (net , dev ) {
6520
- idev = __in6_dev_get (dev );
6520
+ idev = __in6_dev_get_rtnl_net (dev );
6521
6521
if (idev &&
6522
6522
idev -> cnf .addr_gen_mode != new_val ) {
6523
6523
WRITE_ONCE (idev -> cnf .addr_gen_mode ,
@@ -6531,7 +6531,7 @@ static int addrconf_sysctl_addr_gen_mode(const struct ctl_table *ctl, int write,
6531
6531
}
6532
6532
6533
6533
out :
6534
- rtnl_unlock ( );
6534
+ rtnl_net_unlock ( net );
6535
6535
6536
6536
return ret ;
6537
6537
}
@@ -6553,7 +6553,7 @@ static int addrconf_sysctl_stable_secret(const struct ctl_table *ctl, int write,
6553
6553
lctl .maxlen = IPV6_MAX_STRLEN ;
6554
6554
lctl .data = str ;
6555
6555
6556
- if (!rtnl_trylock ( ))
6556
+ if (!rtnl_net_trylock ( net ))
6557
6557
return restart_syscall ();
6558
6558
6559
6559
if (!write && !secret -> initialized ) {
@@ -6583,7 +6583,7 @@ static int addrconf_sysctl_stable_secret(const struct ctl_table *ctl, int write,
6583
6583
struct net_device * dev ;
6584
6584
6585
6585
for_each_netdev (net , dev ) {
6586
- struct inet6_dev * idev = __in6_dev_get (dev );
6586
+ struct inet6_dev * idev = __in6_dev_get_rtnl_net (dev );
6587
6587
6588
6588
if (idev ) {
6589
6589
WRITE_ONCE (idev -> cnf .addr_gen_mode ,
@@ -6598,7 +6598,7 @@ static int addrconf_sysctl_stable_secret(const struct ctl_table *ctl, int write,
6598
6598
}
6599
6599
6600
6600
out :
6601
- rtnl_unlock ( );
6601
+ rtnl_net_unlock ( net );
6602
6602
6603
6603
return err ;
6604
6604
}
@@ -6682,7 +6682,7 @@ int addrconf_disable_policy(const struct ctl_table *ctl, int *valp, int val)
6682
6682
return 0 ;
6683
6683
}
6684
6684
6685
- if (!rtnl_trylock ( ))
6685
+ if (!rtnl_net_trylock ( net ))
6686
6686
return restart_syscall ();
6687
6687
6688
6688
WRITE_ONCE (* valp , val );
@@ -6691,7 +6691,7 @@ int addrconf_disable_policy(const struct ctl_table *ctl, int *valp, int val)
6691
6691
struct net_device * dev ;
6692
6692
6693
6693
for_each_netdev (net , dev ) {
6694
- idev = __in6_dev_get (dev );
6694
+ idev = __in6_dev_get_rtnl_net (dev );
6695
6695
if (idev )
6696
6696
addrconf_disable_policy_idev (idev , val );
6697
6697
}
@@ -6700,7 +6700,7 @@ int addrconf_disable_policy(const struct ctl_table *ctl, int *valp, int val)
6700
6700
addrconf_disable_policy_idev (idev , val );
6701
6701
}
6702
6702
6703
- rtnl_unlock ( );
6703
+ rtnl_net_unlock ( net );
6704
6704
return 0 ;
6705
6705
}
6706
6706
0 commit comments