summaryrefslogtreecommitdiffstats
path: root/master/jmm/networking-bis
diff options
context:
space:
mode:
Diffstat (limited to 'master/jmm/networking-bis')
-rw-r--r--master/jmm/networking-bis57
1 files changed, 38 insertions, 19 deletions
diff --git a/master/jmm/networking-bis b/master/jmm/networking-bis
index 2752895..1045b4a 100644
--- a/master/jmm/networking-bis
+++ b/master/jmm/networking-bis
@@ -69,10 +69,10 @@ index 7714011..c3dbe12 100644
diff --git a/grub-core/fs/tftp.c b/grub-core/fs/tftp.c
new file mode 100644
-index 0000000..941c907
+index 0000000..01dbcb6
--- /dev/null
+++ b/grub-core/fs/tftp.c
-@@ -0,0 +1,504 @@
+@@ -0,0 +1,508 @@
+/* tftp.c - tftp filesystem */
+/*
+ * GRUB -- GRand Unified Bootloader
@@ -116,6 +116,8 @@ index 0000000..941c907
+#define TFTP_OP_ACK 4
+#define TFTP_OP_ERROR 5
+
++GRUB_MOD_LICENSE ("GPLv2+");
++
+static grub_dl_t my_mod;
+
+typedef struct __attribute__ ((packed))
@@ -225,7 +227,9 @@ index 0000000..941c907
+ }
+ if (!fd->buf)
+ {
++#if 0
+ grub_printf ("failed to realloc %d bytes\n", fd->buf_size);
++#endif
+ grub_millisleep (5000);
+ }
+
@@ -578,7 +582,7 @@ index 0000000..941c907
+ grub_fs_unregister (&grub_fs_tftp);
+}
diff --git a/grub-core/kern/device.c b/grub-core/kern/device.c
-index 3db14f5..13e4dee 100644
+index 3db14f5..2f02b83 100644
--- a/grub-core/kern/device.c
+++ b/grub-core/kern/device.c
@@ -30,6 +30,7 @@ grub_device_t
@@ -589,7 +593,7 @@ index 3db14f5..13e4dee 100644
grub_device_t dev = 0;
if (! name)
-@@ -48,7 +49,12 @@ grub_device_open (const char *name)
+@@ -48,15 +49,22 @@ grub_device_open (const char *name)
/* Try to open a disk. */
disk = grub_disk_open (name);
@@ -603,7 +607,9 @@ index 3db14f5..13e4dee 100644
goto fail;
dev->disk = disk;
-@@ -57,6 +63,8 @@ grub_device_open (const char *name)
+- dev->net = 0; /* FIXME */
++ dev->net = net;
+
return dev;
fail:
@@ -623,10 +629,10 @@ index 3db14f5..13e4dee 100644
diff --git a/grub-core/kern/net.c b/grub-core/kern/net.c
new file mode 100644
-index 0000000..49eecb5
+index 0000000..b0b6b5d
--- /dev/null
+++ b/grub-core/kern/net.c
-@@ -0,0 +1,1409 @@
+@@ -0,0 +1,1422 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2002,2003,2004,2006,2007,2008 Free Software Foundation, Inc.
@@ -665,8 +671,10 @@ index 0000000..49eecb5
+
+grub_udp_socket_t *udp_listeners = NULL;
+
++#if 0
+#undef grub_dprintf
+#define grub_dprintf(a,b...) grub_printf(b)
++#endif
+
+/*BYTE SEX*/
+static inline grub_uint16_t
@@ -1451,14 +1459,14 @@ index 0000000..49eecb5
+
+ opt++;
+
-+ memcpy (a, opt, GRUB_IPV4_ALEN);
++ grub_memcpy (a, opt, GRUB_IPV4_ALEN);
+}
+
+static grub_uint8_t *
+dhcp_add_generic_options (grub_uint8_t * optr, int dhcp_type)
+{
+ grub_uint8_t *lptr;
-+ memcpy (optr, &dhcp_magic_cookie, DHCP_MAGIC_COOKIE_LEN);
++ grub_memcpy (optr, &dhcp_magic_cookie, DHCP_MAGIC_COOKIE_LEN);
+ optr += DHCP_MAGIC_COOKIE_LEN;
+
+ *(optr++) = DHCP_OPTION_TAG_DHCP;
@@ -1506,9 +1514,9 @@ index 0000000..49eecb5
+/* May the lord be praised we finally have an ACK */
+/* Set all the rubbish */
+
-+ memcpy (net->dhcp_file, &an->file, sizeof (net->dhcp_file));
-+ memcpy (&net->tftp_addr, &an->siaddr, GRUB_IPV4_ALEN);
-+ memcpy (&net->my_addr, &an->yiaddr, GRUB_IPV4_ALEN);
++ grub_memcpy (net->dhcp_file, &an->file, sizeof (net->dhcp_file));
++ grub_memcpy (&net->tftp_addr, &an->siaddr, GRUB_IPV4_ALEN);
++ grub_memcpy (&net->my_addr, &an->yiaddr, GRUB_IPV4_ALEN);
+
+ dhcp_find_ip_option (an, len, DHCP_OPTION_SUBNET, &net->my_mask);
+ dhcp_find_ip_option (an, len, DHCP_OPTION_ROUTER, &net->my_router);
@@ -1544,7 +1552,7 @@ index 0000000..49eecb5
+
+ *(optr++) = DHCP_OPTION_REQUESTED_IP_ADDR;
+ *(optr++) = GRUB_IPV4_ALEN;
-+ memcpy (optr, &off->yiaddr, GRUB_IPV4_ALEN);
++ grub_memcpy (optr, &off->yiaddr, GRUB_IPV4_ALEN);
+ optr += 4;
+
+ *(optr++) = DHCP_OPTION_END;
@@ -1573,7 +1581,7 @@ index 0000000..49eecb5
+
+ dis->flags = grub_net_htons (DHCP_FLAGS_BROADCAST);
+
-+ memcpy (dis->chaddr, &net->my_eth_addr, GRUB_ETH_ALEN);
++ grub_memcpy (dis->chaddr, &net->my_eth_addr, GRUB_ETH_ALEN);
+
+ optr = dhcp_add_generic_options (dis->options, DHCP_MSG_TYPE_DISCOVER);
+ *(optr++) = DHCP_OPTION_END;
@@ -1788,11 +1796,13 @@ index 0000000..49eecb5
+{
+ grub_net_t net;
+ grub_net_dev_t dev;
++ grub_fs_t fs=find_tftp_fs();
+
-+ grub_dprintf ("net", "opening `%s'...\n", name);
++ if (!fs)
++ return 0;
+
+ if (net_blocked)
-+ return 0;
++ return NULL;
+
+ if (name && !grub_strcmp (name, "net"))
+ {
@@ -1808,6 +1818,7 @@ index 0000000..49eecb5
+ return net->has_failed ? NULL:net;
+ }
+ }
++
+ for (dev = grub_net_dev_list; dev; dev = dev->next)
+ {
+ int ret;
@@ -1816,7 +1827,7 @@ index 0000000..49eecb5
+
+ net = (grub_net_t) grub_malloc (sizeof (*net));
+ if (!net)
-+ return 0;
++ return NULL;
+
+
+ net->name = NULL;
@@ -1824,13 +1835,15 @@ index 0000000..49eecb5
+ net->is_running = 0;
+ net->is_up = 0;
+ net->has_failed = 0;
-+ net->fs = find_tftp_fs();
++ net->fs = fs;
+ grub_memcpy (&net->my_addr, &ip_broadcast, GRUB_IPV4_ALEN);
+
+ /*Try opening the name with this device sets net->name */
+ ret=dev->open (name, net);
+
-+ grub_dprintf ("net", "opening `%s' gave %d.\n", name, ret);
++#if 0
++ grub_dprintf ("net", "opening `%s' gave %d.\n", name, ret);
++#endif
+
+ if (ret!=GRUB_ERR_NONE) { /*There was a problem*/
+
@@ -1879,10 +1892,12 @@ index 0000000..49eecb5
+
+fail:
+
++#if 0
+ if (!net)
+ {
+ grub_dprintf ("net", "opening `%s' failed.\n", name);
+ }
++#endif
+
+ return net;
+}
@@ -1904,7 +1919,11 @@ index 0000000..49eecb5
+void
+grub_net_close (grub_net_t net)
+{
++#if 0
+ grub_dprintf ("net", "closing `%s'.\n", net->name);
++#else
++ (void) net;
++#endif
+
+ /* we don't actually close the network device as we're bound to want it later */
+}