Пример #1
0
static void
mac_create(switchlink_mac_addr_t mac_addr, switchlink_handle_t bridge_h,
           switchlink_handle_t intf_h) {
    switchlink_handle_t old_intf_h;
    switchlink_db_status_t status;
    status = switchlink_db_mac_get_intf(mac_addr, bridge_h, &old_intf_h);
    if (status == SWITCHLINK_DB_STATUS_SUCCESS) {
       if (old_intf_h != intf_h) {
           switchlink_mac_update(mac_addr, bridge_h, intf_h);
           switchlink_db_mac_set_intf(mac_addr, bridge_h, intf_h);
           return;
       }
    }

    switchlink_mac_create(mac_addr, bridge_h, intf_h);
    switchlink_db_mac_add(mac_addr, bridge_h, intf_h);
}
Пример #2
0
static void
mac_create(switchlink_mac_addr_t mac_addr, switchlink_handle_t bridge_h,
           switchlink_handle_t intf_h) {
    switchlink_handle_t old_intf_h;
    switchlink_db_status_t status;
    status = switchlink_db_mac_get_intf(mac_addr, bridge_h, &old_intf_h);
    if (status == SWITCHLINK_DB_STATUS_SUCCESS) {
       if (old_intf_h == intf_h) {
           // no change
           return;
       } else {
           // update handled as delete followed by add
           mac_delete(mac_addr, bridge_h);
       }
    }

    switchlink_mac_create(mac_addr, bridge_h, intf_h);
    switchlink_db_mac_add(mac_addr, bridge_h, intf_h);
}