Rename IPv4 netlib functions and files to make room in the namespace for corresponding IPv6 functions and files
This commit is contained in:
parent
4eceae4e32
commit
953c0fb069
@ -118,17 +118,17 @@ printf("NET1: Configuring %s\n", CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME);
|
|||||||
#else
|
#else
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_BRIDGE_NET1_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_BRIDGE_NET1_IPADDR);
|
||||||
#endif
|
#endif
|
||||||
netlib_sethostaddr(CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME, &addr);
|
netlib_set_ipv4addr(CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME, &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_BRIDGE_NET1_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_BRIDGE_NET1_DRIPADDR);
|
||||||
netlib_setdraddr(CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME, &addr);
|
netlib_set_dripv4addr(CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME, &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_BRIDGE_NET1_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_BRIDGE_NET1_NETMASK);
|
||||||
netlib_setnetmask(CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME, &addr);
|
netlib_set_ipv4netmask(CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME, &addr);
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_BRIDGE_NET1_DHCPC
|
#ifdef CONFIG_EXAMPLES_BRIDGE_NET1_DHCPC
|
||||||
/* Set up the resolver */
|
/* Set up the resolver */
|
||||||
@ -159,16 +159,16 @@ printf("NET1: Configuring %s\n", CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME);
|
|||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
netlib_sethostaddr(CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME, &ds.ipaddr);
|
netlib_set_ipv4addr(CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME, &ds.ipaddr);
|
||||||
|
|
||||||
if (ds.netmask.s_addr != 0)
|
if (ds.netmask.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setnetmask(CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME, &ds.netmask);
|
netlib_set_ipv4netmask(CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME, &ds.netmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.default_router.s_addr != 0)
|
if (ds.default_router.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setdraddr(CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME, &ds.default_router);
|
netlib_set_dripv4addr(CONFIG_EXAMPLES_BRIDGE_NET1_IFNAME, &ds.default_router);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.dnsaddr.s_addr != 0)
|
if (ds.dnsaddr.s_addr != 0)
|
||||||
@ -243,17 +243,17 @@ printf("NET2: Configuring %s\n", CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME);
|
|||||||
#else
|
#else
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_BRIDGE_NET2_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_BRIDGE_NET2_IPADDR);
|
||||||
#endif
|
#endif
|
||||||
netlib_sethostaddr(CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME, &addr);
|
netlib_set_ipv4addr(CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME, &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_BRIDGE_NET2_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_BRIDGE_NET2_DRIPADDR);
|
||||||
netlib_setdraddr(CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME, &addr);
|
netlib_set_dripv4addr(CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME, &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_BRIDGE_NET2_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_BRIDGE_NET2_NETMASK);
|
||||||
netlib_setnetmask(CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME, &addr);
|
netlib_set_ipv4netmask(CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME, &addr);
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_BRIDGE_NET2_DHCPC
|
#ifdef CONFIG_EXAMPLES_BRIDGE_NET2_DHCPC
|
||||||
/* Set up the resolver */
|
/* Set up the resolver */
|
||||||
@ -284,16 +284,16 @@ printf("NET2: Configuring %s\n", CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME);
|
|||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
netlib_sethostaddr(CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME, &ds.ipaddr);
|
netlib_set_ipv4addr(CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME, &ds.ipaddr);
|
||||||
|
|
||||||
if (ds.netmask.s_addr != 0)
|
if (ds.netmask.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setnetmask(CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME, &ds.netmask);
|
netlib_set_ipv4netmask(CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME, &ds.netmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.default_router.s_addr != 0)
|
if (ds.default_router.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setdraddr(CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME, &ds.default_router);
|
netlib_set_dripv4addr(CONFIG_EXAMPLES_BRIDGE_NET2_IFNAME, &ds.default_router);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.dnsaddr.s_addr != 0)
|
if (ds.dnsaddr.s_addr != 0)
|
||||||
|
@ -115,17 +115,17 @@ int dhcpd_main(int argc, char *argv[])
|
|||||||
/* Set up our host address */
|
/* Set up our host address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_DHCPD_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_DHCPD_IPADDR);
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_DHCPD_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_DHCPD_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_DHCPD_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_DHCPD_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
|
|
||||||
/* Then start the server */
|
/* Then start the server */
|
||||||
|
|
||||||
|
@ -123,17 +123,17 @@ int discover_main(int argc, char *argv[])
|
|||||||
#else
|
#else
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_DISCOVER_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_DISCOVER_IPADDR);
|
||||||
#endif
|
#endif
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_DISCOVER_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_DISCOVER_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_DISCOVER_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_DISCOVER_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_DISCOVER_DHCPC
|
#ifdef CONFIG_EXAMPLES_DISCOVER_DHCPC
|
||||||
/* Set up the resolver */
|
/* Set up the resolver */
|
||||||
@ -157,16 +157,16 @@ int discover_main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
struct dhcpc_state ds;
|
struct dhcpc_state ds;
|
||||||
(void)dhcpc_request(handle, &ds);
|
(void)dhcpc_request(handle, &ds);
|
||||||
netlib_sethostaddr("eth0", &ds.ipaddr);
|
netlib_set_ipv4addr("eth0", &ds.ipaddr);
|
||||||
|
|
||||||
if (ds.netmask.s_addr != 0)
|
if (ds.netmask.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setnetmask("eth0", &ds.netmask);
|
netlib_set_ipv4netmask("eth0", &ds.netmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.default_router.s_addr != 0)
|
if (ds.default_router.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setdraddr("eth0", &ds.default_router);
|
netlib_set_dripv4addr("eth0", &ds.default_router);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.dnsaddr.s_addr != 0)
|
if (ds.dnsaddr.s_addr != 0)
|
||||||
|
@ -103,17 +103,17 @@ static void fptd_netinit(void)
|
|||||||
/* Set up our host address */
|
/* Set up our host address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_FTPD_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_FTPD_IPADDR);
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_FTPD_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_FTPD_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_FTPD_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_FTPD_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
#endif /* CONFIG_EXAMPLES_FTPD_NONETINIT */
|
#endif /* CONFIG_EXAMPLES_FTPD_NONETINIT */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,17 +111,17 @@ int igmp_main(int argc, char *argv[])
|
|||||||
/* Set up our host address */
|
/* Set up our host address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_IPADDR);
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
|
|
||||||
/* Not much of a test for now */
|
/* Not much of a test for now */
|
||||||
/* Join the group */
|
/* Join the group */
|
||||||
|
@ -93,17 +93,17 @@ int nettest_main(int argc, char *argv[])
|
|||||||
/* Set up our host address */
|
/* Set up our host address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_IPADDR);
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_NETTEST_SERVER
|
#ifdef CONFIG_EXAMPLES_NETTEST_SERVER
|
||||||
recv_server();
|
recv_server();
|
||||||
|
@ -312,17 +312,17 @@ static void net_configure(void)
|
|||||||
/* Set up our host address */
|
/* Set up our host address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_IPADDR);
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -106,17 +106,17 @@ static void net_configure(void)
|
|||||||
/* Set up our host address */
|
/* Set up our host address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_IPADDR);
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_POLL_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -138,17 +138,17 @@ int sendmail_main(int argc, char *argv[])
|
|||||||
/* Set up our host address */
|
/* Set up our host address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_SENDMAIL_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_SENDMAIL_IPADDR);
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_SENDMAIL_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_SENDMAIL_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_SENDMAIL_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_SENDMAIL_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
|
|
||||||
/* Then send the mail */
|
/* Then send the mail */
|
||||||
|
|
||||||
|
@ -131,17 +131,17 @@ static int tcpecho_netsetup()
|
|||||||
#else
|
#else
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_TCPECHO_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_TCPECHO_IPADDR);
|
||||||
#endif
|
#endif
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_TCPECHO_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_TCPECHO_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_TCPECHO_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_TCPECHO_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_TCPECHO_DHCPC
|
#ifdef CONFIG_EXAMPLES_TCPECHO_DHCPC
|
||||||
/* Set up the resolver */
|
/* Set up the resolver */
|
||||||
@ -170,16 +170,16 @@ static int tcpecho_netsetup()
|
|||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
netlib_sethostaddr("eth0", &ds.ipaddr);
|
netlib_set_ipv4addr("eth0", &ds.ipaddr);
|
||||||
|
|
||||||
if (ds.netmask.s_addr != 0)
|
if (ds.netmask.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setnetmask("eth0", &ds.netmask);
|
netlib_set_ipv4netmask("eth0", &ds.netmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.default_router.s_addr != 0)
|
if (ds.default_router.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setdraddr("eth0", &ds.default_router);
|
netlib_set_dripv4addr("eth0", &ds.default_router);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.dnsaddr.s_addr != 0)
|
if (ds.dnsaddr.s_addr != 0)
|
||||||
|
@ -207,17 +207,17 @@ static void telnetd_netinit(void)
|
|||||||
/* Set up our host address */
|
/* Set up our host address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_TELNETD_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_TELNETD_IPADDR);
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_TELNETD_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_TELNETD_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_TELNETD_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_TELNETD_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -204,17 +204,17 @@ int thttp_main(int argc, char *argv[])
|
|||||||
|
|
||||||
printf("Setup network addresses\n");
|
printf("Setup network addresses\n");
|
||||||
addr.s_addr = HTONL(CONFIG_THTTPD_IPADDR);
|
addr.s_addr = HTONL(CONFIG_THTTPD_IPADDR);
|
||||||
netlib_sethostaddr(NET_DEVNAME, &addr);
|
netlib_set_ipv4addr(NET_DEVNAME, &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_THTTPD_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_THTTPD_DRIPADDR);
|
||||||
netlib_setdraddr(NET_DEVNAME, &addr);
|
netlib_set_dripv4addr(NET_DEVNAME, &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_THTTPD_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_THTTPD_NETMASK);
|
||||||
netlib_setnetmask(NET_DEVNAME, &addr);
|
netlib_set_ipv4netmask(NET_DEVNAME, &addr);
|
||||||
|
|
||||||
/* Initialize the NXFLAT binary loader */
|
/* Initialize the NXFLAT binary loader */
|
||||||
|
|
||||||
|
@ -75,17 +75,17 @@ int udp_main(int argc, char *argv[])
|
|||||||
/* Set up our host address */
|
/* Set up our host address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_UDP_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_UDP_IPADDR);
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_UDP_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_UDP_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_UDP_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_UDP_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_UDP_SERVER
|
#ifdef CONFIG_EXAMPLES_UDP_SERVER
|
||||||
recv_server();
|
recv_server();
|
||||||
|
@ -129,17 +129,17 @@ int webserver_main(int argc, char *argv[])
|
|||||||
#else
|
#else
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_WEBSERVER_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_WEBSERVER_IPADDR);
|
||||||
#endif
|
#endif
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_WEBSERVER_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_WEBSERVER_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_WEBSERVER_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_WEBSERVER_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_WEBSERVER_DHCPC
|
#ifdef CONFIG_EXAMPLES_WEBSERVER_DHCPC
|
||||||
/* Set up the resolver */
|
/* Set up the resolver */
|
||||||
@ -163,16 +163,16 @@ int webserver_main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
struct dhcpc_state ds;
|
struct dhcpc_state ds;
|
||||||
(void)dhcpc_request(handle, &ds);
|
(void)dhcpc_request(handle, &ds);
|
||||||
netlib_sethostaddr("eth0", &ds.ipaddr);
|
netlib_set_ipv4addr("eth0", &ds.ipaddr);
|
||||||
|
|
||||||
if (ds.netmask.s_addr != 0)
|
if (ds.netmask.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setnetmask("eth0", &ds.netmask);
|
netlib_set_ipv4netmask("eth0", &ds.netmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.default_router.s_addr != 0)
|
if (ds.default_router.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setdraddr("eth0", &ds.default_router);
|
netlib_set_dripv4addr("eth0", &ds.default_router);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.dnsaddr.s_addr != 0)
|
if (ds.dnsaddr.s_addr != 0)
|
||||||
|
@ -133,17 +133,17 @@ int wget_main(int argc, char *argv[])
|
|||||||
/* Set up our host address */
|
/* Set up our host address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_WGET_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_WGET_IPADDR);
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_WGET_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_WGET_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_WGET_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_WGET_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
|
|
||||||
/* Then start the server */
|
/* Then start the server */
|
||||||
|
|
||||||
|
@ -296,17 +296,17 @@ static int xmlrpc_netinit(void)
|
|||||||
#else
|
#else
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_XMLRPC_IPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_XMLRPC_IPADDR);
|
||||||
#endif
|
#endif
|
||||||
netlib_sethostaddr("eth0", &addr);
|
netlib_set_ipv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_XMLRPC_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_XMLRPC_DRIPADDR);
|
||||||
netlib_setdraddr("eth0", &addr);
|
netlib_set_dripv4addr("eth0", &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLES_XMLRPC_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLES_XMLRPC_NETMASK);
|
||||||
netlib_setnetmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_XMLRPC_DHCPC
|
#ifdef CONFIG_EXAMPLES_XMLRPC_DHCPC
|
||||||
/* Set up the resolver */
|
/* Set up the resolver */
|
||||||
@ -331,16 +331,16 @@ static int xmlrpc_netinit(void)
|
|||||||
{
|
{
|
||||||
struct dhcpc_state ds;
|
struct dhcpc_state ds;
|
||||||
(void)dhcpc_request(handle, &ds);
|
(void)dhcpc_request(handle, &ds);
|
||||||
netlib_sethostaddr("eth0", &ds.ipaddr);
|
netlib_set_ipv4addr("eth0", &ds.ipaddr);
|
||||||
|
|
||||||
if (ds.netmask.s_addr != 0)
|
if (ds.netmask.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setnetmask("eth0", &ds.netmask);
|
netlib_set_ipv4netmask("eth0", &ds.netmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.default_router.s_addr != 0)
|
if (ds.default_router.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setdraddr("eth0", &ds.default_router);
|
netlib_set_dripv4addr("eth0", &ds.default_router);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.dnsaddr.s_addr != 0)
|
if (ds.dnsaddr.s_addr != 0)
|
||||||
|
@ -112,16 +112,18 @@ int netlib_getmacaddr(FAR const char *ifname, uint8_t *macaddr);
|
|||||||
|
|
||||||
/* IP address support */
|
/* IP address support */
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
int netlib_get_ipv4addr(FAR const char *ifname, FAR struct in_addr *addr);
|
||||||
|
int netlib_set_ipv4addr(FAR const char *ifname, FAR const struct in_addr *addr);
|
||||||
|
int netlib_set_dripv4addr(FAR const char *ifname, FAR const struct in_addr *addr);
|
||||||
|
int netlib_set_ipv4netmask(FAR const char *ifname, FAR const struct in_addr *addr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
int netlib_gethostaddr(FAR const char *ifname, struct in6_addr *addr);
|
int netlib_get_ipv6addr(FAR const char *ifname, FAR struct in6_addr *addr);
|
||||||
int netlib_sethostaddr(FAR const char *ifname, const struct in6_addr *addr);
|
int netlib_set_ipv6addr(FAR const char *ifname, FAR const struct in6_addr *addr);
|
||||||
int netlib_setdraddr(FAR const char *ifname, const struct in6_addr *addr);
|
int netlib_set_dripv6addr(FAR const char *ifname, FAR const struct in6_addr *addr);
|
||||||
int netlib_setnetmask(FAR const char *ifname, const struct in6_addr *addr);
|
int netlib_set_ipv6netmask(FAR const char *ifname, FAR const struct in6_addr *addr);
|
||||||
#else
|
|
||||||
int netlib_gethostaddr(FAR const char *ifname, struct in_addr *addr);
|
|
||||||
int netlib_sethostaddr(FAR const char *ifname, const struct in_addr *addr);
|
|
||||||
int netlib_setdraddr(FAR const char *ifname, const struct in_addr *addr);
|
|
||||||
int netlib_setnetmask(FAR const char *ifname, const struct in_addr *addr);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* HTTP support */
|
/* HTTP support */
|
||||||
|
@ -447,7 +447,7 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
|
|||||||
/* Save the currently assigned IP address (should be INADDR_ANY) */
|
/* Save the currently assigned IP address (should be INADDR_ANY) */
|
||||||
|
|
||||||
oldaddr.s_addr = 0;
|
oldaddr.s_addr = 0;
|
||||||
netlib_gethostaddr("eth0", &oldaddr);
|
netlib_get_ipv4addr("eth0", &oldaddr);
|
||||||
|
|
||||||
/* Loop until we receive the lease (or an error occurs) */
|
/* Loop until we receive the lease (or an error occurs) */
|
||||||
|
|
||||||
@ -456,7 +456,7 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
|
|||||||
/* Set the IP address to INADDR_ANY. */
|
/* Set the IP address to INADDR_ANY. */
|
||||||
|
|
||||||
newaddr.s_addr = INADDR_ANY;
|
newaddr.s_addr = INADDR_ANY;
|
||||||
(void)netlib_sethostaddr("eth0", &newaddr);
|
(void)netlib_set_ipv4addr("eth0", &newaddr);
|
||||||
|
|
||||||
/* Loop sending DISCOVER until we receive an OFFER from a DHCP
|
/* Loop sending DISCOVER until we receive an OFFER from a DHCP
|
||||||
* server. We will lock on to the first OFFER and decline any
|
* server. We will lock on to the first OFFER and decline any
|
||||||
@ -495,7 +495,7 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
|
|||||||
* out of the loop.
|
* out of the loop.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(void)netlib_sethostaddr("eth0", &presult->ipaddr);
|
(void)netlib_set_ipv4addr("eth0", &presult->ipaddr);
|
||||||
state = STATE_HAVE_OFFER;
|
state = STATE_HAVE_OFFER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -587,7 +587,7 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult)
|
|||||||
{
|
{
|
||||||
/* An error other than a timeout was received */
|
/* An error other than a timeout was received */
|
||||||
|
|
||||||
(void)netlib_sethostaddr("eth0", &oldaddr);
|
(void)netlib_set_ipv4addr("eth0", &oldaddr);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# apps/netutils/netlib/Makefile
|
# apps/netutils/netlib/Makefile
|
||||||
#
|
#
|
||||||
# Copyright (C) 2011-2012, 2014 Gregory Nutt. All rights reserved.
|
# Copyright (C) 2011-2012, 2014-2015 Gregory Nutt. All rights reserved.
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@ -40,10 +40,21 @@ include $(APPDIR)/Make.defs
|
|||||||
# UIP Library
|
# UIP Library
|
||||||
|
|
||||||
ASRCS =
|
ASRCS =
|
||||||
CSRCS = netlib.c netlib_sethostaddr.c netlib_gethostaddr.c
|
CSRCS = netlib.c netlib_parsehttpurl.c
|
||||||
CSRCS += netlib_setdraddr.c netlib_setnetmask.c netlib_parsehttpurl.c
|
|
||||||
CSRCS += netlib_setifstatus.c netlib_getifstatus.c
|
CSRCS += netlib_setifstatus.c netlib_getifstatus.c
|
||||||
|
|
||||||
|
# IP address support
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_NET_IPv4),y)
|
||||||
|
CSRCS += netlib_setipv4addr.c netlib_getipv4addr.c
|
||||||
|
CSRCS += netlib_setdripv4addr.c netlib_setipv4netmask.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_NET_IPv6),y)
|
||||||
|
CSRCS += netlib_setipv6addr.c netlib_getipv6addr.c
|
||||||
|
CSRCS += netlib_setdripv6addr.c netlib_setipv6netmask.c
|
||||||
|
endif
|
||||||
|
|
||||||
# These require TCP support
|
# These require TCP support
|
||||||
|
|
||||||
ifeq ($(CONFIG_NET_TCP),y)
|
ifeq ($(CONFIG_NET_TCP),y)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* netutils/netlib/netlib_getifflag.c
|
* netutils/netlib/netlib_getifstatus.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011, 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011, 2014 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* netutils/netlib/netlib_gethostaddr.c
|
* netutils/netlib/netlib_getipv4addr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@ -61,7 +61,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: netlib_gethostaddr
|
* Name: netlib_get_ipv4addr
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Get the network driver IP address
|
* Get the network driver IP address
|
||||||
@ -76,9 +76,9 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
int netlib_gethostaddr(const char *ifname, struct in6_addr *addr)
|
int netlib_get_ipv4addr(const char *ifname, struct in6_addr *addr)
|
||||||
#else
|
#else
|
||||||
int netlib_gethostaddr(const char *ifname, struct in_addr *addr)
|
int netlib_get_ipv4addr(const char *ifname, struct in_addr *addr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* netutils/netlib/netlib_setdraddr.c
|
* netutils/netlib/netlib_setdripv4addr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@ -57,7 +57,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: netlib_setdraddr
|
* Name: netlib_set_dripv4addr
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set the default router IP address
|
* Set the default router IP address
|
||||||
@ -72,9 +72,9 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
int netlib_setdraddr(const char *ifname, const struct in6_addr *addr)
|
int netlib_set_dripv4addr(const char *ifname, const struct in6_addr *addr)
|
||||||
#else
|
#else
|
||||||
int netlib_setdraddr(const char *ifname, const struct in_addr *addr)
|
int netlib_set_dripv4addr(const char *ifname, const struct in_addr *addr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* netutils/netlib/netlib_sethostaddr.c
|
* netutils/netlib/netlib_setipv4addr.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@ -57,7 +57,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: netlib_sethostaddr
|
* Name: netlib_set_ipv4addr
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set the network driver IP address
|
* Set the network driver IP address
|
||||||
@ -72,9 +72,9 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
int netlib_sethostaddr(const char *ifname, const struct in6_addr *addr)
|
int netlib_set_ipv4addr(const char *ifname, const struct in6_addr *addr)
|
||||||
#else
|
#else
|
||||||
int netlib_sethostaddr(const char *ifname, const struct in_addr *addr)
|
int netlib_set_ipv4addr(const char *ifname, const struct in_addr *addr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* netutils/netlib/netlib_setnetmask.c
|
* netutils/netlib/netlib_setipv4netmask.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: netlib_setnetmask
|
* Name: netlib_set_ipv4netmask
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set the netmask
|
* Set the netmask
|
||||||
@ -71,9 +71,9 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
int netlib_setnetmask(const char *ifname, const struct in6_addr *addr)
|
int netlib_set_ipv4netmask(const char *ifname, const struct in6_addr *addr)
|
||||||
#else
|
#else
|
||||||
int netlib_setnetmask(const char *ifname, const struct in_addr *addr)
|
int netlib_set_ipv4netmask(const char *ifname, const struct in_addr *addr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
@ -732,7 +732,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||||||
gip = addr.s_addr = inet_addr(hostip);
|
gip = addr.s_addr = inet_addr(hostip);
|
||||||
}
|
}
|
||||||
|
|
||||||
netlib_sethostaddr(intf, &addr);
|
netlib_set_ipv4addr(intf, &addr);
|
||||||
|
|
||||||
/* Set gateway */
|
/* Set gateway */
|
||||||
|
|
||||||
@ -755,7 +755,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||||||
addr.s_addr = gip;
|
addr.s_addr = gip;
|
||||||
}
|
}
|
||||||
|
|
||||||
netlib_setdraddr(intf, &addr);
|
netlib_set_dripv4addr(intf, &addr);
|
||||||
|
|
||||||
/* Set network mask */
|
/* Set network mask */
|
||||||
|
|
||||||
@ -770,7 +770,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||||||
addr.s_addr = inet_addr("255.255.255.0");
|
addr.s_addr = inet_addr("255.255.255.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
netlib_setnetmask(intf, &addr);
|
netlib_set_ipv4netmask(intf, &addr);
|
||||||
|
|
||||||
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
|
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
|
||||||
if (dns)
|
if (dns)
|
||||||
@ -808,16 +808,16 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||||||
struct dhcpc_state ds;
|
struct dhcpc_state ds;
|
||||||
|
|
||||||
(void)dhcpc_request(handle, &ds);
|
(void)dhcpc_request(handle, &ds);
|
||||||
netlib_sethostaddr("eth0", &ds.ipaddr);
|
netlib_set_ipv4addr("eth0", &ds.ipaddr);
|
||||||
|
|
||||||
if (ds.netmask.s_addr != 0)
|
if (ds.netmask.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setnetmask("eth0", &ds.netmask);
|
netlib_set_ipv4netmask("eth0", &ds.netmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.default_router.s_addr != 0)
|
if (ds.default_router.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setdraddr("eth0", &ds.default_router);
|
netlib_set_dripv4addr("eth0", &ds.default_router);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.dnsaddr.s_addr != 0)
|
if (ds.dnsaddr.s_addr != 0)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* apps/nshlib/nsh_netinit.c
|
* apps/nshlib/nsh_netinit.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2012, 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2010-2012, 2014-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* This is influenced by similar logic from uIP:
|
* This is influenced by similar logic from uIP:
|
||||||
@ -184,6 +184,7 @@ static void nsh_netinit_configure(void)
|
|||||||
netlib_setmacaddr(NET_DEVNAME, mac);
|
netlib_setmacaddr(NET_DEVNAME, mac);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv4
|
||||||
/* Set up our host address */
|
/* Set up our host address */
|
||||||
|
|
||||||
#if !defined(CONFIG_NSH_DHCPC)
|
#if !defined(CONFIG_NSH_DHCPC)
|
||||||
@ -191,17 +192,22 @@ static void nsh_netinit_configure(void)
|
|||||||
#else
|
#else
|
||||||
addr.s_addr = 0;
|
addr.s_addr = 0;
|
||||||
#endif
|
#endif
|
||||||
netlib_sethostaddr(NET_DEVNAME, &addr);
|
netlib_set_ipv4addr(NET_DEVNAME, &addr);
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_NSH_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_NSH_DRIPADDR);
|
||||||
netlib_setdraddr(NET_DEVNAME, &addr);
|
netlib_set_dripv4addr(NET_DEVNAME, &addr);
|
||||||
|
|
||||||
/* Setup the subnet mask */
|
/* Setup the subnet mask */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_NSH_NETMASK);
|
addr.s_addr = HTONL(CONFIG_NSH_NETMASK);
|
||||||
netlib_setnetmask(NET_DEVNAME, &addr);
|
netlib_set_ipv4netmask(NET_DEVNAME, &addr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
# warning Missing logic
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
|
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
|
||||||
/* Set up the resolver */
|
/* Set up the resolver */
|
||||||
@ -230,16 +236,16 @@ static void nsh_netinit_configure(void)
|
|||||||
{
|
{
|
||||||
struct dhcpc_state ds;
|
struct dhcpc_state ds;
|
||||||
(void)dhcpc_request(handle, &ds);
|
(void)dhcpc_request(handle, &ds);
|
||||||
netlib_sethostaddr(NET_DEVNAME, &ds.ipaddr);
|
netlib_set_ipv4addr(NET_DEVNAME, &ds.ipaddr);
|
||||||
|
|
||||||
if (ds.netmask.s_addr != 0)
|
if (ds.netmask.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setnetmask(NET_DEVNAME, &ds.netmask);
|
netlib_set_ipv4netmask(NET_DEVNAME, &ds.netmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.default_router.s_addr != 0)
|
if (ds.default_router.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_setdraddr(NET_DEVNAME, &ds.default_router);
|
netlib_set_dripv4addr(NET_DEVNAME, &ds.default_router);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.dnsaddr.s_addr != 0)
|
if (ds.dnsaddr.s_addr != 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user