Changeset defe035 in rtems-libbsd for testsuite/include/rtems/bsd/test/default-network-init.h
- Timestamp:
- 01/22/14 08:13:54 (8 years ago)
- Branches:
- 4.11, 5, 5-freebsd-12, 6-freebsd-12, freebsd-9.3, master
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
testsuite/include/rtems/bsd/test/default-network-init.h
r8118e8e rdefe035 30 30 */ 31 31 32 #include <net/if.h> 33 32 34 #include <assert.h> 35 #include <ifaddrs.h> 33 36 #include <stdio.h> 34 37 #include <stdlib.h> … … 39 42 #include <rtems.h> 40 43 #include <rtems/stackchk.h> 44 #include <rtems/bsd/bsd.h> 45 46 #ifndef DEFAULT_NETWORK_NO_STATIC_IFCONFIG 41 47 #include <rtems/bsd/test/network-config.h> 42 # include <rtems/bsd/bsd.h>48 #endif 43 49 44 50 static void … … 82 88 83 89 static void 84 default_network_ifconfig_ interface_0(void)90 default_network_ifconfig_hwif0(char *ifname) 85 91 { 86 92 int exit_code; 87 char *if ace0[] = {93 char *ifcfg[] = { 88 94 "ifconfig", 89 NET_CFG_INTERFACE_0, 95 ifname, 96 #ifdef DEFAULT_NETWORK_NO_STATIC_IFCONFIG 97 "up", 98 #else 90 99 "inet", 91 100 NET_CFG_SELF_IP, 92 101 "netmask", 93 102 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); 98 108 assert(exit_code == EX_OK); 99 109 } 100 110 101 111 static void 102 default_network_route(void) 103 { 112 default_network_route_hwif0(char *ifname) 113 { 114 #ifndef DEFAULT_NETWORK_NO_STATIC_IFCONFIG 104 115 int exit_code; 105 116 char *dflt_route[] = { … … 109 120 NET_CFG_GATEWAY_IP, 110 121 "-iface", 111 NET_CFG_INTERFACE_0,122 ifname, 112 123 NULL 113 124 }; … … 125 136 exit_code = rtems_bsd_command_route(RTEMS_BSD_ARGC(dflt_route2), dflt_route2); 126 137 assert(exit_code == EXIT_SUCCESS); 138 #endif 127 139 } 128 140 … … 142 154 { 143 155 rtems_status_code sc; 156 #ifdef DEFAULT_NETWORK_NO_STATIC_IFCONFIG 157 char ifnamebuf[IF_NAMESIZE]; 158 #endif 159 char *ifname; 144 160 145 161 puts("*** " TEST_NAME " TEST ***"); … … 151 167 152 168 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 153 176 154 177 /* Let the callout timer allocate its resources */ … … 157 180 158 181 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); 161 184 162 185 test_main(); … … 171 194 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER 172 195 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER 196 #define CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER 197 #define CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER 173 198 174 199 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
Note: See TracChangeset
for help on using the changeset viewer.