From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Warren Date: Mon, 15 Jun 2009 00:05:25 -0700 Subject: [U-Boot] [PATCH] A VLAN tagged DHCP request/discover is 4 bytes short In-Reply-To: <200906040739.n547dmZP002512@linpc062.aimsys.nl> References: <200906040739.n547dmZP002512@linpc062.aimsys.nl> Message-ID: <4A35F2B5.8030403@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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