43 |
#include <sys/uio.h> |
#include <sys/uio.h> |
44 |
#include <sys/socket.h> |
#include <sys/socket.h> |
45 |
|
|
46 |
#ifdef linux |
#if defined(linux) |
47 |
#include <sys/ioctl.h> |
#include <sys/ioctl.h> |
48 |
#include <linux/if.h> |
#include <linux/if.h> |
49 |
#include <linux/if_tun.h> |
#include <linux/if_tun.h> |
50 |
#define DEVTAP "/dev/net/tun" |
#define DEVTAP "/dev/net/tun" |
51 |
#else /* linux */ |
#define IFCONFIG_ARGS "tap0 inet %d.%d.%d.%d" |
52 |
|
|
53 |
|
#elif defined(openbsd) |
54 |
|
#define DEVTAP "/dev/tun0" |
55 |
|
#define IFCONFIG_ARGS "tun0 inet %d.%d.%d.%d link0" |
56 |
|
|
57 |
|
#else /* freebsd, cygwin? */ |
58 |
#define DEVTAP "/dev/tap0" |
#define DEVTAP "/dev/tap0" |
59 |
#endif /* linux */ |
#define IFCONFIG_ARGS "tap0 inet %d.%d.%d.%d" |
60 |
|
#endif |
61 |
|
|
62 |
#include "lwip/stats.h" |
#include "lwip/stats.h" |
63 |
#include "lwip/mem.h" |
#include "lwip/mem.h" |
120 |
} |
} |
121 |
#endif /* Linux */ |
#endif /* Linux */ |
122 |
|
|
123 |
snprintf(buf, sizeof(buf), "ifconfig tap0 inet %d.%d.%d.%d", |
snprintf(buf, sizeof(buf), "/sbin/ifconfig " IFCONFIG_ARGS, |
124 |
ip4_addr1(&(netif->gw)), |
ip4_addr1(&(netif->gw)), |
125 |
ip4_addr2(&(netif->gw)), |
ip4_addr2(&(netif->gw)), |
126 |
ip4_addr3(&(netif->gw)), |
ip4_addr3(&(netif->gw)), |
278 |
etharp_arp_input(netif, mintapif->ethaddr, p); |
etharp_arp_input(netif, mintapif->ethaddr, p); |
279 |
break; |
break; |
280 |
default: |
default: |
281 |
|
LWIP_ASSERT("p != NULL", p != NULL); |
282 |
pbuf_free(p); |
pbuf_free(p); |
283 |
break; |
break; |
284 |
} |
} |
310 |
mintapif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]); |
mintapif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]); |
311 |
|
|
312 |
low_level_init(netif); |
low_level_init(netif); |
313 |
|
|
314 |
|
return ERR_OK; |
315 |
} |
} |
316 |
/*-----------------------------------------------------------------------------------*/ |
/*-----------------------------------------------------------------------------------*/ |
317 |
enum mintapif_signal |
enum mintapif_signal |