Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/networking/libiproute/ll_addr.c

    r1765 r2725  
    11/* vi: set sw=4 ts=4: */
    22/*
    3  * ll_addr.c
     3 * This program is free software; you can redistribute it and/or
     4 * modify it under the terms of the GNU General Public License
     5 * as published by the Free Software Foundation; either version
     6 * 2 of the License, or (at your option) any later version.
    47 *
    5  *      This program is free software; you can redistribute it and/or
    6  *      modify it under the terms of the GNU General Public License
    7  *      as published by the Free Software Foundation; either version
    8  *      2 of the License, or (at your option) any later version.
    9  *
    10  * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
     8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
    119 */
    1210
     
    1816
    1917
    20 const char *ll_addr_n2a(unsigned char *addr, int alen, int type, char *buf, int blen)
     18const char* FAST_FUNC ll_addr_n2a(unsigned char *addr, int alen, int type, char *buf, int blen)
    2119{
    2220    int i;
    2321    int l;
    2422
    25     if (alen == 4 &&
    26         (type == ARPHRD_TUNNEL || type == ARPHRD_SIT || type == ARPHRD_IPGRE)) {
     23    if (alen == 4
     24     && (type == ARPHRD_TUNNEL || type == ARPHRD_SIT || type == ARPHRD_IPGRE)
     25    ) {
    2726        return inet_ntop(AF_INET, addr, buf, blen);
    2827    }
    2928    l = 0;
    30     for (i=0; i<alen; i++) {
    31         if (i==0) {
    32             snprintf(buf+l, blen, ":%02x"+1, addr[i]);
     29    for (i = 0; i < alen; i++) {
     30        if (i == 0) {
     31            snprintf(buf + l, blen, ":%02x"+1, addr[i]);
    3332            blen -= 2;
    3433            l += 2;
    3534        } else {
    36             snprintf(buf+l, blen, ":%02x", addr[i]);
     35            snprintf(buf + l, blen, ":%02x", addr[i]);
    3736            blen -= 3;
    3837            l += 3;
     
    4241}
    4342
    44 int ll_addr_a2n(unsigned char *lladdr, int len, char *arg)
     43int FAST_FUNC ll_addr_a2n(unsigned char *lladdr, int len, char *arg)
    4544{
     45    int i;
     46
    4647    if (strchr(arg, '.')) {
    4748        inet_prefix pfx;
     
    5556        memcpy(lladdr, pfx.data, 4);
    5657        return 4;
    57     } else {
    58         int i;
     58    }
    5959
    60         for (i=0; i<len; i++) {
    61             int temp;
    62             char *cp = strchr(arg, ':');
    63             if (cp) {
    64                 *cp = 0;
    65                 cp++;
    66             }
    67             if (sscanf(arg, "%x", &temp) != 1) {
    68                 bb_error_msg("\"%s\" is invalid lladdr", arg);
    69                 return -1;
    70             }
    71             if (temp < 0 || temp > 255) {
    72                 bb_error_msg("\"%s\" is invalid lladdr", arg);
    73                 return -1;
    74             }
    75             lladdr[i] = temp;
    76             if (!cp) {
    77                 break;
    78             }
    79             arg = cp;
     60    for (i = 0; i < len; i++) {
     61        int temp;
     62        char *cp = strchr(arg, ':');
     63        if (cp) {
     64            *cp = 0;
     65            cp++;
    8066        }
    81         return i+1;
     67        if (sscanf(arg, "%x", &temp) != 1 || (temp < 0 || temp > 255)) {
     68            bb_error_msg("\"%s\" is invalid lladdr", arg);
     69            return -1;
     70        }
     71        lladdr[i] = temp;
     72        if (!cp) {
     73            break;
     74        }
     75        arg = cp;
    8276    }
     77    return i+1;
    8378}
Note: See TracChangeset for help on using the changeset viewer.