-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
Description
The current implementation uses hardcoded MAC addresses (02:12:34:56:78:ca/cb) which can cause conflicts when multiple devices are on the same network.
Current Problem
# Current static MACs in usb-gadget.sh
echo "02:12:34:56:78:ca" > "$G/functions/$FUNC_NCM/dev_addr"
echo "02:12:34:56:78:cb" > "$G/functions/$FUNC_NCM/host_addr"Proposed Solution
Generate locally-administered MAC addresses based on device serial number using SHA256 hashing, ensuring uniqueness while maintaining deterministic generation.
Implementation Details
- Extract device serial from
/proc/cpuinfoor device-tree - Generate hash-based MAC with locally-administered bit set
- Create different MACs for host and device interfaces
- Use the generate_mac() function from edgeos-flavor
Example Implementation
generate_mac() {
local input="$1"
local hash=$(echo -n "$input" | sha256sum | awk '{print $1}')
local mac_base=${hash:0:12}
local first_byte=${mac_base:0:2}
local second_char=$(printf '%x' $((0x$first_byte & 0xfe | 0x02)))
printf "%02x:%02x:%02x:%02x:%02x:%02x" \
0x$second_char \
0x${mac_base:2:2} \
0x${mac_base:4:2} \
0x${mac_base:6:2} \
0x${mac_base:8:2} \
0x${mac_base:10:2}
}Acceptance Criteria
- MAC addresses are unique per device
- MACs are locally-administered (bit 1 of first octet = 1)
- MACs persist across reboots for same device
- Support multiple hardware platforms (RPi, Jetson, etc.)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request