Created attachment 171560 [details] patch for net/nload net/nload gets the network interface device names via struct sockaddr_dl struct sockaddr_dl { u_char sdl_len; /* Total length of sockaddr */ u_char sdl_family; /* AF_LINK */ u_short sdl_index; /* if != 0, system given index for interface */ u_char sdl_type; /* interface type */ u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */ u_char sdl_alen; /* link level address length */ u_char sdl_slen; /* link layer selector length */ char sdl_data[46]; /* minimum work area, can be larger; contains both if name and ll address */ }; The name is stored in sdl_data, but is no longer null terminated. The first sdl_nlen bytes are the device name, the sdl_alen bytes after that are the link level address (MAC address), etc. This small patch makes nload read only the first sdl_alen bytes as the device name, instead of reading binary data as a string until it finds a null byte. This happens to often work if the first byte of the mac address is 0. before: Device alc0~P+49▒d (1/11): Device em0h^EÊ^W·o (2/11): after: Device alc0 (1/11): Device em0 (2/11):
A commit references this bug: Author: ehaupt Date: Sun Jun 19 09:44:21 UTC 2016 New revision: 417107 URL: https://svnweb.freebsd.org/changeset/ports/417107 Log: Fix interface name fetching. PR: 210380 Submitted by: allanjude Obtained from: OpenBSD ports Changes: head/net/nload/Makefile head/net/nload/files/ head/net/nload/files/patch-src_devreader-bsd.cpp
Committed, thanks!
Created attachment 171576 [details] updated patch for net/nload svn add missing files in patch