mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-24 06:52:02 +08:00
loopback01: Initialize via IFCONFIG(8)
This commit is contained in:
parent
616f6000b6
commit
5ddce1f196
@ -6,12 +6,14 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <rtems/bsd/sys/param.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
|
||||||
#define TEST_NAME "LIBBSD LOOPBACK 1"
|
#define TEST_NAME "LIBBSD LOOPBACK 1"
|
||||||
|
|
||||||
#include <rtems/error.h>
|
#include <rtems/error.h>
|
||||||
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -19,31 +21,11 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <sysexits.h>
|
||||||
|
|
||||||
/* for old configuration structure */
|
#include <machine/rtems-bsd-commands.h>
|
||||||
#include <rtems/rtems_bsdnet.h>
|
|
||||||
|
|
||||||
/*
|
#include <rtems.h>
|
||||||
* Network configuration
|
|
||||||
*/
|
|
||||||
struct rtems_bsdnet_config rtems_bsdnet_config = {
|
|
||||||
NULL, /* Network interface */
|
|
||||||
NULL, /* Use fixed network configuration */
|
|
||||||
0, /* Default network task priority */
|
|
||||||
0, /* Default mbuf capacity */
|
|
||||||
0, /* Default mbuf cluster capacity */
|
|
||||||
"testSystem", /* Host name */
|
|
||||||
"nowhere.com", /* Domain name */
|
|
||||||
"127.0.0.1", /* Gateway */
|
|
||||||
"127.0.0.1", /* Log host */
|
|
||||||
{"127.0.0.1" }, /* Name server(s) */
|
|
||||||
{"127.0.0.1" }, /* NTP server(s) */
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Thread-safe output routines
|
* Thread-safe output routines
|
||||||
@ -216,6 +198,16 @@ static void test_main(void)
|
|||||||
{
|
{
|
||||||
rtems_status_code sc;
|
rtems_status_code sc;
|
||||||
rtems_task_priority old;
|
rtems_task_priority old;
|
||||||
|
int exit_code;
|
||||||
|
char *lo0[] = {
|
||||||
|
"ifconfig",
|
||||||
|
"lo0",
|
||||||
|
"inet",
|
||||||
|
"127.0.0.1",
|
||||||
|
"netmask",
|
||||||
|
"255.255.255.0",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
sc = rtems_semaphore_create(
|
sc = rtems_semaphore_create(
|
||||||
rtems_build_name('P','m','t','x'),
|
rtems_build_name('P','m','t','x'),
|
||||||
@ -240,6 +232,9 @@ static void test_main(void)
|
|||||||
printf("Should fail with `connection refused'.\n");
|
printf("Should fail with `connection refused'.\n");
|
||||||
clientWorker(0);
|
clientWorker(0);
|
||||||
|
|
||||||
|
exit_code = rtems_bsd_command_ifconfig(nitems(lo0) - 1, lo0);
|
||||||
|
assert(exit_code == EX_OK);
|
||||||
|
|
||||||
printf("\nStart server.\n");
|
printf("\nStart server.\n");
|
||||||
spawnTask(serverTask, 150, 0);
|
spawnTask(serverTask, 150, 0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user