* 6 should be 4 in size of DHCP messages.

* -w option to sysctl.
This commit is contained in:
bg- 2007-05-02 08:58:00 +00:00
parent 948a88d9e6
commit cca02a05ed

View file

@ -28,7 +28,7 @@
* *
* This file is part of the uIP TCP/IP stack. * This file is part of the uIP TCP/IP stack.
* *
* $Id: tunslip.c,v 1.12 2007/04/30 12:28:29 bg- Exp $ * $Id: tunslip.c,v 1.13 2007/05/02 08:58:00 bg- Exp $
* *
*/ */
@ -279,7 +279,7 @@ relay_dhcp_to_client(int slipfd)
case DHCP_OPTION_DNS_SERVER: /* Only copy first server */ case DHCP_OPTION_DNS_SERVER: /* Only copy first server */
*t++ = p[0]; *t++ = p[0];
*t++ = 6; *t++ = 4;
memcpy(t, p + 2, 4); t += 4; memcpy(t, p + 2, 4); t += 4;
p += p[1] + 2; p += p[1] + 2;
break; break;
@ -791,7 +791,7 @@ cleanup(void)
{ {
ssystem("ifconfig %s down", tundev); ssystem("ifconfig %s down", tundev);
#ifndef linux #ifndef linux
ssystem("sysctl net.inet.ip.forwarding=0"); ssystem("sysctl -w net.inet.ip.forwarding=0");
#endif #endif
/* ssystem("arp -d %s", ipaddr); */ /* ssystem("arp -d %s", ipaddr); */
ssystem("netstat -nr" ssystem("netstat -nr"
@ -840,15 +840,11 @@ ifconf(const char *tundev, const char *ipaddr, const char *netmask)
ssystem("route add -net %s netmask %s dev %s", ssystem("route add -net %s netmask %s dev %s",
inet_ntoa(netname), netmask, tundev); inet_ntoa(netname), netmask, tundev);
#else #else
#ifdef mac_something
ssystem("ifconfig %s inet `hostname` %s up", tundev, ipaddr); ssystem("ifconfig %s inet `hostname` %s up", tundev, ipaddr);
#else
ssystem("ifconfig %s inet `hostname` %s up", tundev, ipaddr);
#endif
if (strcmp(ipaddr, "0.0.0.0") != 0) if (strcmp(ipaddr, "0.0.0.0") != 0)
ssystem("route add -net %s -netmask %s -interface %s", ssystem("route add -net %s -netmask %s -interface %s",
inet_ntoa(netname), netmask, tundev); inet_ntoa(netname), netmask, tundev);
ssystem("sysctl net.inet.ip.forwarding=1"); ssystem("sysctl -w net.inet.ip.forwarding=1");
#endif /* !linux */ #endif /* !linux */
ssystem("ifconfig %s\n", tundev); ssystem("ifconfig %s\n", tundev);