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_types.c

    r1765 r2725  
    11/* vi: set sw=4 ts=4: */
    22/*
    3  * ll_types.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#include <arpa/inet.h>
     
    1614#include "rt_names.h"
    1715
    18 const char* ll_type_n2a(int type, char *buf, int len)
     16const char* FAST_FUNC ll_type_n2a(int type, char *buf)
    1917{
    20 #define __PF(f,n) { ARPHRD_##f, #n },
    21 static const struct {
    22     int type;
    23     const char *name;
    24 } arphrd_names[] = {
    25 { 0, "generic" },
    26 __PF(ETHER,ether)
    27 __PF(EETHER,eether)
    28 __PF(AX25,ax25)
    29 __PF(PRONET,pronet)
    30 __PF(CHAOS,chaos)
     18    static const char arphrd_name[] =
     19    /* 0,                  */ "generic" "\0"
     20    /* ARPHRD_LOOPBACK,    */ "loopback" "\0"
     21    /* ARPHRD_ETHER,       */ "ether" "\0"
     22#ifdef ARPHRD_INFINIBAND
     23    /* ARPHRD_INFINIBAND,  */ "infiniband" "\0"
     24#endif
    3125#ifdef ARPHRD_IEEE802_TR
    32 __PF(IEEE802,ieee802)
     26    /* ARPHRD_IEEE802,     */ "ieee802" "\0"
     27    /* ARPHRD_IEEE802_TR,  */ "tr" "\0"
    3328#else
    34 __PF(IEEE802,tr)
    35 #endif
    36 __PF(ARCNET,arcnet)
    37 __PF(APPLETLK,atalk)
    38 __PF(DLCI,dlci)
     29    /* ARPHRD_IEEE802,     */ "tr" "\0"
     30#endif
     31#ifdef ARPHRD_IEEE80211
     32    /* ARPHRD_IEEE80211,   */ "ieee802.11" "\0"
     33#endif
     34#ifdef ARPHRD_IEEE1394
     35    /* ARPHRD_IEEE1394,    */ "ieee1394" "\0"
     36#endif
     37    /* ARPHRD_IRDA,        */ "irda" "\0"
     38    /* ARPHRD_SLIP,        */ "slip" "\0"
     39    /* ARPHRD_CSLIP,       */ "cslip" "\0"
     40    /* ARPHRD_SLIP6,       */ "slip6" "\0"
     41    /* ARPHRD_CSLIP6,      */ "cslip6" "\0"
     42    /* ARPHRD_PPP,         */ "ppp" "\0"
     43    /* ARPHRD_TUNNEL,      */ "ipip" "\0"
     44    /* ARPHRD_TUNNEL6,     */ "tunnel6" "\0"
     45    /* ARPHRD_SIT,         */ "sit" "\0"
     46    /* ARPHRD_IPGRE,       */ "gre" "\0"
     47#ifdef ARPHRD_VOID
     48    /* ARPHRD_VOID,        */ "void" "\0"
     49#endif
     50
     51#if ENABLE_FEATURE_IP_RARE_PROTOCOLS
     52    /* ARPHRD_EETHER,      */ "eether" "\0"
     53    /* ARPHRD_AX25,        */ "ax25" "\0"
     54    /* ARPHRD_PRONET,      */ "pronet" "\0"
     55    /* ARPHRD_CHAOS,       */ "chaos" "\0"
     56    /* ARPHRD_ARCNET,      */ "arcnet" "\0"
     57    /* ARPHRD_APPLETLK,    */ "atalk" "\0"
     58    /* ARPHRD_DLCI,        */ "dlci" "\0"
    3959#ifdef ARPHRD_ATM
    40 __PF(ATM,atm)
    41 #endif
    42 __PF(METRICOM,metricom)
     60    /* ARPHRD_ATM,         */ "atm" "\0"
     61#endif
     62    /* ARPHRD_METRICOM,    */ "metricom" "\0"
     63    /* ARPHRD_RSRVD,       */ "rsrvd" "\0"
     64    /* ARPHRD_ADAPT,       */ "adapt" "\0"
     65    /* ARPHRD_ROSE,        */ "rose" "\0"
     66    /* ARPHRD_X25,         */ "x25" "\0"
     67#ifdef ARPHRD_HWX25
     68    /* ARPHRD_HWX25,       */ "hwx25" "\0"
     69#endif
     70    /* ARPHRD_HDLC,        */ "hdlc" "\0"
     71    /* ARPHRD_LAPB,        */ "lapb" "\0"
     72#ifdef ARPHRD_DDCMP
     73    /* ARPHRD_DDCMP,       */ "ddcmp" "\0"
     74    /* ARPHRD_RAWHDLC,     */ "rawhdlc" "\0"
     75#endif
     76    /* ARPHRD_FRAD,        */ "frad" "\0"
     77    /* ARPHRD_SKIP,        */ "skip" "\0"
     78    /* ARPHRD_LOCALTLK,    */ "ltalk" "\0"
     79    /* ARPHRD_FDDI,        */ "fddi" "\0"
     80    /* ARPHRD_BIF,         */ "bif" "\0"
     81    /* ARPHRD_IPDDP,       */ "ip/ddp" "\0"
     82    /* ARPHRD_PIMREG,      */ "pimreg" "\0"
     83    /* ARPHRD_HIPPI,       */ "hippi" "\0"
     84    /* ARPHRD_ASH,         */ "ash" "\0"
     85    /* ARPHRD_ECONET,      */ "econet" "\0"
     86    /* ARPHRD_FCPP,        */ "fcpp" "\0"
     87    /* ARPHRD_FCAL,        */ "fcal" "\0"
     88    /* ARPHRD_FCPL,        */ "fcpl" "\0"
     89    /* ARPHRD_FCFABRIC,    */ "fcfb0" "\0"
     90    /* ARPHRD_FCFABRIC+1,  */ "fcfb1" "\0"
     91    /* ARPHRD_FCFABRIC+2,  */ "fcfb2" "\0"
     92    /* ARPHRD_FCFABRIC+3,  */ "fcfb3" "\0"
     93    /* ARPHRD_FCFABRIC+4,  */ "fcfb4" "\0"
     94    /* ARPHRD_FCFABRIC+5,  */ "fcfb5" "\0"
     95    /* ARPHRD_FCFABRIC+6,  */ "fcfb6" "\0"
     96    /* ARPHRD_FCFABRIC+7,  */ "fcfb7" "\0"
     97    /* ARPHRD_FCFABRIC+8,  */ "fcfb8" "\0"
     98    /* ARPHRD_FCFABRIC+9,  */ "fcfb9" "\0"
     99    /* ARPHRD_FCFABRIC+10, */ "fcfb10" "\0"
     100    /* ARPHRD_FCFABRIC+11, */ "fcfb11" "\0"
     101    /* ARPHRD_FCFABRIC+12, */ "fcfb12" "\0"
     102#endif /* FEATURE_IP_RARE_PROTOCOLS */
     103    ;
     104
     105    /* Keep these arrays in sync! */
     106
     107    static const uint16_t arphrd_type[] = {
     108    0,                  /* "generic" "\0" */
     109    ARPHRD_LOOPBACK,    /* "loopback" "\0" */
     110    ARPHRD_ETHER,       /* "ether" "\0" */
     111#ifdef ARPHRD_INFINIBAND
     112    ARPHRD_INFINIBAND,  /* "infiniband" "\0" */
     113#endif
     114#ifdef ARPHRD_IEEE802_TR
     115    ARPHRD_IEEE802,     /* "ieee802" "\0" */
     116    ARPHRD_IEEE802_TR,  /* "tr" "\0" */
     117#else
     118    ARPHRD_IEEE802,     /* "tr" "\0" */
     119#endif
     120#ifdef ARPHRD_IEEE80211
     121    ARPHRD_IEEE80211,   /* "ieee802.11" "\0" */
     122#endif
    43123#ifdef ARPHRD_IEEE1394
    44 __PF(IEEE1394,ieee1394)
    45 #endif
    46 
    47 __PF(SLIP,slip)
    48 __PF(CSLIP,cslip)
    49 __PF(SLIP6,slip6)
    50 __PF(CSLIP6,cslip6)
    51 __PF(RSRVD,rsrvd)
    52 __PF(ADAPT,adapt)
    53 __PF(ROSE,rose)
    54 __PF(X25,x25)
     124    ARPHRD_IEEE1394,    /* "ieee1394" "\0" */
     125#endif
     126    ARPHRD_IRDA,        /* "irda" "\0" */
     127    ARPHRD_SLIP,        /* "slip" "\0" */
     128    ARPHRD_CSLIP,       /* "cslip" "\0" */
     129    ARPHRD_SLIP6,       /* "slip6" "\0" */
     130    ARPHRD_CSLIP6,      /* "cslip6" "\0" */
     131    ARPHRD_PPP,         /* "ppp" "\0" */
     132    ARPHRD_TUNNEL,      /* "ipip" "\0" */
     133    ARPHRD_TUNNEL6,     /* "tunnel6" "\0" */
     134    ARPHRD_SIT,         /* "sit" "\0" */
     135    ARPHRD_IPGRE,       /* "gre" "\0" */
     136#ifdef ARPHRD_VOID
     137    ARPHRD_VOID,        /* "void" "\0" */
     138#endif
     139
     140#if ENABLE_FEATURE_IP_RARE_PROTOCOLS
     141    ARPHRD_EETHER,      /* "eether" "\0" */
     142    ARPHRD_AX25,        /* "ax25" "\0" */
     143    ARPHRD_PRONET,      /* "pronet" "\0" */
     144    ARPHRD_CHAOS,       /* "chaos" "\0" */
     145    ARPHRD_ARCNET,      /* "arcnet" "\0" */
     146    ARPHRD_APPLETLK,    /* "atalk" "\0" */
     147    ARPHRD_DLCI,        /* "dlci" "\0" */
     148#ifdef ARPHRD_ATM
     149    ARPHRD_ATM,         /* "atm" "\0" */
     150#endif
     151    ARPHRD_METRICOM,    /* "metricom" "\0" */
     152    ARPHRD_RSRVD,       /* "rsrvd" "\0" */
     153    ARPHRD_ADAPT,       /* "adapt" "\0" */
     154    ARPHRD_ROSE,        /* "rose" "\0" */
     155    ARPHRD_X25,         /* "x25" "\0" */
    55156#ifdef ARPHRD_HWX25
    56 __PF(HWX25,hwx25)
    57 #endif
    58 __PF(PPP,ppp)
    59 __PF(HDLC,hdlc)
    60 __PF(LAPB,lapb)
     157    ARPHRD_HWX25,       /* "hwx25" "\0" */
     158#endif
     159    ARPHRD_HDLC,        /* "hdlc" "\0" */
     160    ARPHRD_LAPB,        /* "lapb" "\0" */
    61161#ifdef ARPHRD_DDCMP
    62 __PF(DDCMP,ddcmp)
    63 __PF(RAWHDLC,rawhdlc)
    64 #endif
    65 
    66 __PF(TUNNEL,ipip)
    67 __PF(TUNNEL6,tunnel6)
    68 __PF(FRAD,frad)
    69 __PF(SKIP,skip)
    70 __PF(LOOPBACK,loopback)
    71 __PF(LOCALTLK,ltalk)
    72 __PF(FDDI,fddi)
    73 __PF(BIF,bif)
    74 __PF(SIT,sit)
    75 __PF(IPDDP,ip/ddp)
    76 __PF(IPGRE,gre)
    77 __PF(PIMREG,pimreg)
    78 __PF(HIPPI,hippi)
    79 __PF(ASH,ash)
    80 __PF(ECONET,econet)
    81 __PF(IRDA,irda)
    82 __PF(FCPP,fcpp)
    83 __PF(FCAL,fcal)
    84 __PF(FCPL,fcpl)
    85 __PF(FCFABRIC,fcfb0)
    86 __PF(FCFABRIC+1,fcfb1)
    87 __PF(FCFABRIC+2,fcfb2)
    88 __PF(FCFABRIC+3,fcfb3)
    89 __PF(FCFABRIC+4,fcfb4)
    90 __PF(FCFABRIC+5,fcfb5)
    91 __PF(FCFABRIC+6,fcfb6)
    92 __PF(FCFABRIC+7,fcfb7)
    93 __PF(FCFABRIC+8,fcfb8)
    94 __PF(FCFABRIC+9,fcfb9)
    95 __PF(FCFABRIC+10,fcfb10)
    96 __PF(FCFABRIC+11,fcfb11)
    97 __PF(FCFABRIC+12,fcfb12)
    98 #ifdef ARPHRD_IEEE802_TR
    99 __PF(IEEE802_TR,tr)
    100 #endif
    101 #ifdef ARPHRD_IEEE80211
    102 __PF(IEEE80211,ieee802.11)
    103 #endif
    104 #ifdef ARPHRD_VOID
    105 __PF(VOID,void)
    106 #endif
    107 };
    108 #undef __PF
    109 
    110     int i;
    111     for (i = 0; i < ARRAY_SIZE(arphrd_names); i++) {
    112          if (arphrd_names[i].type == type)
    113             return arphrd_names[i].name;
     162    ARPHRD_DDCMP,       /* "ddcmp" "\0" */
     163    ARPHRD_RAWHDLC,     /* "rawhdlc" "\0" */
     164#endif
     165    ARPHRD_FRAD,        /* "frad" "\0" */
     166    ARPHRD_SKIP,        /* "skip" "\0" */
     167    ARPHRD_LOCALTLK,    /* "ltalk" "\0" */
     168    ARPHRD_FDDI,        /* "fddi" "\0" */
     169    ARPHRD_BIF,         /* "bif" "\0" */
     170    ARPHRD_IPDDP,       /* "ip/ddp" "\0" */
     171    ARPHRD_PIMREG,      /* "pimreg" "\0" */
     172    ARPHRD_HIPPI,       /* "hippi" "\0" */
     173    ARPHRD_ASH,         /* "ash" "\0" */
     174    ARPHRD_ECONET,      /* "econet" "\0" */
     175    ARPHRD_FCPP,        /* "fcpp" "\0" */
     176    ARPHRD_FCAL,        /* "fcal" "\0" */
     177    ARPHRD_FCPL,        /* "fcpl" "\0" */
     178    ARPHRD_FCFABRIC,    /* "fcfb0" "\0" */
     179    ARPHRD_FCFABRIC+1,  /* "fcfb1" "\0" */
     180    ARPHRD_FCFABRIC+2,  /* "fcfb2" "\0" */
     181    ARPHRD_FCFABRIC+3,  /* "fcfb3" "\0" */
     182    ARPHRD_FCFABRIC+4,  /* "fcfb4" "\0" */
     183    ARPHRD_FCFABRIC+5,  /* "fcfb5" "\0" */
     184    ARPHRD_FCFABRIC+6,  /* "fcfb6" "\0" */
     185    ARPHRD_FCFABRIC+7,  /* "fcfb7" "\0" */
     186    ARPHRD_FCFABRIC+8,  /* "fcfb8" "\0" */
     187    ARPHRD_FCFABRIC+9,  /* "fcfb9" "\0" */
     188    ARPHRD_FCFABRIC+10, /* "fcfb10" "\0" */
     189    ARPHRD_FCFABRIC+11, /* "fcfb11" "\0" */
     190    ARPHRD_FCFABRIC+12, /* "fcfb12" "\0" */
     191#endif /* FEATURE_IP_RARE_PROTOCOLS */
     192    };
     193
     194    unsigned i;
     195    const char *aname = arphrd_name;
     196    for (i = 0; i < ARRAY_SIZE(arphrd_type); i++) {
     197        if (arphrd_type[i] == type)
     198            return aname;
     199        aname += strlen(aname) + 1;
    114200    }
    115     snprintf(buf, len, "[%d]", type);
     201    sprintf(buf, "[%d]", type);
    116202    return buf;
    117203}
Note: See TracChangeset for help on using the changeset viewer.