Ignore:
Timestamp:
Nov 6, 2007, 11:01:53 AM (12 years ago)
Author:
Bruno Cornec
Message:
  • Better output for mindi-busybox revision
  • Remove dummy file created on NFS - report from Arnaud Tiger <arnaud.tiger_at_hp.com>
  • strace useful for debug
  • fix new versions for pb (2.0.0 for mindi and 1.7.2 for mindi-busybox)
  • fix build process for mindi-busybox + options used in that version (dd for label-partitions-as-necessary)
  • fix typo in label-partitions-as-necessary which doesn't seem to work
  • Update to busybox 1.7.2
  • perl is now required at restore time to support uuid swap partitions (and will be used for many other thigs

in the future for sure)

  • next mindi version will be 2.0.0 due to all the changes made in it (udev may break working distros)
  • small optimization in mindi on keyboard handling (one single find instead of multiple)
  • better interaction for USB device when launching mindi manually
  • attempt to automatically guess block disk size for ramdisk
  • fix typos in bkphw
  • Fix the remaining problem with UUID support for swap partitions
  • Updates mondoarchive man page for USB support
  • Adds preliminary Hardware support to mindi (Proliant SSSTK)
  • Tries to add udev support also for rhel4
  • Fix UUID support which was still broken.
  • Be conservative in test for the start-nfs script
  • Update config file for mindi-busybox for 1.7.2 migration
  • Try to run around a busybox bug (1.2.2 pb on inexistant links)
  • Add build content for mindi-busybox in pb
  • Remove distributions content for mindi-busybox
  • Fix a warning on inexistant raidtab
  • Solve problem on tmpfs in restore init (Problem of inexistant symlink and busybox)
  • Create MONDO_CACHE and use it everywhere + creation at start
  • Really never try to eject a USB device
  • Fix a issue with &> usage (replaced with 1> and 2>)
  • Adds magic file to depllist in order to have file working + ldd which helps for debugging issues
  • tty modes correct to avoid sh error messages
  • Use ext3 normally and not ext2 instead
  • USB device should be corrected after reading (take 1st part)
  • Adds a mount_USB_here function derived from mount_CDROM_here
  • usb detection place before /dev detection in device name at restore time
  • Fix when restoring from USB: media is asked in interactive mode
  • Adds USB support for mondorestore
  • mount_cdrom => mount_media
  • elilo.efi is now searched throughout /boot/efi and not in a fixed place as there is no standard
  • untar-and-softlink => untar (+ interface change)
  • suppress useless softlinks creation/removal in boot process
  • avoids udevd messages on groups
  • Increase # of disks to 99 as in mindi at restore time (should be a conf file parameter)
  • skip existing big file creation
  • seems to work correctly for USB mindi boot
  • Adds group and tty link to udev conf
  • Always load usb-torage (even 2.6) to initiate USB bus discovery
  • Better printing of messages
  • Attempt to fix a bug in supporting OpenSusE 10.3 kernel for initramfs (mindi may now use multiple regex for kernel initrd detection)
  • Links were not correctly done as non relative for modules in mindi
  • exclusion of modules denied now works
  • Also create modules in their ordinary place, so that classical modprobe works + copy modules.dep
  • Fix bugs for DENY_MODS handling
  • Add device /dev/console for udev
  • ide-generic should now really be excluded
  • Fix a bug in major number for tty
  • If udev then adds modprobe/insmod to rootfs
  • tty0 is also cretaed with udev
  • ide-generic put rather in DENY_MODS
  • udevd remove from deplist s handled in mindi directly
  • better default for mindi when using --usb
  • Handles dynamically linked busybox (in case we want to use it soon ;-)
  • Adds fixed devices to create for udev
  • ide-generic should not be part of the initrd when using libata v2
  • support a dynamically linked udev (case on Ubuntu 7.10 and Mandriva 2008.0 so should be quite generic) This will give incitation to move to dyn. linked binaries in the initrd which will help for other tasks (ia6 4)
  • Improvement in udev support (do not use cl options not available in busybox)
  • Udev in mindi
    • auto creation of the right links at boot time with udev-links.conf(from Mandriva 2008.0)
    • rework startup of udev as current makes kernel crash (from Mandriva 2008.0)
    • add support for 64 bits udev
  • Try to render MyInsmod? silent at boot time
  • Adds udev support (mandatory for newest distributions to avoid remapping of devices in a different way as on the original system)
  • We also need vaft format support for USB boot
  • Adds libusual support (Ubuntu 7.10 needs it for USB)
  • Improve Ubuntu/Debian? keyboard detection and support
  • pbinit adapted to new pb (0.8.10). Filtering of docs done in it
  • Suppress some mondo warnings and errors on USB again
  • Tries to fix lack of files in deb mindi package
  • Verify should now work for USB devices
  • More log/mesages improvement for USB support
  • - Supress g_erase_tmpdir_and_scratchdir
  • Improve some log messages for USB support
  • Try to improve install in mindi to avoid issues with isolinux.cfg not installed vene if in the pkg :-(
  • Improve mindi-busybox build
  • In conformity with pb 0.8.9
  • Add support for Ubuntu 7.10 in build process
  • Add USB Key button to Menu UI (CD streamer removed)
  • Attempt to fix error messages on tmp/scratch files at the end by removing those dir at the latest possible.
  • Fix a bug linked to the size of the -E param which could be used (Arnaud Tiger/René? Ribaud).
  • Integrate ~/.pbrc content into mondorescue.pb (required project-builder >= 0.8.7)
  • Put mondorescue in conformity with new pb filtering rules
  • Add USB support at restore time (no test done yet). New start-usb script PB varibale added where useful
  • Unmounting USB device before removal of temporary scratchdir
  • Stil refining USB copy back to mondo (one command was not executed)
  • No need to have the image subdor in the csratchdir when USB.
  • umount the USB partition before attempting to use it
  • Remove useless copy from mindi to mondo at end of USB handling

(risky merge, we are raising the limits of 2 diverging branches. The status of stable is not completely sure as such. Will need lots of tests, but it's not yet done :-()
(merge -r1692:1769 $SVN_M/branches/2.2.5)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi-busybox/networking/libiproute/rt_names.c

    r821 r1770  
     1/* vi: set sw=4 ts=4: */
    12/*
    23 * rt_names.c       rtnetlink names DB.
     
    910 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
    1011 */
    11 #include <stdio.h>
    12 #include <stdlib.h>
    13 #include <string.h>
    14 
    15 #include <stdint.h>
     12
     13#include "libbb.h"
    1614#include "rt_names.h"
    1715
    18 static void rtnl_tab_initialize(char *file, char **tab, int size)
     16static void rtnl_tab_initialize(const char *file, const char **tab, int size)
    1917{
    2018    char buf[512];
     
    3331        if (*p == '#' || *p == '\n' || *p == 0)
    3432            continue;
    35         if (sscanf(p, "0x%x %s\n", &id, namebuf) != 2 &&
    36             sscanf(p, "0x%x %s #", &id, namebuf) != 2 &&
    37             sscanf(p, "%d %s\n", &id, namebuf) != 2 &&
    38             sscanf(p, "%d %s #", &id, namebuf) != 2) {
    39             fprintf(stderr, "Database %s is corrupted at %s\n",
     33        if (sscanf(p, "0x%x %s\n", &id, namebuf) != 2
     34         && sscanf(p, "0x%x %s #", &id, namebuf) != 2
     35         && sscanf(p, "%d %s\n", &id, namebuf) != 2
     36         && sscanf(p, "%d %s #", &id, namebuf) != 2
     37        ) {
     38            bb_error_msg("database %s is corrupted at %s",
    4039                file, p);
    4140            return;
    4241        }
    4342
    44         if (id<0 || id>size)
     43        if (id < 0 || id > size)
    4544            continue;
    4645
    47         tab[id] = strdup(namebuf);
     46        tab[id] = xstrdup(namebuf);
    4847    }
    4948    fclose(fp);
     
    5150
    5251
    53 static char * rtnl_rtprot_tab[256] = {
    54     "none",
    55     "redirect",
    56     "kernel",
    57     "boot",
    58     "static",
    59     NULL,
    60     NULL,
    61     NULL,
    62     "gated",
    63     "ra",
    64     "mrt",
    65     "zebra",
    66     "bird",
    67 };
    68 
    69 
    70 
    71 static int rtnl_rtprot_init;
     52static const char **rtnl_rtprot_tab; /* [256] */
    7253
    7354static void rtnl_rtprot_initialize(void)
    7455{
    75     rtnl_rtprot_init = 1;
     56    static const char *const init_tab[] = {
     57        "none",
     58        "redirect",
     59        "kernel",
     60        "boot",
     61        "static",
     62        NULL,
     63        NULL,
     64        NULL,
     65        "gated",
     66        "ra",
     67        "mrt",
     68        "zebra",
     69        "bird",
     70    };
     71    if (rtnl_rtprot_tab) return;
     72    rtnl_rtprot_tab = xzalloc(256 * sizeof(rtnl_rtprot_tab[0]));
     73    memcpy(rtnl_rtprot_tab, init_tab, sizeof(init_tab));
    7674    rtnl_tab_initialize("/etc/iproute2/rt_protos",
    7775                rtnl_rtprot_tab, 256);
    7876}
    7977
    80 const char * rtnl_rtprot_n2a(int id, char *buf, int len)
    81 {
    82     if (id<0 || id>=256) {
    83         snprintf(buf, len, "%d", id);
    84         return buf;
    85     }
    86     if (!rtnl_rtprot_tab[id]) {
    87         if (!rtnl_rtprot_init)
    88             rtnl_rtprot_initialize();
    89     }
     78
     79const char* rtnl_rtprot_n2a(int id, char *buf, int len)
     80{
     81    if (id < 0 || id >= 256) {
     82        snprintf(buf, len, "%d", id);
     83        return buf;
     84    }
     85
     86    rtnl_rtprot_initialize();
     87
    9088    if (rtnl_rtprot_tab[id])
    9189        return rtnl_rtprot_tab[id];
     
    9694int rtnl_rtprot_a2n(uint32_t *id, char *arg)
    9795{
    98     static char *cache = NULL;
    99     static unsigned long res;
    100     char *end;
    101     int i;
    102 
    103     if (cache && strcmp(cache, arg) == 0) {
    104         *id = res;
    105         return 0;
    106     }
    107 
    108     if (!rtnl_rtprot_init)
    109         rtnl_rtprot_initialize();
    110 
    111     for (i=0; i<256; i++) {
     96    static const char *cache = NULL;
     97    static unsigned long res;
     98    int i;
     99
     100    if (cache && strcmp(cache, arg) == 0) {
     101        *id = res;
     102        return 0;
     103    }
     104
     105    rtnl_rtprot_initialize();
     106
     107    for (i = 0; i < 256; i++) {
    112108        if (rtnl_rtprot_tab[i] &&
    113109            strcmp(rtnl_rtprot_tab[i], arg) == 0) {
     
    119115    }
    120116
    121     res = strtoul(arg, &end, 0);
    122     if (!end || end == arg || *end || res > 255)
     117    res = bb_strtoul(arg, NULL, 0);
     118    if (errno || res > 255)
    123119        return -1;
    124120    *id = res;
     
    127123
    128124
    129 
    130 static char * rtnl_rtscope_tab[256] = {
    131     "global",
    132 };
    133 
    134 static int rtnl_rtscope_init;
     125static const char **rtnl_rtscope_tab; /* [256] */
    135126
    136127static void rtnl_rtscope_initialize(void)
    137128{
    138     rtnl_rtscope_init = 1;
     129    if (rtnl_rtscope_tab) return;
     130    rtnl_rtscope_tab = xzalloc(256 * sizeof(rtnl_rtscope_tab[0]));
     131    rtnl_rtscope_tab[0] = "global";
    139132    rtnl_rtscope_tab[255] = "nowhere";
    140133    rtnl_rtscope_tab[254] = "host";
     
    145138}
    146139
    147 const char * rtnl_rtscope_n2a(int id, char *buf, int len)
    148 {
    149     if (id<0 || id>=256) {
    150         snprintf(buf, len, "%d", id);
    151         return buf;
    152     }
    153     if (!rtnl_rtscope_tab[id]) {
    154         if (!rtnl_rtscope_init)
    155             rtnl_rtscope_initialize();
    156     }
     140
     141const char* rtnl_rtscope_n2a(int id, char *buf, int len)
     142{
     143    if (id < 0 || id >= 256) {
     144        snprintf(buf, len, "%d", id);
     145        return buf;
     146    }
     147
     148    rtnl_rtscope_initialize();
     149
    157150    if (rtnl_rtscope_tab[id])
    158151        return rtnl_rtscope_tab[id];
     
    163156int rtnl_rtscope_a2n(uint32_t *id, char *arg)
    164157{
    165     static char *cache = NULL;
    166     static unsigned long res;
    167     char *end;
    168     int i;
    169 
    170     if (cache && strcmp(cache, arg) == 0) {
    171         *id = res;
    172         return 0;
    173     }
    174 
    175     if (!rtnl_rtscope_init)
    176         rtnl_rtscope_initialize();
    177 
    178     for (i=0; i<256; i++) {
     158    static const char *cache = NULL;
     159    static unsigned long res;
     160    int i;
     161
     162    if (cache && strcmp(cache, arg) == 0) {
     163        *id = res;
     164        return 0;
     165    }
     166
     167    rtnl_rtscope_initialize();
     168
     169    for (i = 0; i < 256; i++) {
    179170        if (rtnl_rtscope_tab[i] &&
    180171            strcmp(rtnl_rtscope_tab[i], arg) == 0) {
     
    186177    }
    187178
    188     res = strtoul(arg, &end, 0);
    189     if (!end || end == arg || *end || res > 255)
     179    res = bb_strtoul(arg, NULL, 0);
     180    if (errno || res > 255)
    190181        return -1;
    191182    *id = res;
     
    194185
    195186
    196 
    197 static char * rtnl_rtrealm_tab[256] = {
    198     "unknown",
    199 };
    200 
    201 static int rtnl_rtrealm_init;
     187static const char **rtnl_rtrealm_tab; /* [256] */
    202188
    203189static void rtnl_rtrealm_initialize(void)
    204190{
    205     rtnl_rtrealm_init = 1;
     191    if (rtnl_rtrealm_tab) return;
     192    rtnl_rtrealm_tab = xzalloc(256 * sizeof(rtnl_rtrealm_tab[0]));
     193    rtnl_rtrealm_tab[0] = "unknown";
    206194    rtnl_tab_initialize("/etc/iproute2/rt_realms",
    207195                rtnl_rtrealm_tab, 256);
    208196}
    209197
     198
    210199int rtnl_rtrealm_a2n(uint32_t *id, char *arg)
    211200{
    212     static char *cache = NULL;
    213     static unsigned long res;
    214     char *end;
    215     int i;
    216 
    217     if (cache && strcmp(cache, arg) == 0) {
    218         *id = res;
    219         return 0;
    220     }
    221 
    222     if (!rtnl_rtrealm_init)
    223         rtnl_rtrealm_initialize();
    224 
    225     for (i=0; i<256; i++) {
     201    static const char *cache = NULL;
     202    static unsigned long res;
     203    int i;
     204
     205    if (cache && strcmp(cache, arg) == 0) {
     206        *id = res;
     207        return 0;
     208    }
     209
     210    rtnl_rtrealm_initialize();
     211
     212    for (i = 0; i < 256; i++) {
    226213        if (rtnl_rtrealm_tab[i] &&
    227214            strcmp(rtnl_rtrealm_tab[i], arg) == 0) {
     
    233220    }
    234221
    235     res = strtoul(arg, &end, 0);
    236     if (!end || end == arg || *end || res > 255)
     222    res = bb_strtoul(arg, NULL, 0);
     223    if (errno || res > 255)
    237224        return -1;
    238225    *id = res;
     
    240227}
    241228
    242 
    243 
    244 static char * rtnl_rtdsfield_tab[256] = {
    245     "0",
    246 };
    247 
    248 static int rtnl_rtdsfield_init;
     229#if ENABLE_FEATURE_IP_RULE
     230const char* rtnl_rtrealm_n2a(int id, char *buf, int len)
     231{
     232    if (id < 0 || id >= 256) {
     233        snprintf(buf, len, "%d", id);
     234        return buf;
     235    }
     236
     237    rtnl_rtrealm_initialize();
     238
     239    if (rtnl_rtrealm_tab[id])
     240        return rtnl_rtrealm_tab[id];
     241    snprintf(buf, len, "%d", id);
     242    return buf;
     243}
     244#endif
     245
     246
     247static const char **rtnl_rtdsfield_tab; /* [256] */
    249248
    250249static void rtnl_rtdsfield_initialize(void)
    251250{
    252     rtnl_rtdsfield_init = 1;
     251    if (rtnl_rtdsfield_tab) return;
     252    rtnl_rtdsfield_tab = xzalloc(256 * sizeof(rtnl_rtdsfield_tab[0]));
     253    rtnl_rtdsfield_tab[0] = "0";
    253254    rtnl_tab_initialize("/etc/iproute2/rt_dsfield",
    254255                rtnl_rtdsfield_tab, 256);
    255256}
    256257
     258
    257259const char * rtnl_dsfield_n2a(int id, char *buf, int len)
    258260{
    259     if (id<0 || id>=256) {
    260         snprintf(buf, len, "%d", id);
    261         return buf;
    262     }
    263     if (!rtnl_rtdsfield_tab[id]) {
    264         if (!rtnl_rtdsfield_init)
    265             rtnl_rtdsfield_initialize();
    266     }
     261    if (id < 0 || id >= 256) {
     262        snprintf(buf, len, "%d", id);
     263        return buf;
     264    }
     265
     266    rtnl_rtdsfield_initialize();
     267
    267268    if (rtnl_rtdsfield_tab[id])
    268269        return rtnl_rtdsfield_tab[id];
     
    274275int rtnl_dsfield_a2n(uint32_t *id, char *arg)
    275276{
    276     static char *cache = NULL;
    277     static unsigned long res;
    278     char *end;
    279     int i;
    280 
    281     if (cache && strcmp(cache, arg) == 0) {
    282         *id = res;
    283         return 0;
    284     }
    285 
    286     if (!rtnl_rtdsfield_init)
    287         rtnl_rtdsfield_initialize();
    288 
    289     for (i=0; i<256; i++) {
     277    static const char *cache = NULL;
     278    static unsigned long res;
     279    int i;
     280
     281    if (cache && strcmp(cache, arg) == 0) {
     282        *id = res;
     283        return 0;
     284    }
     285
     286    rtnl_rtdsfield_initialize();
     287
     288    for (i = 0; i < 256; i++) {
    290289        if (rtnl_rtdsfield_tab[i] &&
    291290            strcmp(rtnl_rtdsfield_tab[i], arg) == 0) {
     
    297296    }
    298297
    299     res = strtoul(arg, &end, 16);
    300     if (!end || end == arg || *end || res > 255)
     298    res = bb_strtoul(arg, NULL, 16);
     299    if (errno || res > 255)
    301300        return -1;
    302301    *id = res;
     
    304303}
    305304
     305
     306#if ENABLE_FEATURE_IP_RULE
     307static const char **rtnl_rttable_tab; /* [256] */
     308
     309static void rtnl_rttable_initialize(void)
     310{
     311    if (rtnl_rtdsfield_tab) return;
     312    rtnl_rttable_tab = xzalloc(256 * sizeof(rtnl_rttable_tab[0]));
     313    rtnl_rttable_tab[0] = "unspec";
     314    rtnl_rttable_tab[255] = "local";
     315    rtnl_rttable_tab[254] = "main";
     316    rtnl_rttable_tab[253] = "default";
     317    rtnl_tab_initialize("/etc/iproute2/rt_tables", rtnl_rttable_tab, 256);
     318}
     319
     320
     321const char *rtnl_rttable_n2a(int id, char *buf, int len)
     322{
     323    if (id < 0 || id >= 256) {
     324        snprintf(buf, len, "%d", id);
     325        return buf;
     326    }
     327
     328    rtnl_rttable_initialize();
     329
     330    if (rtnl_rttable_tab[id])
     331        return rtnl_rttable_tab[id];
     332    snprintf(buf, len, "%d", id);
     333    return buf;
     334}
     335
     336int rtnl_rttable_a2n(uint32_t * id, char *arg)
     337{
     338    static char *cache = NULL;
     339    static unsigned long res;
     340    int i;
     341
     342    if (cache && strcmp(cache, arg) == 0) {
     343        *id = res;
     344        return 0;
     345    }
     346
     347    rtnl_rttable_initialize();
     348
     349    for (i = 0; i < 256; i++) {
     350        if (rtnl_rttable_tab[i] && strcmp(rtnl_rttable_tab[i], arg) == 0) {
     351            cache = (char*)rtnl_rttable_tab[i];
     352            res = i;
     353            *id = res;
     354            return 0;
     355        }
     356    }
     357
     358    i = bb_strtoul(arg, NULL, 0);
     359    if (errno || i > 255)
     360        return -1;
     361    *id = i;
     362    return 0;
     363}
     364
     365#endif
Note: See TracChangeset for help on using the changeset viewer.