Print out interface address

This commit is contained in:
adamdunkels 2008-03-03 20:21:59 +00:00
parent 39c85118d8
commit 136443a387
2 changed files with 8 additions and 3 deletions

View file

@ -35,7 +35,7 @@
*
* This file is part of the Contiki desktop OS
*
* $Id: contiki-conf.h,v 1.8 2008/01/24 23:09:40 adamdunkels Exp $
* $Id: contiki-conf.h,v 1.9 2008/03/03 20:21:59 adamdunkels Exp $
*
*/
@ -110,6 +110,8 @@ typedef unsigned long clock_time_t;
#define RIMEBUF_CONF_SIZE 128
#define RIMEBUF_CONF_HDR_SIZE 32
#define UIP_CONF_UIP_IP4ADDR_T_WITH_U32 1
#define UIP_CONF_ICMP_DEST_UNREACH 1
#define UIP_CONF_MAX_CONNECTIONS 40

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: contiki-main.c,v 1.28 2008/02/10 22:38:21 oliverschmidt Exp $
* $Id: contiki-main.c,v 1.29 2008/03/03 20:21:59 adamdunkels Exp $
*/
#include "contiki.h"
@ -137,11 +137,14 @@ contiki_main(int flag)
process_start(&wpcap_process, NULL);
{
char buf[1024];
uip_ipaddr_t ifaddr;
ifaddr.u32[0] = inet_addr(__argv[1]);
snprintf(buf, sizeof(buf), "route add %d.%d.%d.%d mask %d.%d.%d.%d %d.%d.%d.%d",
uip_ipaddr_to_quad(&meshif.ipaddr),
uip_ipaddr_to_quad(&meshif.netmask),
uip_ipaddr_to_quad(&uip_hostaddr));
uip_ipaddr_to_quad(&ifaddr));
printf("%s\n", buf);
system(buf);
signal(SIGTERM, remove_route);