| // SPDX-License-Identifier: GPL-2.0+ |
| * Copyright (C) 2017 Marek BehĂșn <kabel@kernel.org> |
| #include "turris_common.h" |
| static void increment_mac(u8 *mac) |
| for (i = 5; i >= 3; i--) { |
| static void set_mac_if_invalid(int i, u8 *mac) |
| if (is_valid_ethaddr(mac) && |
| !eth_env_get_enetaddr_by_index("eth", i, oldmac)) |
| eth_env_set_enetaddr_by_index("eth", i, mac); |
| void turris_init_mac_addresses(int first_idx, const u8 *first_mac) |
| memcpy(mac, first_mac, sizeof(mac)); |
| set_mac_if_invalid((first_idx + 0) % 3, mac); |
| set_mac_if_invalid((first_idx + 1) % 3, mac); |
| set_mac_if_invalid((first_idx + 2) % 3, mac); |