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

    r1765 r2725  
    11/* vi: set sw=4 ts=4: */
    22/*
    3  * ll_proto.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
     
    2018#include <linux/if_ether.h>
    2119#endif
     20
     21#if !ENABLE_WERROR
     22#warning de-bloat
     23#endif
     24/* Before re-enabling this, please (1) conditionalize exotic protocols
     25 * on CONFIG_something, and (2) decouple strings and numbers
     26 * (use llproto_ids[] = n,n,n..; and llproto_names[] = "loop\0" "pup\0" ...;)
     27 */
    2228
    2329#define __PF(f,n) { ETH_P_##f, #n },
     
    9197
    9298
    93 const char * ll_proto_n2a(unsigned short id, char *buf, int len)
     99const char* FAST_FUNC ll_proto_n2a(unsigned short id, char *buf, int len)
    94100{
    95     int i;
    96 
     101    unsigned i;
    97102    id = ntohs(id);
    98 
    99     for (i=0; i < ARRAY_SIZE(llproto_names); i++) {
     103    for (i = 0; i < ARRAY_SIZE(llproto_names); i++) {
    100104         if (llproto_names[i].id == id)
    101105            return llproto_names[i].name;
     
    105109}
    106110
    107 int ll_proto_a2n(unsigned short *id, char *buf)
     111int FAST_FUNC ll_proto_a2n(unsigned short *id, char *buf)
    108112{
    109     int i;
    110     for (i=0; i < ARRAY_SIZE(llproto_names); i++) {
     113    unsigned i;
     114    for (i = 0; i < ARRAY_SIZE(llproto_names); i++) {
    111115         if (strcasecmp(llproto_names[i].name, buf) == 0) {
    112              *id = htons(llproto_names[i].id);
    113              return 0;
     116             i = llproto_names[i].id;
     117             goto good;
    114118         }
    115119    }
    116     if (get_u16(id, buf, 0))
     120    i = bb_strtou(buf, NULL, 0);
     121    if (errno || i > 0xffff)
    117122        return -1;
    118     *id = htons(*id);
     123 good:
     124    *id = htons(i);
    119125    return 0;
    120126}
Note: See TracChangeset for help on using the changeset viewer.