@@ -124,7 +124,7 @@ static void fib_notify(struct net *net, struct notifier_block *nb,
124
124
static int call_fib_entry_notifier (struct notifier_block * nb , struct net * net ,
125
125
enum fib_event_type event_type , u32 dst ,
126
126
int dst_len , struct fib_info * fi ,
127
- u8 tos , u8 type , u32 tb_id , u32 nlflags )
127
+ u8 tos , u8 type , u32 tb_id )
128
128
{
129
129
struct fib_entry_notifier_info info = {
130
130
.dst = dst ,
@@ -133,7 +133,6 @@ static int call_fib_entry_notifier(struct notifier_block *nb, struct net *net,
133
133
.tos = tos ,
134
134
.type = type ,
135
135
.tb_id = tb_id ,
136
- .nlflags = nlflags ,
137
136
};
138
137
return call_fib_notifier (nb , net , event_type , & info .info );
139
138
}
@@ -197,7 +196,7 @@ int call_fib_notifiers(struct net *net, enum fib_event_type event_type,
197
196
static int call_fib_entry_notifiers (struct net * net ,
198
197
enum fib_event_type event_type , u32 dst ,
199
198
int dst_len , struct fib_info * fi ,
200
- u8 tos , u8 type , u32 tb_id , u32 nlflags )
199
+ u8 tos , u8 type , u32 tb_id )
201
200
{
202
201
struct fib_entry_notifier_info info = {
203
202
.dst = dst ,
@@ -206,7 +205,6 @@ static int call_fib_entry_notifiers(struct net *net,
206
205
.tos = tos ,
207
206
.type = type ,
208
207
.tb_id = tb_id ,
209
- .nlflags = nlflags ,
210
208
};
211
209
return call_fib_notifiers (net , event_type , & info .info );
212
210
}
@@ -1198,6 +1196,7 @@ static int fib_insert_alias(struct trie *t, struct key_vector *tp,
1198
1196
int fib_table_insert (struct net * net , struct fib_table * tb ,
1199
1197
struct fib_config * cfg )
1200
1198
{
1199
+ enum fib_event_type event = FIB_EVENT_ENTRY_ADD ;
1201
1200
struct trie * t = (struct trie * )tb -> tb_data ;
1202
1201
struct fib_alias * fa , * new_fa ;
1203
1202
struct key_vector * l , * tp ;
@@ -1295,10 +1294,10 @@ int fib_table_insert(struct net *net, struct fib_table *tb,
1295
1294
new_fa -> tb_id = tb -> tb_id ;
1296
1295
new_fa -> fa_default = -1 ;
1297
1296
1298
- call_fib_entry_notifiers (net , FIB_EVENT_ENTRY_ADD ,
1297
+ call_fib_entry_notifiers (net , FIB_EVENT_ENTRY_REPLACE ,
1299
1298
key , plen , fi ,
1300
1299
new_fa -> fa_tos , cfg -> fc_type ,
1301
- tb -> tb_id , nlflags );
1300
+ tb -> tb_id );
1302
1301
rtmsg_fib (RTM_NEWROUTE , htonl (key ), new_fa , plen ,
1303
1302
tb -> tb_id , & cfg -> fc_nlinfo , nlflags );
1304
1303
@@ -1319,10 +1318,12 @@ int fib_table_insert(struct net *net, struct fib_table *tb,
1319
1318
if (fa_match )
1320
1319
goto out ;
1321
1320
1322
- if (cfg -> fc_nlflags & NLM_F_APPEND )
1321
+ if (cfg -> fc_nlflags & NLM_F_APPEND ) {
1322
+ event = FIB_EVENT_ENTRY_APPEND ;
1323
1323
nlflags |= NLM_F_APPEND ;
1324
- else
1324
+ } else {
1325
1325
fa = fa_first ;
1326
+ }
1326
1327
}
1327
1328
err = - ENOENT ;
1328
1329
if (!(cfg -> fc_nlflags & NLM_F_CREATE ))
@@ -1351,8 +1352,8 @@ int fib_table_insert(struct net *net, struct fib_table *tb,
1351
1352
tb -> tb_num_default ++ ;
1352
1353
1353
1354
rt_cache_flush (cfg -> fc_nlinfo .nl_net );
1354
- call_fib_entry_notifiers (net , FIB_EVENT_ENTRY_ADD , key , plen , fi , tos ,
1355
- cfg -> fc_type , tb -> tb_id , cfg -> fc_nlflags );
1355
+ call_fib_entry_notifiers (net , event , key , plen , fi , tos , cfg -> fc_type ,
1356
+ tb -> tb_id );
1356
1357
rtmsg_fib (RTM_NEWROUTE , htonl (key ), new_fa , plen , new_fa -> tb_id ,
1357
1358
& cfg -> fc_nlinfo , nlflags );
1358
1359
succeeded :
@@ -1654,7 +1655,7 @@ int fib_table_delete(struct net *net, struct fib_table *tb,
1654
1655
1655
1656
call_fib_entry_notifiers (net , FIB_EVENT_ENTRY_DEL , key , plen ,
1656
1657
fa_to_delete -> fa_info , tos ,
1657
- fa_to_delete -> fa_type , tb -> tb_id , 0 );
1658
+ fa_to_delete -> fa_type , tb -> tb_id );
1658
1659
rtmsg_fib (RTM_DELROUTE , htonl (key ), fa_to_delete , plen , tb -> tb_id ,
1659
1660
& cfg -> fc_nlinfo , 0 );
1660
1661
@@ -1973,7 +1974,7 @@ int fib_table_flush(struct net *net, struct fib_table *tb)
1973
1974
n -> key ,
1974
1975
KEYLENGTH - fa -> fa_slen ,
1975
1976
fi , fa -> fa_tos , fa -> fa_type ,
1976
- tb -> tb_id , 0 );
1977
+ tb -> tb_id );
1977
1978
hlist_del_rcu (& fa -> fa_list );
1978
1979
fib_release_info (fa -> fa_info );
1979
1980
alias_free_mem_rcu (fa );
@@ -2013,7 +2014,7 @@ static void fib_leaf_notify(struct net *net, struct key_vector *l,
2013
2014
2014
2015
call_fib_entry_notifier (nb , net , event_type , l -> key ,
2015
2016
KEYLENGTH - fa -> fa_slen , fi , fa -> fa_tos ,
2016
- fa -> fa_type , fa -> tb_id , 0 );
2017
+ fa -> fa_type , fa -> tb_id );
2017
2018
}
2018
2019
}
2019
2020
0 commit comments