From a1ca06cfccf89194a3005e5aaa04fb5068e893ae Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sat, 30 Jan 2010 14:16:47 +0000 Subject: [PATCH] Fixed unix port after recent changes --- ports/unix/proj/lib/Makefile | 7 +++--- ports/unix/proj/minimal/Makefile | 2 +- ports/unix/proj/minimal/lwip_prvmib.c | 2 +- ports/unix/proj/minimal/main.c | 33 ++++++++++----------------- ports/unix/proj/minimal/private_mib.h | 2 +- ports/unix/proj/unixsim/Makefile | 2 +- 6 files changed, 20 insertions(+), 28 deletions(-) diff --git a/ports/unix/proj/lib/Makefile b/ports/unix/proj/lib/Makefile index dcffa2b..609cfbb 100644 --- a/ports/unix/proj/lib/Makefile +++ b/ports/unix/proj/lib/Makefile @@ -48,11 +48,12 @@ CFLAGS:=$(CFLAGS) \ # COREFILES, CORE4FILES: The minimum set of files needed for lwIP. COREFILES=$(LWIPDIR)/core/mem.c $(LWIPDIR)/core/memp.c $(LWIPDIR)/core/netif.c \ $(LWIPDIR)/core/pbuf.c $(LWIPDIR)/core/stats.c $(LWIPDIR)/core/sys.c \ - $(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_in.c \ - $(LWIPDIR)/core/tcp_out.c $(LWIPDIR)/core/udp.c $(LWIPDIR)/core/init.c + $(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_in.c $(LWIPDIR)/core/raw.c \ + $(LWIPDIR)/core/tcp_out.c $(LWIPDIR)/core/udp.c $(LWIPDIR)/core/init.c \ + $(LWIPDIR)/core/def.c $(LWIPDIR)/core/timers.c CORE4FILES=$(LWIPDIR)/core/ipv4/icmp.c $(LWIPDIR)/core/ipv4/ip.c \ $(LWIPDIR)/core/ipv4/inet.c $(LWIPDIR)/core/ipv4/ip_addr.c \ - $(LWIPDIR)/core/ipv4/inet_chksum.c + $(LWIPDIR)/core/ipv4/inet_chksum.c # APIFILES: The files which implement the sequential and socket APIs. diff --git a/ports/unix/proj/minimal/Makefile b/ports/unix/proj/minimal/Makefile index 32dfc0b..9f41b73 100644 --- a/ports/unix/proj/minimal/Makefile +++ b/ports/unix/proj/minimal/Makefile @@ -55,7 +55,7 @@ COREFILES=$(LWIPDIR)/core/mem.c $(LWIPDIR)/core/memp.c $(LWIPDIR)/core/netif.c \ $(LWIPDIR)/core/stats.c $(LWIPDIR)/core/sys.c \ $(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_in.c \ $(LWIPDIR)/core/tcp_out.c $(LWIPDIR)/core/udp.c $(LWIPDIR)/core/dhcp.c \ - $(LWIPDIR)/core/init.c $(LWIPDIR)/core/timers.c + $(LWIPDIR)/core/init.c $(LWIPDIR)/core/timers.c $(LWIPDIR)/core/def.c CORE4FILES=$(LWIPDIR)/core/ipv4/icmp.c $(LWIPDIR)/core/ipv4/ip.c \ $(LWIPDIR)/core/ipv4/inet.c $(LWIPDIR)/core/ipv4/ip_addr.c \ $(LWIPDIR)/core/ipv4/ip_frag.c $(LWIPDIR)/core/ipv4/inet_chksum.c diff --git a/ports/unix/proj/minimal/lwip_prvmib.c b/ports/unix/proj/minimal/lwip_prvmib.c index 33ac25c..0430956 100644 --- a/ports/unix/proj/minimal/lwip_prvmib.c +++ b/ports/unix/proj/minimal/lwip_prvmib.c @@ -212,7 +212,7 @@ const struct mib_array_node enterprises = { /* private .1.3.6.1.4 */ const s32_t private_ids[1] = { 1 }; struct mib_node* const private_nodes[1] = { (struct mib_node* const)&enterprises }; -const struct mib_array_node private = { +const struct mib_array_node mib_private = { &noleafs_get_object_def, &noleafs_get_value, &noleafs_set_test, diff --git a/ports/unix/proj/minimal/main.c b/ports/unix/proj/minimal/main.c index e3ab281..0bb5963 100644 --- a/ports/unix/proj/minimal/main.c +++ b/ports/unix/proj/minimal/main.c @@ -109,7 +109,6 @@ main(int argc, char **argv) { struct netif netif; sigset_t mask, oldmask, empty; - struct in_addr inaddr; int ch; char ip_str[16] = {0}, nm_str[16] = {0}, gw_str[16] = {0}; @@ -132,26 +131,21 @@ main(int argc, char **argv) exit(0); break; case 'g': - inet_aton(optarg, &inaddr); - gw.addr = inaddr.s_addr; + ipaddr_aton(optarg, &gw); break; case 'i': - inet_aton(optarg, &inaddr); - ipaddr.addr = inaddr.s_addr; + ipaddr_aton(optarg, &ipaddr); break; case 'm': - inet_aton(optarg, &inaddr); - netmask.addr = inaddr.s_addr; + ipaddr_aton(optarg, &netmask); break; case 't': trap_flag = !0; /* @todo: remove this authentraps tweak when we have proper SET & non-volatile mem */ snmpauthentraps_set = 1; - inet_aton(optarg, &inaddr); - /* lwip inet.h oddity workaround */ - trap_addr.addr = inaddr.s_addr; - strncpy(ip_str,inet_ntoa(inaddr),sizeof(ip_str)); + ipaddr_aton(optarg, &trap_addr); + strncpy(ip_str, ipaddr_ntoa(&trap_addr),sizeof(ip_str)); printf("SNMP trap destination %s\n", ip_str); break; default: @@ -161,16 +155,13 @@ main(int argc, char **argv) } argc -= optind; argv += optind; - - inaddr.s_addr = ipaddr.addr; - strncpy(ip_str,inet_ntoa(inaddr),sizeof(ip_str)); - inaddr.s_addr = netmask.addr; - strncpy(nm_str,inet_ntoa(inaddr),sizeof(nm_str)); - inaddr.s_addr = gw.addr; - strncpy(gw_str,inet_ntoa(inaddr),sizeof(gw_str)); + + strncpy(ip_str, ipaddr_ntoa(&ipaddr), sizeof(ip_str)); + strncpy(nm_str, ipaddr_ntoa(&netmask), sizeof(nm_str)); + strncpy(gw_str, ipaddr_ntoa(&gw), sizeof(gw_str)); printf("Host at %s mask %s gateway %s\n", ip_str, nm_str, gw_str); - + #ifdef PERF perf_init("/tmp/minimal.perf"); #endif /* PERF */ @@ -178,7 +169,7 @@ main(int argc, char **argv) lwip_init(); printf("TCP/IP initialized.\n"); - + netif_add(&netif, &ipaddr, &netmask, &gw, NULL, mintapif_init, ethernet_input); netif_set_default(&netif); netif_set_up(&netif); @@ -196,7 +187,7 @@ main(int argc, char **argv) snmp_init(); echo_init(); - + timer_init(); timer_set_interval(TIMER_EVT_ETHARPTMR, ARP_TMR_INTERVAL / 10); timer_set_interval(TIMER_EVT_TCPTMR, TCP_TMR_INTERVAL / 10); diff --git a/ports/unix/proj/minimal/private_mib.h b/ports/unix/proj/minimal/private_mib.h index 6609c98..2adbabe 100644 --- a/ports/unix/proj/minimal/private_mib.h +++ b/ports/unix/proj/minimal/private_mib.h @@ -11,7 +11,7 @@ #if LWIP_SNMP #include "lwip/snmp_structs.h" -extern const struct mib_array_node private; +extern const struct mib_array_node mib_private; /** @todo remove this?? */ struct private_msg diff --git a/ports/unix/proj/unixsim/Makefile b/ports/unix/proj/unixsim/Makefile index 8d85c87..b9431a1 100644 --- a/ports/unix/proj/unixsim/Makefile +++ b/ports/unix/proj/unixsim/Makefile @@ -56,7 +56,7 @@ COREFILES=$(LWIPDIR)/core/mem.c $(LWIPDIR)/core/memp.c $(LWIPDIR)/core/netif.c \ $(LWIPDIR)/core/pbuf.c $(LWIPDIR)/core/raw.c $(LWIPDIR)/core/stats.c \ $(LWIPDIR)/core/sys.c $(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_in.c \ $(LWIPDIR)/core/tcp_out.c $(LWIPDIR)/core/udp.c $(LWIPDIR)/core/dhcp.c \ - $(LWIPDIR)/core/init.c $(LWIPDIR)/core/timers.c + $(LWIPDIR)/core/init.c $(LWIPDIR)/core/timers.c $(LWIPDIR)/core/def.c CORE4FILES=$(wildcard $(LWIPDIR)/core/ipv4/*.c) $(LWIPDIR)/core/ipv4/inet.c \ $(LWIPDIR)/core/ipv4/inet_chksum.c