-moreutils (0.7) UNRELEASED; urgency=low
+moreutils (0.7) unstable; urgency=low
* Add pee (pipe tee) contributed by Miek Gieben.
+ * ifdata: Patch from KELEMEN Peter to add support for printing hardware
+ interface. Closes: #357646
- -- Joey Hess <joeyh@debian.org> Tue, 14 Mar 2006 18:07:46 -0500
+ -- Joey Hess <joeyh@debian.org> Sat, 18 Mar 2006 14:17:08 -0500
moreutils (0.6) unstable; urgency=low
#define DO_SOUTCARRIER 25
#define DO_SOUTMULTICAST 26
#define DO_PNETWORK 27
+#define DO_PHWADDRESS 28
struct if_stat {
unsigned long long int in_packets;
PRINT_IF(0xffff0000,"Unknown-flags");
}
+void if_hwaddr(char *iface) {
+ unsigned char *hwaddr;
+
+ PREPARE_SOCK(iface);
+ CALL_IOCTL(SIOCGIFHWADDR);
+ if (res < 0) {
+ CALL_ERROR();
+ }
+ hwaddr = (unsigned char *)req.ifr_hwaddr.sa_data;
+ printf("%02X:%02X:%02X:%02X:%02X:%02X",
+ hwaddr[0], hwaddr[1], hwaddr[2], hwaddr[3], hwaddr[4], hwaddr[5]);
+ END_SOCK;
+}
+
struct sockaddr *if_addr(char *iface) {
PREPARE_SOCK(iface);
CALL_IOCTL(SIOCGIFADDR);
fprintf(stderr," -e Says if iface exists or not\n"
" -p Print out the whole config of iface\n"
" -pe Print out yes or no according to existence\n"
+ " -ph Print out the hardware address\n"
" -pa Print out the address\n"
" -pn Print netmask\n"
" -pN Print network address\n"
printf("no");
}
break;
+ case DO_PHWADDRESS:
+ if_hwaddr(ifname);
+ break;
case DO_PADDRESS:
sadr=if_addr(ifname);
PRINT_OR_ERR(sadr);
add_do(&ndo,&todo,DO_EXISTS);
} else if (!strcmp(argv[narg],"-p")) {
add_do(&ndo,&todo,DO_PALL);
+ } else if (!strcmp(argv[narg],"-ph")) {
+ add_do(&ndo,&todo,DO_PHWADDRESS);
} else if (!strcmp(argv[narg],"-pa")) {
add_do(&ndo,&todo,DO_PADDRESS);
} else if (!strcmp(argv[narg],"-pn")) {