/* * 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 #include #include #include #include #include #include #include #include #include #include #include #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); } if (alen == 16 && type == ARPHRD_TUNNEL6) { return inet_ntop(AF_INET6, addr, buf, blen); } l = 0; for (i=0; i 255) { fprintf(stderr, "\"%s\" is invalid lladdr.\n", arg); return -1; } lladdr[i] = temp; if (!cp) break; arg = cp; } return i+1; } }