@@ -62,8 +62,8 @@ static DEFINE_SPINLOCK(fib_multipath_lock);
62
62
#define for_nexthops (fi ) { int nhsel; const struct fib_nh * nh; \
63
63
for (nhsel=0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++)
64
64
65
- #define change_nexthops (fi ) { int nhsel; struct fib_nh * nh ; \
66
- for (nhsel=0, nh = (struct fib_nh *)((fi)->fib_nh); nhsel < (fi)->fib_nhs; nh ++, nhsel++)
65
+ #define change_nexthops (fi ) { int nhsel; struct fib_nh *nexthop_nh ; \
66
+ for (nhsel=0, nexthop_nh = (struct fib_nh *)((fi)->fib_nh); nhsel < (fi)->fib_nhs; nexthop_nh ++, nhsel++)
67
67
68
68
#else /* CONFIG_IP_ROUTE_MULTIPATH */
69
69
@@ -72,7 +72,7 @@ for (nhsel=0, nh = (struct fib_nh *)((fi)->fib_nh); nhsel < (fi)->fib_nhs; nh++,
72
72
#define for_nexthops (fi ) { int nhsel = 0; const struct fib_nh * nh = (fi)->fib_nh; \
73
73
for (nhsel=0; nhsel < 1; nhsel++)
74
74
75
- #define change_nexthops (fi ) { int nhsel = 0; struct fib_nh * nh = (struct fib_nh *)((fi)->fib_nh); \
75
+ #define change_nexthops (fi ) { int nhsel = 0; struct fib_nh *nexthop_nh = (struct fib_nh *)((fi)->fib_nh); \
76
76
for (nhsel=0; nhsel < 1; nhsel++)
77
77
78
78
#endif /* CONFIG_IP_ROUTE_MULTIPATH */
@@ -145,9 +145,9 @@ void free_fib_info(struct fib_info *fi)
145
145
return ;
146
146
}
147
147
change_nexthops (fi ) {
148
- if (nh -> nh_dev )
149
- dev_put (nh -> nh_dev );
150
- nh -> nh_dev = NULL ;
148
+ if (nexthop_nh -> nh_dev )
149
+ dev_put (nexthop_nh -> nh_dev );
150
+ nexthop_nh -> nh_dev = NULL ;
151
151
} endfor_nexthops (fi );
152
152
fib_info_cnt -- ;
153
153
release_net (fi -> fib_net );
@@ -162,9 +162,9 @@ void fib_release_info(struct fib_info *fi)
162
162
if (fi -> fib_prefsrc )
163
163
hlist_del (& fi -> fib_lhash );
164
164
change_nexthops (fi ) {
165
- if (!nh -> nh_dev )
165
+ if (!nexthop_nh -> nh_dev )
166
166
continue ;
167
- hlist_del (& nh -> nh_hash );
167
+ hlist_del (& nexthop_nh -> nh_hash );
168
168
} endfor_nexthops (fi )
169
169
fi -> fib_dead = 1 ;
170
170
fib_info_put (fi );
@@ -395,19 +395,20 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh,
395
395
if (!rtnh_ok (rtnh , remaining ))
396
396
return - EINVAL ;
397
397
398
- nh -> nh_flags = (cfg -> fc_flags & ~0xFF ) | rtnh -> rtnh_flags ;
399
- nh -> nh_oif = rtnh -> rtnh_ifindex ;
400
- nh -> nh_weight = rtnh -> rtnh_hops + 1 ;
398
+ nexthop_nh -> nh_flags =
399
+ (cfg -> fc_flags & ~0xFF ) | rtnh -> rtnh_flags ;
400
+ nexthop_nh -> nh_oif = rtnh -> rtnh_ifindex ;
401
+ nexthop_nh -> nh_weight = rtnh -> rtnh_hops + 1 ;
401
402
402
403
attrlen = rtnh_attrlen (rtnh );
403
404
if (attrlen > 0 ) {
404
405
struct nlattr * nla , * attrs = rtnh_attrs (rtnh );
405
406
406
407
nla = nla_find (attrs , attrlen , RTA_GATEWAY );
407
- nh -> nh_gw = nla ? nla_get_be32 (nla ) : 0 ;
408
+ nexthop_nh -> nh_gw = nla ? nla_get_be32 (nla ) : 0 ;
408
409
#ifdef CONFIG_NET_CLS_ROUTE
409
410
nla = nla_find (attrs , attrlen , RTA_FLOW );
410
- nh -> nh_tclassid = nla ? nla_get_u32 (nla ) : 0 ;
411
+ nexthop_nh -> nh_tclassid = nla ? nla_get_u32 (nla ) : 0 ;
411
412
#endif
412
413
}
413
414
@@ -738,7 +739,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
738
739
739
740
fi -> fib_nhs = nhs ;
740
741
change_nexthops (fi ) {
741
- nh -> nh_parent = fi ;
742
+ nexthop_nh -> nh_parent = fi ;
742
743
} endfor_nexthops (fi )
743
744
744
745
if (cfg -> fc_mx ) {
@@ -808,7 +809,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
808
809
goto failure ;
809
810
} else {
810
811
change_nexthops (fi ) {
811
- if ((err = fib_check_nh (cfg , fi , nh )) != 0 )
812
+ if ((err = fib_check_nh (cfg , fi , nexthop_nh )) != 0 )
812
813
goto failure ;
813
814
} endfor_nexthops (fi )
814
815
}
@@ -843,11 +844,11 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
843
844
struct hlist_head * head ;
844
845
unsigned int hash ;
845
846
846
- if (!nh -> nh_dev )
847
+ if (!nexthop_nh -> nh_dev )
847
848
continue ;
848
- hash = fib_devindex_hashfn (nh -> nh_dev -> ifindex );
849
+ hash = fib_devindex_hashfn (nexthop_nh -> nh_dev -> ifindex );
849
850
head = & fib_info_devhash [hash ];
850
- hlist_add_head (& nh -> nh_hash , head );
851
+ hlist_add_head (& nexthop_nh -> nh_hash , head );
851
852
} endfor_nexthops (fi )
852
853
spin_unlock_bh (& fib_info_lock );
853
854
return fi ;
@@ -1080,21 +1081,21 @@ int fib_sync_down_dev(struct net_device *dev, int force)
1080
1081
prev_fi = fi ;
1081
1082
dead = 0 ;
1082
1083
change_nexthops (fi ) {
1083
- if (nh -> nh_flags & RTNH_F_DEAD )
1084
+ if (nexthop_nh -> nh_flags & RTNH_F_DEAD )
1084
1085
dead ++ ;
1085
- else if (nh -> nh_dev == dev &&
1086
- nh -> nh_scope != scope ) {
1087
- nh -> nh_flags |= RTNH_F_DEAD ;
1086
+ else if (nexthop_nh -> nh_dev == dev &&
1087
+ nexthop_nh -> nh_scope != scope ) {
1088
+ nexthop_nh -> nh_flags |= RTNH_F_DEAD ;
1088
1089
#ifdef CONFIG_IP_ROUTE_MULTIPATH
1089
1090
spin_lock_bh (& fib_multipath_lock );
1090
- fi -> fib_power -= nh -> nh_power ;
1091
- nh -> nh_power = 0 ;
1091
+ fi -> fib_power -= nexthop_nh -> nh_power ;
1092
+ nexthop_nh -> nh_power = 0 ;
1092
1093
spin_unlock_bh (& fib_multipath_lock );
1093
1094
#endif
1094
1095
dead ++ ;
1095
1096
}
1096
1097
#ifdef CONFIG_IP_ROUTE_MULTIPATH
1097
- if (force > 1 && nh -> nh_dev == dev ) {
1098
+ if (force > 1 && nexthop_nh -> nh_dev == dev ) {
1098
1099
dead = fi -> fib_nhs ;
1099
1100
break ;
1100
1101
}
@@ -1144,18 +1145,20 @@ int fib_sync_up(struct net_device *dev)
1144
1145
prev_fi = fi ;
1145
1146
alive = 0 ;
1146
1147
change_nexthops (fi ) {
1147
- if (!(nh -> nh_flags & RTNH_F_DEAD )) {
1148
+ if (!(nexthop_nh -> nh_flags & RTNH_F_DEAD )) {
1148
1149
alive ++ ;
1149
1150
continue ;
1150
1151
}
1151
- if (nh -> nh_dev == NULL || !(nh -> nh_dev -> flags & IFF_UP ))
1152
+ if (nexthop_nh -> nh_dev == NULL ||
1153
+ !(nexthop_nh -> nh_dev -> flags & IFF_UP ))
1152
1154
continue ;
1153
- if (nh -> nh_dev != dev || !__in_dev_get_rtnl (dev ))
1155
+ if (nexthop_nh -> nh_dev != dev ||
1156
+ !__in_dev_get_rtnl (dev ))
1154
1157
continue ;
1155
1158
alive ++ ;
1156
1159
spin_lock_bh (& fib_multipath_lock );
1157
- nh -> nh_power = 0 ;
1158
- nh -> nh_flags &= ~RTNH_F_DEAD ;
1160
+ nexthop_nh -> nh_power = 0 ;
1161
+ nexthop_nh -> nh_flags &= ~RTNH_F_DEAD ;
1159
1162
spin_unlock_bh (& fib_multipath_lock );
1160
1163
} endfor_nexthops (fi )
1161
1164
@@ -1182,9 +1185,9 @@ void fib_select_multipath(const struct flowi *flp, struct fib_result *res)
1182
1185
if (fi -> fib_power <= 0 ) {
1183
1186
int power = 0 ;
1184
1187
change_nexthops (fi ) {
1185
- if (!(nh -> nh_flags & RTNH_F_DEAD )) {
1186
- power += nh -> nh_weight ;
1187
- nh -> nh_power = nh -> nh_weight ;
1188
+ if (!(nexthop_nh -> nh_flags & RTNH_F_DEAD )) {
1189
+ power += nexthop_nh -> nh_weight ;
1190
+ nexthop_nh -> nh_power = nexthop_nh -> nh_weight ;
1188
1191
}
1189
1192
} endfor_nexthops (fi );
1190
1193
fi -> fib_power = power ;
@@ -1204,9 +1207,10 @@ void fib_select_multipath(const struct flowi *flp, struct fib_result *res)
1204
1207
w = jiffies % fi -> fib_power ;
1205
1208
1206
1209
change_nexthops (fi ) {
1207
- if (!(nh -> nh_flags & RTNH_F_DEAD ) && nh -> nh_power ) {
1208
- if ((w -= nh -> nh_power ) <= 0 ) {
1209
- nh -> nh_power -- ;
1210
+ if (!(nexthop_nh -> nh_flags & RTNH_F_DEAD ) &&
1211
+ nexthop_nh -> nh_power ) {
1212
+ if ((w -= nexthop_nh -> nh_power ) <= 0 ) {
1213
+ nexthop_nh -> nh_power -- ;
1210
1214
fi -> fib_power -- ;
1211
1215
res -> nh_sel = nhsel ;
1212
1216
spin_unlock_bh (& fib_multipath_lock );
0 commit comments