summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert van Bolhuis <nvbolhuis@aimvalley.nl>2009-06-04 09:39:48 +0200
committerBen Warren <biggerbadderben@gmail.com>2009-06-15 00:13:55 -0700
commitc9a2aab1512fb2d132670fff9c27656d2eb949cd (patch)
tree113da0f42f7069aff49031f97c6ae3065125e109
parent6e0d2fc7fe0dcfa2f51ab8931d706940ee364193 (diff)
A VLAN tagged DHCP request/discover is 4 bytes short
The problem is that BOOTP_SIZE uses ETHER_HDR_SIZE which is 14 bytes. If sending a VLAN tagged frame (when env variable vlan is set) this should be VLAN_ETHER_HDR_SIZE=18 which is what NetSetEther returns. Signed-off-by: Norbert van Bolhuis <nvbolhuis@aimvalley.nl> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
-rw-r--r--net/bootp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/bootp.c b/net/bootp.c
index 3dea70aab0..77057c6c0a 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -687,7 +687,7 @@ BootpRequest (void)
* Calculate proper packet lengths taking into account the
* variable size of the options field
*/
- pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + ext_len;
+ pktlen = ((int)(pkt-NetTxPacket)) + BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + ext_len;
iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + ext_len;
NetSetIP(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
NetSetTimeout(SELECT_TIMEOUT, BootpTimeout);
@@ -860,7 +860,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)
NetCopyIP(&OfferedIP, &bp_offer->bp_yiaddr);
extlen = DhcpExtended((u8 *)bp->bp_vend, DHCP_REQUEST, NetDHCPServerIP, OfferedIP);
- pktlen = BOOTP_SIZE - sizeof(bp->bp_vend) + extlen;
+ pktlen = ((int)(pkt-NetTxPacket)) + BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen;
iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen;
NetSetIP(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);