@@ -240,7 +240,21 @@ void redisPutFdbEntryToAsicView(
240
240
g_redisClient->hset (key, strAttrId, strAttrValue);
241
241
}
242
242
243
- void check_fdb_event_notification_data (
243
+ /* *
244
+ * @Brief Check FDB event notification data.
245
+ *
246
+ * Every OID field in notification data as well as all OID attributes are
247
+ * checked if given OID (returned from ASIC) is already present in the syncd
248
+ * local database. All bridge ports, vlans should be already discovered by
249
+ * syncd discovery logic. If vendor SAI will return unknown/invalid OID, this
250
+ * function will return false.
251
+ *
252
+ * @param data FDB event notification data
253
+ *
254
+ * @return False if any of OID values is not present in local DB, otherwise
255
+ * true.
256
+ */
257
+ bool check_fdb_event_notification_data (
244
258
_In_ const sai_fdb_event_notification_data_t & data)
245
259
{
246
260
SWSS_LOG_ENTER ();
@@ -264,14 +278,24 @@ void check_fdb_event_notification_data(
264
278
* state.
265
279
*/
266
280
281
+ bool result = true ;
282
+
267
283
if (!check_rid_exists (data.fdb_entry .bv_id ))
284
+ {
268
285
SWSS_LOG_ERROR (" bv_id RID 0x%lx is not present on local ASIC DB: %s" , data.fdb_entry .bv_id ,
269
286
sai_serialize_fdb_entry (data.fdb_entry ).c_str ());
270
287
288
+ result = false ;
289
+ }
290
+
271
291
if (!check_rid_exists (data.fdb_entry .switch_id ) || data.fdb_entry .switch_id == SAI_NULL_OBJECT_ID)
292
+ {
272
293
SWSS_LOG_ERROR (" switch_id RID 0x%lx is not present on local ASIC DB: %s" , data.fdb_entry .bv_id ,
273
294
sai_serialize_fdb_entry (data.fdb_entry ).c_str ());
274
295
296
+ result = false ;
297
+ }
298
+
275
299
for (uint32_t i = 0 ; i < data.attr_count ; i++)
276
300
{
277
301
const sai_attribute_t & attr = data.attr [i];
@@ -289,8 +313,14 @@ void check_fdb_event_notification_data(
289
313
continue ;
290
314
291
315
if (!check_rid_exists (attr.value .oid ))
316
+ {
292
317
SWSS_LOG_WARN (" RID 0x%lx on %s is not present on local ASIC DB" , attr.value .oid , meta->attridname );
318
+
319
+ result = false ;
320
+ }
293
321
}
322
+
323
+ return result;
294
324
}
295
325
296
326
void process_on_fdb_event (
@@ -301,11 +331,13 @@ void process_on_fdb_event(
301
331
302
332
SWSS_LOG_INFO (" fdb event count: %u" , count);
303
333
334
+ bool sendntf = true ;
335
+
304
336
for (uint32_t i = 0 ; i < count; i++)
305
337
{
306
338
sai_fdb_event_notification_data_t *fdb = &data[i];
307
339
308
- check_fdb_event_notification_data (*fdb);
340
+ sendntf &= check_fdb_event_notification_data (*fdb);
309
341
310
342
SWSS_LOG_DEBUG (" fdb %u: type: %d" , i, fdb->event_type );
311
343
@@ -324,9 +356,16 @@ void process_on_fdb_event(
324
356
redisPutFdbEntryToAsicView (fdb);
325
357
}
326
358
327
- std::string s = sai_serialize_fdb_event_ntf (count, data);
359
+ if (sendntf)
360
+ {
361
+ std::string s = sai_serialize_fdb_event_ntf (count, data);
328
362
329
- send_notification (" fdb_event" , s);
363
+ send_notification (" fdb_event" , s);
364
+ }
365
+ else
366
+ {
367
+ SWSS_LOG_ERROR (" FDB notification was not sent since it contain invalid OIDs, bug?" );
368
+ }
330
369
}
331
370
332
371
void process_on_queue_deadlock_event (
0 commit comments