* [U-Boot] [PATCH] A VLAN tagged DHCP request/discover is 4 bytes short
@ 2009-06-04 7:39 Norbert van Bolhuis
2009-06-15 7:05 ` Ben Warren
0 siblings, 1 reply; 2+ messages in thread
From: Norbert van Bolhuis @ 2009-06-04 7:39 UTC (permalink / raw)
To: u-boot
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.
diff --git a/net/bootp.c b/net/bootp.c
index 3dea70a..77057c6 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);
--
1.5.2.2
Signed-off-by: Norbert van Bolhuis <nvbolhuis@aimvalley.nl>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] A VLAN tagged DHCP request/discover is 4 bytes short
2009-06-04 7:39 [U-Boot] [PATCH] A VLAN tagged DHCP request/discover is 4 bytes short Norbert van Bolhuis
@ 2009-06-15 7:05 ` Ben Warren
0 siblings, 0 replies; 2+ messages in thread
From: Ben Warren @ 2009-06-15 7:05 UTC (permalink / raw)
To: u-boot
Norbert van Bolhuis wrote:
> 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.
>
> diff --git a/net/bootp.c b/net/bootp.c
> index 3dea70a..77057c6 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);
>
>
Applied to net repo.
thanks,
Ben
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-15 7:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-04 7:39 [U-Boot] [PATCH] A VLAN tagged DHCP request/discover is 4 bytes short Norbert van Bolhuis
2009-06-15 7:05 ` Ben Warren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox