if (using_rootfs) {
strcat(real_cmdline, " root=/dev/root rw rootflags=rw,trans=virtio,version=9p2000.L rootfstype=9p");
if (custom_rootfs)
- strcat(real_cmdline, " init=/virt/init");
+ strcat(real_cmdline, " init=/virt/init ip=dhcp");
} else if (!strstr(real_cmdline, "root=")) {
strlcat(real_cmdline, " root=/dev/vda rw ", sizeof(real_cmdline));
}
do_mounts();
- puts("Setting up network...");
-
- system("/bin/sh virt/setnet.sh");
-
puts("Starting '/bin/sh'...");
run_process("/bin/sh");
+++ /dev/null
-for f in /sys/class/net/*; do
- type=`cat $f/type`
- if [ $type -eq 1 ]; then
- f=${f#/sys/class/net/}
-
- eval "dhcpcd -A $f 2> /dev/null"
- if [ $? -eq 0 ]; then
- exit
- fi
-
- eval "dhclient $f 2> /dev/null"
- if [ $? -eq 0 ]; then
- exit
- fi
-
- ifconfig $f 192.168.33.15
- route add default 192.168.33.1
- echo "nameserver 8.8.8.8" >> /etc/resolv.conf
-
- exit
- fi
-done
#define UIP_DHCP_TAG_SUBMASK_LEN 4
#define UIP_DHCP_TAG_ROUTER 3
#define UIP_DHCP_TAG_ROUTER_LEN 4
+#define UIP_DHCP_TAG_ROOT 17
+#define UIP_DHCP_TAG_ROOT_LEN 4
#define UIP_DHCP_TAG_DNS_SERVER 6
#define UIP_DHCP_TAG_DNS_SERVER_LEN 4
#define UIP_DHCP_TAG_DOMAIN_NAME 15
#include <arpa/inet.h>
+#define EMPTY_ADDR "0.0.0.0"
+
static inline bool uip_dhcp_is_discovery(struct uip_dhcp *dhcp)
{
return (dhcp->option[2] == UIP_DHCP_DISCOVER &&
*addr = htonl(info->host_ip);
i += UIP_DHCP_TAG_ROUTER_LEN;
+ opt[i++] = UIP_DHCP_TAG_ROOT;
+ opt[i++] = strlen(EMPTY_ADDR);
+ addr = (u32 *)&opt[i];
+ strncpy((void *) addr, EMPTY_ADDR, strlen(EMPTY_ADDR));
+ i += strlen(EMPTY_ADDR);
+
i = uip_dhcp_fill_option_name_and_server(info, opt, i);
opt[i++] = UIP_DHCP_TAG_END;