diff options
author | 2022-09-16 13:20:07 +0200 | |
---|---|---|
committer | 2022-10-11 23:21:03 +0000 | |
commit | 0f8f4351b03f9350a406ad1d63f97d1f4b59fec2 (patch) | |
tree | f1167a00efd992a453eacd8278bc4b1760015427 /src/vnet/l2/l2_api.c | |
parent | 7498aadd23eb4d5be2891041c9153cc5dff1a6cc (diff) |
l2: Add bridge_domain_add_del_v2 to l2 api
https://jira.fd.io/browse/VPP-2034
Type: fix
Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>
Change-Id: Ieb6919f958f437fc603d5e1f48cab01de780951d
Diffstat (limited to 'src/vnet/l2/l2_api.c')
-rw-r--r-- | src/vnet/l2/l2_api.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/vnet/l2/l2_api.c b/src/vnet/l2/l2_api.c index c555a17d5ea..cb22547f940 100644 --- a/src/vnet/l2/l2_api.c +++ b/src/vnet/l2/l2_api.c @@ -3,6 +3,7 @@ * l2_api.c - layer 2 forwarding api * * Copyright (c) 2016 Cisco and/or its affiliates. + * Copyright (c) 2022 Nordix Foundation. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -511,6 +512,37 @@ vl_api_bridge_domain_add_del_t_handler (vl_api_bridge_domain_add_del_t * mp) } static void +vl_api_bridge_domain_add_del_v2_t_handler ( + vl_api_bridge_domain_add_del_v2_t *mp) +{ + vl_api_bridge_domain_add_del_v2_reply_t *rmp; + u32 bd_id = ntohl (mp->bd_id); + int rv = 0; + + if ((~0 == bd_id) && (mp->is_add)) + bd_id = bd_get_unused_id (); + + if ((~0 == bd_id) && (mp->is_add)) + rv = VNET_API_ERROR_EAGAIN; + else + { + l2_bridge_domain_add_del_args_t a = { .is_add = mp->is_add, + .flood = mp->flood, + .uu_flood = mp->uu_flood, + .forward = mp->forward, + .learn = mp->learn, + .arp_term = mp->arp_term, + .arp_ufwd = mp->arp_ufwd, + .mac_age = mp->mac_age, + .bd_id = bd_id, + .bd_tag = mp->bd_tag }; + rv = bd_add_del (&a); + } + REPLY_MACRO2 (VL_API_BRIDGE_DOMAIN_ADD_DEL_V2_REPLY, + ({ rmp->bd_id = htonl (bd_id); })); +} + +static void send_bridge_domain_details (l2input_main_t * l2im, vl_api_registration_t * reg, l2_bridge_domain_t * bd_config, |