Date: Sun, 19 Jun 2016 00:27:39 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-ports-bugs@FreeBSD.org Subject: [Bug 210380] [patch] fix net/nload interface name fetching Message-ID: <bug-210380-13@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D210380 Bug ID: 210380 Summary: [patch] fix net/nload interface name fetching Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Keywords: patch Severity: Affects Many People Priority: --- Component: Individual Port(s) Assignee: ehaupt@FreeBSD.org Reporter: allanjude@FreeBSD.org Keywords: patch Assignee: ehaupt@FreeBSD.org Flags: maintainer-feedback?(ehaupt@FreeBSD.org) Created attachment 171560 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D171560&action= =3Dedit 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 !=3D 0, system given index for interf= ace */ u_char sdl_type; /* interface type */ u_char sdl_nlen; /* interface name length, no trailing 0 req= d. */ 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 l= ink level address (MAC address), etc. This small patch makes nload read only the first sdl_alen bytes as the devi= ce 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=E2=96=92d (1/11): Device em0h^E=C3=8A^W=C2=B7o (2/11): after: Device alc0 (1/11): Device em0 (2/11): --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-210380-13>