Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/networking/libiproute/ll_map.c

    r2725 r3621  
    8787}
    8888
    89 const char FAST_FUNC *ll_idx_n2a(int idx, char *buf)
     89static
     90const char FAST_FUNC *ll_idx_n2a(int idx/*, char *buf*/)
    9091{
    9192    struct idxmap *im;
     
    9697    if (im)
    9798        return im->name;
    98     snprintf(buf, 16, "if%d", idx);
    99     return buf;
     99    //snprintf(buf, 16, "if%d", idx);
     100    //return buf;
     101    return auto_string(xasprintf("if%d", idx));
    100102}
    101 
    102103
    103104const char FAST_FUNC *ll_index_to_name(int idx)
    104105{
    105     static char nbuf[16];
    106 
    107     return ll_idx_n2a(idx, nbuf);
     106    //static char nbuf[16];
     107    return ll_idx_n2a(idx/*, nbuf*/);
    108108}
    109109
     
    137137{
    138138    int ret = 0;
    139     int sock_fd;
    140139
    141140/* caching is not warranted - no users which repeatedly call it */
     
    165164        }
    166165    }
    167     /* We have not found the interface in our cache, but the kernel
    168      * may still know about it. One reason is that we may be using
    169      * module on-demand loading, which means that the kernel will
    170      * load the module and make the interface exist only when
    171      * we explicitely request it (check for dev_load() in net/core/dev.c).
    172      * I can think of other similar scenario, but they are less common...
    173      * Jean II */
    174166#endif
    175 
    176     sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
    177     if (sock_fd >= 0) {
    178         struct ifreq ifr;
    179         int tmp;
    180 
    181         strncpy_IFNAMSIZ(ifr.ifr_name, name);
    182         ifr.ifr_ifindex = -1;
    183         tmp = ioctl(sock_fd, SIOCGIFINDEX, &ifr);
    184         close(sock_fd);
    185         if (tmp >= 0)
    186             /* In theory, we should redump the interface list
    187              * to update our cache, this is left as an exercise
    188              * to the reader... Jean II */
    189             ret = ifr.ifr_ifindex;
    190     }
     167    ret = if_nametoindex(name);
    191168/* out:*/
    192169    if (ret <= 0)
Note: See TracChangeset for help on using the changeset viewer.