/* * ll_addr.c * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * * Authors: Alexey Kuznetsov, */ #include "libbb.h" #include #include #include "rt_names.h" #include "utils.h" const char *ll_addr_n2a(unsigned char *addr, int alen, int type, char *buf, int blen) { int i; int l; if (alen == 4 && (type == ARPHRD_TUNNEL || type == ARPHRD_SIT || type == ARPHRD_IPGRE)) { return inet_ntop(AF_INET, addr, buf, blen); } l = 0; for (i=0; i 255) { bb_error_msg("\"%s\" is invalid lladdr.", arg); return -1; } lladdr[i] = temp; if (!cp) { break; } arg = cp; } return i+1; } }