Changeset defe035 in rtems-libbsd


Ignore:
Timestamp:
Jan 22, 2014, 8:13:54 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, c1e05b9ea378b2971e3d7704779112b4bc4296da, freebsd-9.3, e6acc15bc94ea35f40e50b42692584c456ba9722
Children:
31ab470
Parents:
8118e8e
git-author:
Sebastian Huber <sebastian.huber@…> (01/22/14 08:13:54)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/30/14 15:23:01)
Message:

Add DEFAULT_NETWORK_NO_STATIC_IFCONFIG

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuite/include/rtems/bsd/test/default-network-init.h

    r8118e8e rdefe035  
    3030 */
    3131
     32#include <net/if.h>
     33
    3234#include <assert.h>
     35#include <ifaddrs.h>
    3336#include <stdio.h>
    3437#include <stdlib.h>
     
    3942#include <rtems.h>
    4043#include <rtems/stackchk.h>
     44#include <rtems/bsd/bsd.h>
     45
     46#ifndef DEFAULT_NETWORK_NO_STATIC_IFCONFIG
    4147#include <rtems/bsd/test/network-config.h>
    42 #include <rtems/bsd/bsd.h>
     48#endif
    4349
    4450static void
     
    8288
    8389static void
    84 default_network_ifconfig_interface_0(void)
     90default_network_ifconfig_hwif0(char *ifname)
    8591{
    8692        int exit_code;
    87         char *iface0[] = {
     93        char *ifcfg[] = {
    8894                "ifconfig",
    89                 NET_CFG_INTERFACE_0,
     95                ifname,
     96#ifdef DEFAULT_NETWORK_NO_STATIC_IFCONFIG
     97                "up",
     98#else
    9099                "inet",
    91100                NET_CFG_SELF_IP,
    92101                "netmask",
    93102                NET_CFG_NETMASK,
    94                 NULL
    95         };
    96 
    97         exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(iface0), iface0);
     103#endif
     104                NULL
     105        };
     106
     107        exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(ifcfg), ifcfg);
    98108        assert(exit_code == EX_OK);
    99109}
    100110
    101111static void
    102 default_network_route(void)
    103 {
     112default_network_route_hwif0(char *ifname)
     113{
     114#ifndef DEFAULT_NETWORK_NO_STATIC_IFCONFIG
    104115        int exit_code;
    105116        char *dflt_route[] = {
     
    109120                NET_CFG_GATEWAY_IP,
    110121                "-iface",
    111                 NET_CFG_INTERFACE_0,
     122                ifname,
    112123                NULL
    113124        };
     
    125136        exit_code = rtems_bsd_command_route(RTEMS_BSD_ARGC(dflt_route2), dflt_route2);
    126137        assert(exit_code == EXIT_SUCCESS);
     138#endif
    127139}
    128140
     
    142154{
    143155        rtems_status_code sc;
     156#ifdef DEFAULT_NETWORK_NO_STATIC_IFCONFIG
     157        char ifnamebuf[IF_NAMESIZE];
     158#endif
     159        char *ifname;
    144160
    145161        puts("*** " TEST_NAME " TEST ***");
     
    151167
    152168        rtems_bsd_initialize();
     169
     170#ifdef DEFAULT_NETWORK_NO_STATIC_IFCONFIG
     171        ifname = if_indextoname(1, &ifnamebuf[0]);
     172        assert(ifname != NULL);
     173#else
     174        ifname = NET_CFG_INTERFACE_0;
     175#endif
    153176
    154177        /* Let the callout timer allocate its resources */
     
    157180
    158181        default_network_ifconfig_lo0();
    159         default_network_ifconfig_interface_0();
    160         default_network_route();
     182        default_network_ifconfig_hwif0(ifname);
     183        default_network_route_hwif0(ifname);
    161184
    162185        test_main();
     
    171194#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
    172195#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
     196#define CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
     197#define CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
    173198
    174199#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
Note: See TracChangeset for help on using the changeset viewer.