Ignore:
Timestamp:
Nov 6, 2007, 11:01:53 AM (16 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/libbb/inet_common.c

    r821 r1770  
     1/* vi: set sw=4 ts=4: */
    12/*
    23 * stolen from net-tools-1.59 and stripped down for busybox by
     
    56 * Heavily modified by Manuel Novoa III       Mar 12, 2001
    67 *
    7  * Version:     $Id: inet_common.c,v 1.8 2004/03/10 07:42:38 mjn3 Exp $
    88 *
    99 */
     
    1111#include "libbb.h"
    1212#include "inet_common.h"
    13 #include <stdio.h>
    14 #include <errno.h>
    15 #include <stdlib.h>
    16 #include <string.h>
    17 #include <unistd.h>
    18 
    19 #ifdef DEBUG
    20 # include <resolv.h>
    21 #endif
    22 
    23 
    24 const char bb_INET_default[] = "default";
    2513
    2614int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst)
    2715{
    2816    struct hostent *hp;
     17#if ENABLE_FEATURE_ETC_NETWORKS
    2918    struct netent *np;
     19#endif
    3020
    3121    /* Grmpf. -FvK */
     
    3424
    3525    /* Default is special, meaning 0.0.0.0. */
    36     if (!strcmp(name, bb_INET_default)) {
     26    if (!strcmp(name, bb_str_default)) {
    3727        s_in->sin_addr.s_addr = INADDR_ANY;
    38         return (1);
     28        return 1;
    3929    }
    4030    /* Look to see if it's a dotted quad. */
     
    4535#ifdef DEBUG
    4636    if (hostfirst) {
    47         bb_error_msg("gethostbyname (%s)", name);
    48     }
    49 #endif
    50     if (hostfirst && (hp = gethostbyname(name)) != (struct hostent *) NULL) {
    51         memcpy((char *) &s_in->sin_addr, (char *) hp->h_addr_list[0],
    52                sizeof(struct in_addr));
    53         return 0;
    54     }
     37        bb_error_msg("gethostbyname(%s)", name);
     38    }
     39#endif
     40    if (hostfirst) {
     41        hp = gethostbyname(name);
     42        if (hp != NULL) {
     43            memcpy(&s_in->sin_addr, hp->h_addr_list[0],
     44                sizeof(struct in_addr));
     45            return 0;
     46        }
     47    }
     48#if ENABLE_FEATURE_ETC_NETWORKS
    5549    /* Try the NETWORKS database to see if this is a known network. */
    5650#ifdef DEBUG
    57     bb_error_msg("getnetbyname (%s)", name);
    58 #endif
    59     if ((np = getnetbyname(name)) != (struct netent *) NULL) {
     51    bb_error_msg("getnetbyname(%s)", name);
     52#endif
     53    np = getnetbyname(name);
     54    if (np != NULL) {
    6055        s_in->sin_addr.s_addr = htonl(np->n_net);
    6156        return 1;
    6257    }
     58#endif
    6359    if (hostfirst) {
    6460        /* Don't try again */
     
    7167
    7268#ifdef DEBUG
    73     bb_error_msg("gethostbyname (%s)", name);
    74 #endif
    75     if ((hp = gethostbyname(name)) == (struct hostent *) NULL) {
     69    bb_error_msg("gethostbyname(%s)", name);
     70#endif
     71    hp = gethostbyname(name);
     72    if (hp == NULL) {
    7673        return -1;
    7774    }
    78     memcpy((char *) &s_in->sin_addr, (char *) hp->h_addr_list[0],
    79            sizeof(struct in_addr));
    80 
     75    memcpy(&s_in->sin_addr, hp->h_addr_list[0], sizeof(struct in_addr));
    8176    return 0;
    8277}
    8378
    84 /* cache */
    85 struct addr {
    86     struct sockaddr_in addr;
    87     char *name;
    88     int host;
    89     struct addr *next;
    90 };
    91 
    92 static struct addr *INET_nn = NULL; /* addr-to-name cache           */
    9379
    9480/* numeric: & 0x8000: default instead of *,
     
    9682 *          & 0x0fff: don't resolve
    9783 */
    98 int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in,
    99                   int numeric, unsigned int netmask)
    100 {
    101     struct hostent *ent;
    102     struct netent *np;
     84char *INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t netmask)
     85{
     86    /* addr-to-name cache */
     87    struct addr {
     88        struct addr *next;
     89        struct sockaddr_in addr;
     90        int host;
     91        char name[1];
     92    };
     93    static struct addr *cache = NULL;
     94
    10395    struct addr *pn;
    104     unsigned long ad, host_ad;
     96    char *name;
     97    uint32_t ad, host_ad;
    10598    int host = 0;
    10699
     
    108101    if (s_in->sin_family != AF_INET) {
    109102#ifdef DEBUG
    110         bb_error_msg("rresolve: unsupport address family %d !",
     103        bb_error_msg("rresolve: unsupported address family %d!",
    111104                  s_in->sin_family);
    112105#endif
    113106        errno = EAFNOSUPPORT;
    114         return (-1);
    115     }
    116     ad = (unsigned long) s_in->sin_addr.s_addr;
    117 #ifdef DEBUG
    118     bb_error_msg("rresolve: %08lx, mask %08x, num %08x", ad, netmask, numeric);
     107        return NULL;
     108    }
     109    ad = s_in->sin_addr.s_addr;
     110#ifdef DEBUG
     111    bb_error_msg("rresolve: %08x, mask %08x, num %08x", (unsigned)ad, netmask, numeric);
    119112#endif
    120113    if (ad == INADDR_ANY) {
    121114        if ((numeric & 0x0FFF) == 0) {
    122115            if (numeric & 0x8000)
    123                 safe_strncpy(name, bb_INET_default, len);
    124             else
    125                 safe_strncpy(name, "*", len);
    126             return (0);
     116                return xstrdup(bb_str_default);
     117            return xstrdup("*");
    127118        }
    128119    }
    129     if (numeric & 0x0FFF) {
    130         safe_strncpy(name, inet_ntoa(s_in->sin_addr), len);
    131         return (0);
    132     }
     120    if (numeric & 0x0FFF)
     121        return xstrdup(inet_ntoa(s_in->sin_addr));
    133122
    134123    if ((ad & (~netmask)) != 0 || (numeric & 0x4000))
    135124        host = 1;
    136 #if 0
    137     INET_nn = NULL;
    138 #endif
    139     pn = INET_nn;
    140     while (pn != NULL) {
     125    pn = cache;
     126    while (pn) {
    141127        if (pn->addr.sin_addr.s_addr == ad && pn->host == host) {
    142             safe_strncpy(name, pn->name, len);
    143 #ifdef DEBUG
    144             bb_error_msg("rresolve: found %s %08lx in cache",
    145                       (host ? "host" : "net"), ad);
    146 #endif
    147             return (0);
     128#ifdef DEBUG
     129            bb_error_msg("rresolve: found %s %08x in cache",
     130                      (host ? "host" : "net"), (unsigned)ad);
     131#endif
     132            return xstrdup(pn->name);
    148133        }
    149134        pn = pn->next;
     
    151136
    152137    host_ad = ntohl(ad);
    153     np = NULL;
    154     ent = NULL;
     138    name = NULL;
    155139    if (host) {
    156 #ifdef DEBUG
    157         bb_error_msg("gethostbyaddr (%08lx)", ad);
     140        struct hostent *ent;
     141#ifdef DEBUG
     142        bb_error_msg("gethostbyaddr (%08x)", (unsigned)ad);
    158143#endif
    159144        ent = gethostbyaddr((char *) &ad, 4, AF_INET);
    160         if (ent != NULL) {
    161             safe_strncpy(name, ent->h_name, len);
    162         }
    163     } else {
    164 #ifdef DEBUG
    165         bb_error_msg("getnetbyaddr (%08lx)", host_ad);
     145        if (ent)
     146            name = xstrdup(ent->h_name);
     147    } else if (ENABLE_FEATURE_ETC_NETWORKS) {
     148        struct netent *np;
     149#ifdef DEBUG
     150        bb_error_msg("getnetbyaddr (%08x)", (unsigned)host_ad);
    166151#endif
    167152        np = getnetbyaddr(host_ad, AF_INET);
    168         if (np != NULL) {
    169             safe_strncpy(name, np->n_name, len);
    170         }
    171     }
    172     if ((ent == NULL) && (np == NULL)) {
    173         safe_strncpy(name, inet_ntoa(s_in->sin_addr), len);
    174     }
    175     pn = (struct addr *) xmalloc(sizeof(struct addr));
     153        if (np)
     154            name = xstrdup(np->n_name);
     155    }
     156    if (!name)
     157        name = xstrdup(inet_ntoa(s_in->sin_addr));
     158    pn = xmalloc(sizeof(*pn) + strlen(name)); /* no '+ 1', it's already accounted for */
     159    pn->next = cache;
    176160    pn->addr = *s_in;
    177     pn->next = INET_nn;
    178161    pn->host = host;
    179     pn->name = bb_xstrdup(name);
    180     INET_nn = pn;
    181 
    182     return (0);
    183 }
    184 
    185 #ifdef CONFIG_FEATURE_IPV6
     162    strcpy(pn->name, name);
     163    cache = pn;
     164    return name;
     165}
     166
     167#if ENABLE_FEATURE_IPV6
    186168
    187169int INET6_resolve(const char *name, struct sockaddr_in6 *sin6)
     
    192174    memset(&req, '\0', sizeof req);
    193175    req.ai_family = AF_INET6;
    194     if ((s = getaddrinfo(name, NULL, &req, &ai))) {
     176    s = getaddrinfo(name, NULL, &req, &ai);
     177    if (s) {
    195178        bb_error_msg("getaddrinfo: %s: %d", name, s);
    196179        return -1;
    197180    }
    198181    memcpy(sin6, ai->ai_addr, sizeof(struct sockaddr_in6));
    199 
    200182    freeaddrinfo(ai);
    201 
    202     return (0);
     183    return 0;
    203184}
    204185
     
    210191
    211192
    212 int INET6_rresolve(char *name, size_t len, struct sockaddr_in6 *sin6,
    213                    int numeric)
    214 {
     193char *INET6_rresolve(struct sockaddr_in6 *sin6, int numeric)
     194{
     195    char name[128];
    215196    int s;
    216197
     
    218199    if (sin6->sin6_family != AF_INET6) {
    219200#ifdef DEBUG
    220         bb_error_msg(_("rresolve: unsupport address family %d !\n"),
     201        bb_error_msg("rresolve: unsupport address family %d!",
    221202                  sin6->sin6_family);
    222203#endif
    223204        errno = EAFNOSUPPORT;
    224         return (-1);
     205        return NULL;
    225206    }
    226207    if (numeric & 0x7FFF) {
    227         inet_ntop(AF_INET6, &sin6->sin6_addr, name, len);
    228         return (0);
     208        inet_ntop(AF_INET6, &sin6->sin6_addr, name, sizeof(name));
     209        return xstrdup(name);
    229210    }
    230211    if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
    231         if (numeric & 0x8000) {
    232             strcpy(name, "default");
    233         } else {
    234             strcpy(name, "*");
    235         }
    236         return (0);
    237     }
    238 
    239     s = getnameinfo((struct sockaddr *) sin6, sizeof(struct sockaddr_in6), name, len, NULL, 0, 0);
     212        if (numeric & 0x8000)
     213            return xstrdup(bb_str_default);
     214        return xstrdup("*");
     215    }
     216
     217    s = getnameinfo((struct sockaddr *) sin6, sizeof(struct sockaddr_in6),
     218                name, sizeof(name), NULL, 0, 0);
    240219    if (s) {
    241220        bb_error_msg("getnameinfo failed");
    242         return -1;
    243     }
    244     return (0);
     221        return NULL;
     222    }
     223    return xstrdup(name);
    245224}
    246225
Note: See TracChangeset for help on using the changeset viewer.