diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 5c6aac608..0fc779966 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -136,6 +136,7 @@ grub_efinet_findcards (void)
card->driver = &efidriver;
card->flags = 0;
card->default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
+ card->mtu = net->mode->max_packet_size;
grub_memcpy (card->default_address.mac,
net->mode->current_address,
sizeof (card->default_address.mac));
diff --git a/grub-core/net/drivers/emu/emunet.c b/grub-core/net/drivers/emu/emunet.c
index d1e49a2f4..96f773340 100644
--- a/grub-core/net/drivers/emu/emunet.c
+++ b/grub-core/net/drivers/emu/emunet.c
@@ -1,3 +1,20 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2010,2011 Free Software Foundation, Inc.
+ *
+ * GRUB is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GRUB is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GRUB. If not, see .
+ */
#include
#include
@@ -52,6 +69,7 @@ static struct grub_net_card emucard =
{
.name = "emu0",
.driver = &emudriver,
+ .mtu = 1500,
.default_address = {
.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET,
{.mac = {0, 1, 2, 3, 4, 5}}
diff --git a/grub-core/net/drivers/i386/pc/pxe.c b/grub-core/net/drivers/i386/pc/pxe.c
index cd598ea72..588673177 100644
--- a/grub-core/net/drivers/i386/pc/pxe.c
+++ b/grub-core/net/drivers/i386/pc/pxe.c
@@ -345,6 +345,7 @@ GRUB_MOD_INIT(pxe)
if (i == sizeof (grub_pxe_card.default_address.mac))
grub_memcpy (grub_pxe_card.default_address.mac, ui->permanent_addr,
sizeof (grub_pxe_card.default_address.mac));
+ grub_pxe_card.mtu = ui->mtu;
grub_pxe_card.default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
index 20d45ee3d..035a96220 100644
--- a/grub-core/net/drivers/ieee1275/ofnet.c
+++ b/grub-core/net/drivers/ieee1275/ofnet.c
@@ -28,7 +28,6 @@ struct grub_ofnetcard_data
{
char *path;
grub_ieee1275_ihandle_t handle;
- grub_uint32_t mtu;
};
static grub_err_t
@@ -85,7 +84,7 @@ get_card_packet (const struct grub_net_card *dev, struct grub_net_buff *nb)
grub_netbuff_clear (nb);
start_time = grub_get_time_ms ();
do
- rc = grub_ieee1275_read (data->handle, nb->data, data->mtu, &actual);
+ rc = grub_ieee1275_read (data->handle, nb->data, dev->mtu, &actual);
while ((actual <= 0 || rc < 0) && (grub_get_time_ms () - start_time < 200));
if (actual)
{
@@ -228,12 +227,15 @@ grub_ofnet_findcards (void)
grub_ieee1275_finddevice (ofdata->path, &devhandle);
- if (grub_ieee1275_get_integer_property
- (devhandle, "max-frame-size", &(ofdata->mtu),
- sizeof (ofdata->mtu), 0))
- {
- ofdata->mtu = 1500;
- }
+ {
+ grub_uint32_t t;
+ if (grub_ieee1275_get_integer_property (devhandle,
+ "max-frame-size", &t,
+ sizeof (t), 0))
+ card->mtu = 1500;
+ else
+ card->mtu = t;
+ }
if (grub_ieee1275_get_property (devhandle, "mac-address",
&(lla.mac), 6, 0)
diff --git a/include/grub/net.h b/include/grub/net.h
index f6600690a..f3c0489e2 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -97,6 +97,7 @@ struct grub_net_card
int opened;
unsigned idle_poll_delay_ms;
grub_uint64_t last_poll;
+ grub_size_t mtu;
union
{
#ifdef GRUB_MACHINE_EFI