From c65d99084a5979a34ff3aa504135152b6b31b2bb Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Thu, 28 Feb 2008 09:56:28 +0000 Subject: Added support for ether_line, ether_ntohost and ether_hostton. Added related test cases. Signed-off-by: Matthew Wilcox Hacked-by: Carmelo Amoroso --- test/inet/tst-ethers.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 test/inet/tst-ethers.c (limited to 'test/inet/tst-ethers.c') diff --git a/test/inet/tst-ethers.c b/test/inet/tst-ethers.c new file mode 100755 index 000000000..eb6280c3f --- /dev/null +++ b/test/inet/tst-ethers.c @@ -0,0 +1,28 @@ +#include +#include + +#define ETHER_LINE_LEN 256 + +int main(void) +{ + struct ether_addr addr; + char host[ETHER_LINE_LEN]; + int i; + int res = ether_hostton("teeth", &addr); + + if (res) + return 1; + + for (i = 0; i < 6; i++) { + printf("%02x", addr.ether_addr_octet[i]); + if (i < 5) + printf(":"); + } + + res = ether_ntohost(host, &addr); + if (res) + return 1; + printf(" %s\n", host); + + return 0; +} -- cgit v1.2.3