* [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() @ 2016-08-18 5:38 Jiaxin Wu 2016-08-18 5:41 ` Wu, Jiaxin 2016-09-06 1:02 ` Fu, Siyuan 0 siblings, 2 replies; 10+ messages in thread From: Jiaxin Wu @ 2016-08-18 5:38 UTC (permalink / raw) To: edk2-devel; +Cc: Santhapur Naveen, Ye Ting, Fu Siyuan The IP address should not be treated as classful one if DHCP options contain a classless IP with its true subnet mask. Otherwise, DHCPv4 TransmitReceive() will failed. This real subnet mask will be parsed and recorded in DhcpSb->Netmask. So, we need check it before get the IP's corresponding subnet mask. Cc: Santhapur Naveen <naveens@amiindia.co.in> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> --- .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 +++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c index 4f491b4..79f7cde 100644 --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c @@ -1,9 +1,9 @@ /** @file This file implement the EFI_DHCP4_PROTOCOL interface. -Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -1186,18 +1186,20 @@ Dhcp4InstanceConfigUdpIo ( IN UDP_IO *UdpIo, IN VOID *Context ) { DHCP_PROTOCOL *Instance; + DHCP_SERVICE *DhcpSb; EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token; EFI_UDP4_CONFIG_DATA UdpConfigData; IP4_ADDR ClientAddr; IP4_ADDR Ip; INTN Class; IP4_ADDR SubnetMask; Instance = (DHCP_PROTOCOL *) Context; + DhcpSb = Instance->Service; Token = Instance->Token; ZeroMem (&UdpConfigData, sizeof (EFI_UDP4_CONFIG_DATA)); UdpConfigData.AcceptBroadcast = TRUE; @@ -1206,14 +1208,19 @@ Dhcp4InstanceConfigUdpIo ( UdpConfigData.DoNotFragment = TRUE; ClientAddr = EFI_NTOHL (Token->Packet->Dhcp4.Header.ClientAddr); Ip = HTONL (ClientAddr); CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof (EFI_IPv4_ADDRESS)); - - Class = NetGetIpClass (ClientAddr); - ASSERT (Class < IP4_ADDR_CLASSE); - SubnetMask = gIp4AllMasks[Class << 3]; + + if (DhcpSb->Netmask == 0) { + Class = NetGetIpClass (ClientAddr); + ASSERT (Class < IP4_ADDR_CLASSE); + SubnetMask = gIp4AllMasks[Class << 3]; + } else { + SubnetMask = DhcpSb->Netmask; + } + Ip = HTONL (SubnetMask); CopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof (EFI_IPv4_ADDRESS)); if ((Token->ListenPointCount == 0) || (Token->ListenPoints[0].ListenPort == 0)) { UdpConfigData.StationPort = DHCP_CLIENT_PORT; @@ -1574,16 +1581,21 @@ EfiDhcp4TransmitReceive ( EndPoint.RemotePort = DHCP_SERVER_PORT; } else { EndPoint.RemotePort = Token->RemotePort; } + if (DhcpSb->Netmask == 0) { + Class = NetGetIpClass (ClientAddr); + ASSERT (Class < IP4_ADDR_CLASSE); + SubnetMask = gIp4AllMasks[Class << 3]; + } else { + SubnetMask = DhcpSb->Netmask; + } + // // Get the gateway. // - Class = NetGetIpClass (ClientAddr); - ASSERT (Class < IP4_ADDR_CLASSE); - SubnetMask = gIp4AllMasks[Class << 3]; ZeroMem (&Gateway, sizeof (Gateway)); if (!IP4_NET_EQUAL (ClientAddr, EndPoint.RemoteAddr.Addr[0], SubnetMask)) { CopyMem (&Gateway.v4, &Token->GatewayAddress, sizeof (EFI_IPv4_ADDRESS)); Gateway.Addr[0] = NTOHL (Gateway.Addr[0]); } -- 1.9.5.msysgit.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() 2016-08-18 5:38 [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Jiaxin Wu @ 2016-08-18 5:41 ` Wu, Jiaxin 2016-08-18 5:43 ` Santhapur Naveen ` (2 more replies) 2016-09-06 1:02 ` Fu, Siyuan 1 sibling, 3 replies; 10+ messages in thread From: Wu, Jiaxin @ 2016-08-18 5:41 UTC (permalink / raw) To: Santhapur Naveen, Wu, Jiaxin, edk2-devel@lists.01.org Cc: Ye, Ting, Fu, Siyuan, Sivaraman Nainar, Madhan B. Santharam Naveen, Can you help to verify this patch to support the classless IP. Thanks, Jiaxin > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Jiaxin Wu > Sent: Thursday, August 18, 2016 1:39 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; > Santhapur Naveen <naveens@amiindia.co.in> > Subject: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 > TransmitReceive() > > The IP address should not be treated as classful one if DHCP options contain a > classless IP with its true subnet mask. Otherwise, DHCPv4 > TransmitReceive() will failed. This real subnet mask will be parsed and > recorded in DhcpSb->Netmask. So, we need check it before get the IP's > corresponding subnet mask. > > Cc: Santhapur Naveen <naveens@amiindia.co.in> > Cc: Ye Ting <ting.ye@intel.com> > Cc: Fu Siyuan <siyuan.fu@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> > --- > .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 +++++++++++++++- > ------ > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > index 4f491b4..79f7cde 100644 > --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > @@ -1,9 +1,9 @@ > /** @file > This file implement the EFI_DHCP4_PROTOCOL interface. > > -Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> > +Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> > This program and the accompanying materials are licensed and made > available under the terms and conditions of the BSD License which > accompanies this distribution. The full text of the license may be found at > http://opensource.org/licenses/bsd-license.php > > @@ -1186,18 +1186,20 @@ Dhcp4InstanceConfigUdpIo ( > IN UDP_IO *UdpIo, > IN VOID *Context > ) > { > DHCP_PROTOCOL *Instance; > + DHCP_SERVICE *DhcpSb; > EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token; > EFI_UDP4_CONFIG_DATA UdpConfigData; > IP4_ADDR ClientAddr; > IP4_ADDR Ip; > INTN Class; > IP4_ADDR SubnetMask; > > Instance = (DHCP_PROTOCOL *) Context; > + DhcpSb = Instance->Service; > Token = Instance->Token; > > ZeroMem (&UdpConfigData, sizeof (EFI_UDP4_CONFIG_DATA)); > > UdpConfigData.AcceptBroadcast = TRUE; > @@ -1206,14 +1208,19 @@ Dhcp4InstanceConfigUdpIo ( > UdpConfigData.DoNotFragment = TRUE; > > ClientAddr = EFI_NTOHL (Token->Packet->Dhcp4.Header.ClientAddr); > Ip = HTONL (ClientAddr); > CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof > (EFI_IPv4_ADDRESS)); > - > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > + > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > Ip = HTONL (SubnetMask); > CopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof > (EFI_IPv4_ADDRESS)); > > if ((Token->ListenPointCount == 0) || (Token->ListenPoints[0].ListenPort > == 0)) { > UdpConfigData.StationPort = DHCP_CLIENT_PORT; @@ -1574,16 +1581,21 > @@ EfiDhcp4TransmitReceive ( > EndPoint.RemotePort = DHCP_SERVER_PORT; > } else { > EndPoint.RemotePort = Token->RemotePort; > } > > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > // > // Get the gateway. > // > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > ZeroMem (&Gateway, sizeof (Gateway)); > if (!IP4_NET_EQUAL (ClientAddr, EndPoint.RemoteAddr.Addr[0], > SubnetMask)) { > CopyMem (&Gateway.v4, &Token->GatewayAddress, sizeof > (EFI_IPv4_ADDRESS)); > Gateway.Addr[0] = NTOHL (Gateway.Addr[0]); > } > -- > 1.9.5.msysgit.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() 2016-08-18 5:41 ` Wu, Jiaxin @ 2016-08-18 5:43 ` Santhapur Naveen 2016-09-02 6:16 ` Santhapur Naveen 2016-10-14 7:18 ` Santhapur Naveen 2 siblings, 0 replies; 10+ messages in thread From: Santhapur Naveen @ 2016-08-18 5:43 UTC (permalink / raw) To: Wu, Jiaxin, edk2-devel@lists.01.org Cc: Ye, Ting, Fu, Siyuan, Sivaraman Nainar, Madhan B. Santharam Jiaxin, We will verify the patch and update you the result. Thanks, Naveen -----Original Message----- From: Wu, Jiaxin [mailto:jiaxin.wu@intel.com] Sent: Thursday, August 18, 2016 11:12 AM To: Santhapur Naveen; Wu, Jiaxin; edk2-devel@lists.01.org Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Naveen, Can you help to verify this patch to support the classless IP. Thanks, Jiaxin > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Jiaxin Wu > Sent: Thursday, August 18, 2016 1:39 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; > Santhapur Naveen <naveens@amiindia.co.in> > Subject: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 > TransmitReceive() > > The IP address should not be treated as classful one if DHCP options > contain a classless IP with its true subnet mask. Otherwise, DHCPv4 > TransmitReceive() will failed. This real subnet mask will be parsed > and recorded in DhcpSb->Netmask. So, we need check it before get the > IP's corresponding subnet mask. > > Cc: Santhapur Naveen <naveens@amiindia.co.in> > Cc: Ye Ting <ting.ye@intel.com> > Cc: Fu Siyuan <siyuan.fu@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> > --- > .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 +++++++++++++++- > ------ > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > index 4f491b4..79f7cde 100644 > --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > @@ -1,9 +1,9 @@ > /** @file > This file implement the EFI_DHCP4_PROTOCOL interface. > > -Copyright (c) 2006 - 2015, Intel Corporation. All rights > reserved.<BR> > +Copyright (c) 2006 - 2016, Intel Corporation. All rights > +reserved.<BR> > This program and the accompanying materials are licensed and made > available under the terms and conditions of the BSD License which > accompanies this distribution. The full text of the license may be > found at http://opensource.org/licenses/bsd-license.php > > @@ -1186,18 +1186,20 @@ Dhcp4InstanceConfigUdpIo ( > IN UDP_IO *UdpIo, > IN VOID *Context > ) > { > DHCP_PROTOCOL *Instance; > + DHCP_SERVICE *DhcpSb; > EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token; > EFI_UDP4_CONFIG_DATA UdpConfigData; > IP4_ADDR ClientAddr; > IP4_ADDR Ip; > INTN Class; > IP4_ADDR SubnetMask; > > Instance = (DHCP_PROTOCOL *) Context; > + DhcpSb = Instance->Service; > Token = Instance->Token; > > ZeroMem (&UdpConfigData, sizeof (EFI_UDP4_CONFIG_DATA)); > > UdpConfigData.AcceptBroadcast = TRUE; > @@ -1206,14 +1208,19 @@ Dhcp4InstanceConfigUdpIo ( > UdpConfigData.DoNotFragment = TRUE; > > ClientAddr = EFI_NTOHL (Token->Packet->Dhcp4.Header.ClientAddr); > Ip = HTONL (ClientAddr); > CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof > (EFI_IPv4_ADDRESS)); > - > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > + > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > Ip = HTONL (SubnetMask); > CopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof > (EFI_IPv4_ADDRESS)); > > if ((Token->ListenPointCount == 0) || > (Token->ListenPoints[0].ListenPort > == 0)) { > UdpConfigData.StationPort = DHCP_CLIENT_PORT; @@ -1574,16 > +1581,21 @@ EfiDhcp4TransmitReceive ( > EndPoint.RemotePort = DHCP_SERVER_PORT; > } else { > EndPoint.RemotePort = Token->RemotePort; > } > > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > // > // Get the gateway. > // > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > ZeroMem (&Gateway, sizeof (Gateway)); > if (!IP4_NET_EQUAL (ClientAddr, EndPoint.RemoteAddr.Addr[0], > SubnetMask)) { > CopyMem (&Gateway.v4, &Token->GatewayAddress, sizeof > (EFI_IPv4_ADDRESS)); > Gateway.Addr[0] = NTOHL (Gateway.Addr[0]); > } > -- > 1.9.5.msysgit.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() 2016-08-18 5:41 ` Wu, Jiaxin 2016-08-18 5:43 ` Santhapur Naveen @ 2016-09-02 6:16 ` Santhapur Naveen 2016-09-06 11:05 ` Wu, Jiaxin 2016-10-14 7:18 ` Santhapur Naveen 2 siblings, 1 reply; 10+ messages in thread From: Santhapur Naveen @ 2016-09-02 6:16 UTC (permalink / raw) To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Ye, Ting, Fu, Siyuan Hello Jiaxin, My sincere apologies for the delayed response. I've verified the patch from my side and PXE boot is happening successfully even in classless IP network. May I know whether this will be included in EDK2? If yes, can you please provide any schedule for the same? Best regards, Naveen -----Original Message----- From: Santhapur Naveen Sent: Thursday, August 18, 2016 11:14 AM To: 'Wu, Jiaxin'; edk2-devel@lists.01.org Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Jiaxin, We will verify the patch and update you the result. Thanks, Naveen -----Original Message----- From: Wu, Jiaxin [mailto:jiaxin.wu@intel.com] Sent: Thursday, August 18, 2016 11:12 AM To: Santhapur Naveen; Wu, Jiaxin; edk2-devel@lists.01.org Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Naveen, Can you help to verify this patch to support the classless IP. Thanks, Jiaxin > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Jiaxin Wu > Sent: Thursday, August 18, 2016 1:39 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; > Santhapur Naveen <naveens@amiindia.co.in> > Subject: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 > TransmitReceive() > > The IP address should not be treated as classful one if DHCP options > contain a classless IP with its true subnet mask. Otherwise, DHCPv4 > TransmitReceive() will failed. This real subnet mask will be parsed > and recorded in DhcpSb->Netmask. So, we need check it before get the > IP's corresponding subnet mask. > > Cc: Santhapur Naveen <naveens@amiindia.co.in> > Cc: Ye Ting <ting.ye@intel.com> > Cc: Fu Siyuan <siyuan.fu@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> > --- > .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 +++++++++++++++- > ------ > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > index 4f491b4..79f7cde 100644 > --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > @@ -1,9 +1,9 @@ > /** @file > This file implement the EFI_DHCP4_PROTOCOL interface. > > -Copyright (c) 2006 - 2015, Intel Corporation. All rights > reserved.<BR> > +Copyright (c) 2006 - 2016, Intel Corporation. All rights > +reserved.<BR> > This program and the accompanying materials are licensed and made > available under the terms and conditions of the BSD License which > accompanies this distribution. The full text of the license may be > found at http://opensource.org/licenses/bsd-license.php > > @@ -1186,18 +1186,20 @@ Dhcp4InstanceConfigUdpIo ( > IN UDP_IO *UdpIo, > IN VOID *Context > ) > { > DHCP_PROTOCOL *Instance; > + DHCP_SERVICE *DhcpSb; > EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token; > EFI_UDP4_CONFIG_DATA UdpConfigData; > IP4_ADDR ClientAddr; > IP4_ADDR Ip; > INTN Class; > IP4_ADDR SubnetMask; > > Instance = (DHCP_PROTOCOL *) Context; > + DhcpSb = Instance->Service; > Token = Instance->Token; > > ZeroMem (&UdpConfigData, sizeof (EFI_UDP4_CONFIG_DATA)); > > UdpConfigData.AcceptBroadcast = TRUE; > @@ -1206,14 +1208,19 @@ Dhcp4InstanceConfigUdpIo ( > UdpConfigData.DoNotFragment = TRUE; > > ClientAddr = EFI_NTOHL (Token->Packet->Dhcp4.Header.ClientAddr); > Ip = HTONL (ClientAddr); > CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof > (EFI_IPv4_ADDRESS)); > - > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > + > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > Ip = HTONL (SubnetMask); > CopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof > (EFI_IPv4_ADDRESS)); > > if ((Token->ListenPointCount == 0) || > (Token->ListenPoints[0].ListenPort > == 0)) { > UdpConfigData.StationPort = DHCP_CLIENT_PORT; @@ -1574,16 > +1581,21 @@ EfiDhcp4TransmitReceive ( > EndPoint.RemotePort = DHCP_SERVER_PORT; > } else { > EndPoint.RemotePort = Token->RemotePort; > } > > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > // > // Get the gateway. > // > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > ZeroMem (&Gateway, sizeof (Gateway)); > if (!IP4_NET_EQUAL (ClientAddr, EndPoint.RemoteAddr.Addr[0], > SubnetMask)) { > CopyMem (&Gateway.v4, &Token->GatewayAddress, sizeof > (EFI_IPv4_ADDRESS)); > Gateway.Addr[0] = NTOHL (Gateway.Addr[0]); > } > -- > 1.9.5.msysgit.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() 2016-09-02 6:16 ` Santhapur Naveen @ 2016-09-06 11:05 ` Wu, Jiaxin 2016-09-06 11:47 ` Santhapur Naveen 0 siblings, 1 reply; 10+ messages in thread From: Wu, Jiaxin @ 2016-09-06 11:05 UTC (permalink / raw) To: Santhapur Naveen, edk2-devel@lists.01.org; +Cc: Ye, Ting, Fu, Siyuan Hi Naveen, The patch has been committed: SHA-1: 8c5f78a2cc15199e3f77ae4b156023af366fd6c7 * MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Thanks, Jiaxin > -----Original Message----- > From: Santhapur Naveen [mailto:naveens@amiindia.co.in] > Sent: Friday, September 2, 2016 2:16 PM > To: Wu, Jiaxin <jiaxin.wu@intel.com>; edk2-devel@lists.01.org > Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com> > Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 > TransmitReceive() > > Hello Jiaxin, > > My sincere apologies for the delayed response. > > I've verified the patch from my side and PXE boot is happening > successfully even in classless IP network. > > May I know whether this will be included in EDK2? If yes, can you > please provide any schedule for the same? > > Best regards, > Naveen > > -----Original Message----- > From: Santhapur Naveen > Sent: Thursday, August 18, 2016 11:14 AM > To: 'Wu, Jiaxin'; edk2-devel@lists.01.org > Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam > Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 > TransmitReceive() > > Jiaxin, > > We will verify the patch and update you the result. > > Thanks, > Naveen > > -----Original Message----- > From: Wu, Jiaxin [mailto:jiaxin.wu@intel.com] > Sent: Thursday, August 18, 2016 11:12 AM > To: Santhapur Naveen; Wu, Jiaxin; edk2-devel@lists.01.org > Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam > Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 > TransmitReceive() > > Naveen, > > Can you help to verify this patch to support the classless IP. > > Thanks, > Jiaxin > > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > Jiaxin Wu > > Sent: Thursday, August 18, 2016 1:39 PM > > To: edk2-devel@lists.01.org > > Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; > > Santhapur Naveen <naveens@amiindia.co.in> > > Subject: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 > > TransmitReceive() > > > > The IP address should not be treated as classful one if DHCP options > > contain a classless IP with its true subnet mask. Otherwise, DHCPv4 > > TransmitReceive() will failed. This real subnet mask will be parsed > > and recorded in DhcpSb->Netmask. So, we need check it before get the > > IP's corresponding subnet mask. > > > > Cc: Santhapur Naveen <naveens@amiindia.co.in> > > Cc: Ye Ting <ting.ye@intel.com> > > Cc: Fu Siyuan <siyuan.fu@intel.com> > > Contributed-under: TianoCore Contribution Agreement 1.0 > > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> > > --- > > .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 > +++++++++++++++- > > ------ > > 1 file changed, 20 insertions(+), 8 deletions(-) > > > > diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > > b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > > index 4f491b4..79f7cde 100644 > > --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > > +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > > @@ -1,9 +1,9 @@ > > /** @file > > This file implement the EFI_DHCP4_PROTOCOL interface. > > > > -Copyright (c) 2006 - 2015, Intel Corporation. All rights > > reserved.<BR> > > +Copyright (c) 2006 - 2016, Intel Corporation. All rights > > +reserved.<BR> > > This program and the accompanying materials are licensed and made > > available under the terms and conditions of the BSD License which > > accompanies this distribution. The full text of the license may be > > found at http://opensource.org/licenses/bsd-license.php > > > > @@ -1186,18 +1186,20 @@ Dhcp4InstanceConfigUdpIo ( > > IN UDP_IO *UdpIo, > > IN VOID *Context > > ) > > { > > DHCP_PROTOCOL *Instance; > > + DHCP_SERVICE *DhcpSb; > > EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token; > > EFI_UDP4_CONFIG_DATA UdpConfigData; > > IP4_ADDR ClientAddr; > > IP4_ADDR Ip; > > INTN Class; > > IP4_ADDR SubnetMask; > > > > Instance = (DHCP_PROTOCOL *) Context; > > + DhcpSb = Instance->Service; > > Token = Instance->Token; > > > > ZeroMem (&UdpConfigData, sizeof (EFI_UDP4_CONFIG_DATA)); > > > > UdpConfigData.AcceptBroadcast = TRUE; > > @@ -1206,14 +1208,19 @@ Dhcp4InstanceConfigUdpIo ( > > UdpConfigData.DoNotFragment = TRUE; > > > > ClientAddr = EFI_NTOHL (Token->Packet->Dhcp4.Header.ClientAddr); > > Ip = HTONL (ClientAddr); > > CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof > > (EFI_IPv4_ADDRESS)); > > - > > - Class = NetGetIpClass (ClientAddr); > > - ASSERT (Class < IP4_ADDR_CLASSE); > > - SubnetMask = gIp4AllMasks[Class << 3]; > > + > > + if (DhcpSb->Netmask == 0) { > > + Class = NetGetIpClass (ClientAddr); > > + ASSERT (Class < IP4_ADDR_CLASSE); > > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > > + SubnetMask = DhcpSb->Netmask; > > + } > > + > > Ip = HTONL (SubnetMask); > > CopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof > > (EFI_IPv4_ADDRESS)); > > > > if ((Token->ListenPointCount == 0) || > > (Token->ListenPoints[0].ListenPort > > == 0)) { > > UdpConfigData.StationPort = DHCP_CLIENT_PORT; @@ -1574,16 > > +1581,21 @@ EfiDhcp4TransmitReceive ( > > EndPoint.RemotePort = DHCP_SERVER_PORT; > > } else { > > EndPoint.RemotePort = Token->RemotePort; > > } > > > > + if (DhcpSb->Netmask == 0) { > > + Class = NetGetIpClass (ClientAddr); > > + ASSERT (Class < IP4_ADDR_CLASSE); > > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > > + SubnetMask = DhcpSb->Netmask; > > + } > > + > > // > > // Get the gateway. > > // > > - Class = NetGetIpClass (ClientAddr); > > - ASSERT (Class < IP4_ADDR_CLASSE); > > - SubnetMask = gIp4AllMasks[Class << 3]; > > ZeroMem (&Gateway, sizeof (Gateway)); > > if (!IP4_NET_EQUAL (ClientAddr, EndPoint.RemoteAddr.Addr[0], > > SubnetMask)) { > > CopyMem (&Gateway.v4, &Token->GatewayAddress, sizeof > > (EFI_IPv4_ADDRESS)); > > Gateway.Addr[0] = NTOHL (Gateway.Addr[0]); > > } > > -- > > 1.9.5.msysgit.1 > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() 2016-09-06 11:05 ` Wu, Jiaxin @ 2016-09-06 11:47 ` Santhapur Naveen 0 siblings, 0 replies; 10+ messages in thread From: Santhapur Naveen @ 2016-09-06 11:47 UTC (permalink / raw) To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Ye, Ting, Fu, Siyuan Hello Jiaxin, Thank you very much for your timely help and support. Regards, Naveen -----Original Message----- From: Wu, Jiaxin [mailto:jiaxin.wu@intel.com] Sent: Tuesday, September 06, 2016 4:35 PM To: Santhapur Naveen; edk2-devel@lists.01.org Cc: Ye, Ting; Fu, Siyuan Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Hi Naveen, The patch has been committed: SHA-1: 8c5f78a2cc15199e3f77ae4b156023af366fd6c7 * MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Thanks, Jiaxin > -----Original Message----- > From: Santhapur Naveen [mailto:naveens@amiindia.co.in] > Sent: Friday, September 2, 2016 2:16 PM > To: Wu, Jiaxin <jiaxin.wu@intel.com>; edk2-devel@lists.01.org > Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com> > Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for > DHCPv4 > TransmitReceive() > > Hello Jiaxin, > > My sincere apologies for the delayed response. > > I've verified the patch from my side and PXE boot is happening > successfully even in classless IP network. > > May I know whether this will be included in EDK2? If yes, can you > please provide any schedule for the same? > > Best regards, > Naveen > > -----Original Message----- > From: Santhapur Naveen > Sent: Thursday, August 18, 2016 11:14 AM > To: 'Wu, Jiaxin'; edk2-devel@lists.01.org > Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam > Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for > DHCPv4 > TransmitReceive() > > Jiaxin, > > We will verify the patch and update you the result. > > Thanks, > Naveen > > -----Original Message----- > From: Wu, Jiaxin [mailto:jiaxin.wu@intel.com] > Sent: Thursday, August 18, 2016 11:12 AM > To: Santhapur Naveen; Wu, Jiaxin; edk2-devel@lists.01.org > Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam > Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for > DHCPv4 > TransmitReceive() > > Naveen, > > Can you help to verify this patch to support the classless IP. > > Thanks, > Jiaxin > > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf > > Of Jiaxin Wu > > Sent: Thursday, August 18, 2016 1:39 PM > > To: edk2-devel@lists.01.org > > Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; > > Santhapur Naveen <naveens@amiindia.co.in> > > Subject: [edk2] [Patch] MdeModulePkg: Support classless IP for > > DHCPv4 > > TransmitReceive() > > > > The IP address should not be treated as classful one if DHCP options > > contain a classless IP with its true subnet mask. Otherwise, DHCPv4 > > TransmitReceive() will failed. This real subnet mask will be parsed > > and recorded in DhcpSb->Netmask. So, we need check it before get the > > IP's corresponding subnet mask. > > > > Cc: Santhapur Naveen <naveens@amiindia.co.in> > > Cc: Ye Ting <ting.ye@intel.com> > > Cc: Fu Siyuan <siyuan.fu@intel.com> > > Contributed-under: TianoCore Contribution Agreement 1.0 > > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> > > --- > > .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 > +++++++++++++++- > > ------ > > 1 file changed, 20 insertions(+), 8 deletions(-) > > > > diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > > b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > > index 4f491b4..79f7cde 100644 > > --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > > +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > > @@ -1,9 +1,9 @@ > > /** @file > > This file implement the EFI_DHCP4_PROTOCOL interface. > > > > -Copyright (c) 2006 - 2015, Intel Corporation. All rights > > reserved.<BR> > > +Copyright (c) 2006 - 2016, Intel Corporation. All rights > > +reserved.<BR> > > This program and the accompanying materials are licensed and made > > available under the terms and conditions of the BSD License which > > accompanies this distribution. The full text of the license may be > > found at http://opensource.org/licenses/bsd-license.php > > > > @@ -1186,18 +1186,20 @@ Dhcp4InstanceConfigUdpIo ( > > IN UDP_IO *UdpIo, > > IN VOID *Context > > ) > > { > > DHCP_PROTOCOL *Instance; > > + DHCP_SERVICE *DhcpSb; > > EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token; > > EFI_UDP4_CONFIG_DATA UdpConfigData; > > IP4_ADDR ClientAddr; > > IP4_ADDR Ip; > > INTN Class; > > IP4_ADDR SubnetMask; > > > > Instance = (DHCP_PROTOCOL *) Context; > > + DhcpSb = Instance->Service; > > Token = Instance->Token; > > > > ZeroMem (&UdpConfigData, sizeof (EFI_UDP4_CONFIG_DATA)); > > > > UdpConfigData.AcceptBroadcast = TRUE; > > @@ -1206,14 +1208,19 @@ Dhcp4InstanceConfigUdpIo ( > > UdpConfigData.DoNotFragment = TRUE; > > > > ClientAddr = EFI_NTOHL (Token->Packet->Dhcp4.Header.ClientAddr); > > Ip = HTONL (ClientAddr); > > CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof > > (EFI_IPv4_ADDRESS)); > > - > > - Class = NetGetIpClass (ClientAddr); > > - ASSERT (Class < IP4_ADDR_CLASSE); > > - SubnetMask = gIp4AllMasks[Class << 3]; > > + > > + if (DhcpSb->Netmask == 0) { > > + Class = NetGetIpClass (ClientAddr); > > + ASSERT (Class < IP4_ADDR_CLASSE); > > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > > + SubnetMask = DhcpSb->Netmask; > > + } > > + > > Ip = HTONL (SubnetMask); > > CopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof > > (EFI_IPv4_ADDRESS)); > > > > if ((Token->ListenPointCount == 0) || > > (Token->ListenPoints[0].ListenPort > > == 0)) { > > UdpConfigData.StationPort = DHCP_CLIENT_PORT; @@ -1574,16 > > +1581,21 @@ EfiDhcp4TransmitReceive ( > > EndPoint.RemotePort = DHCP_SERVER_PORT; > > } else { > > EndPoint.RemotePort = Token->RemotePort; > > } > > > > + if (DhcpSb->Netmask == 0) { > > + Class = NetGetIpClass (ClientAddr); > > + ASSERT (Class < IP4_ADDR_CLASSE); > > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > > + SubnetMask = DhcpSb->Netmask; > > + } > > + > > // > > // Get the gateway. > > // > > - Class = NetGetIpClass (ClientAddr); > > - ASSERT (Class < IP4_ADDR_CLASSE); > > - SubnetMask = gIp4AllMasks[Class << 3]; > > ZeroMem (&Gateway, sizeof (Gateway)); > > if (!IP4_NET_EQUAL (ClientAddr, EndPoint.RemoteAddr.Addr[0], > > SubnetMask)) { > > CopyMem (&Gateway.v4, &Token->GatewayAddress, sizeof > > (EFI_IPv4_ADDRESS)); > > Gateway.Addr[0] = NTOHL (Gateway.Addr[0]); > > } > > -- > > 1.9.5.msysgit.1 > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() 2016-08-18 5:41 ` Wu, Jiaxin 2016-08-18 5:43 ` Santhapur Naveen 2016-09-02 6:16 ` Santhapur Naveen @ 2016-10-14 7:18 ` Santhapur Naveen 2016-10-18 2:45 ` Fu, Siyuan 2 siblings, 1 reply; 10+ messages in thread From: Santhapur Naveen @ 2016-10-14 7:18 UTC (permalink / raw) To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Ye, Ting, Fu, Siyuan Hello Jiaxin, We've run into one more problem with PXE boot. The PXE boot is not happening when the server tries to assign an IP address whose last octet is zero. The below is my configuration: [Server Configuration] Ipv4 address : 192.168.0.1/16 Netmask: 255.255.0.0 DHCPv4 Scope: Range: 192.168.0.2 to 192.168.10.10 Netmask: 255.255.0.0 I've observed that in the given address range, if the server tries to allocate any IP address with the last octet as 0 i.e., for instance 192.168.A.0 where A vary from 1 to 10, then the PXE boot fails saying "PXE-E09: Could not allocate I/O buffers." I agree that the x.y.z.0 and x.y.z.255 are network address any can't be assigned based on the subnet (In this case, 192.168.0.0 and 192.168.255.255). But here, the Netmask is different which expects the IP address x.y.a.0 which is within the range is valid and can be assigned to any client in the network. I captured Wireshark log and as per it, the D.O.R.A process is finished but the client is sending a Decline packet. I suspect the function NetIp4IsUnicast() has a role to play in this. Please provide your comments on this. Best regards, Naveen -----Original Message----- From: Santhapur Naveen Sent: Friday, September 02, 2016 11:46 AM To: 'Wu, Jiaxin'; 'edk2-devel@lists.01.org' Cc: 'Ye, Ting'; 'Fu, Siyuan' Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Hello Jiaxin, My sincere apologies for the delayed response. I've verified the patch from my side and PXE boot is happening successfully even in classless IP network. May I know whether this will be included in EDK2? If yes, can you please provide any schedule for the same? Best regards, Naveen -----Original Message----- From: Santhapur Naveen Sent: Thursday, August 18, 2016 11:14 AM To: 'Wu, Jiaxin'; edk2-devel@lists.01.org Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Jiaxin, We will verify the patch and update you the result. Thanks, Naveen -----Original Message----- From: Wu, Jiaxin [mailto:jiaxin.wu@intel.com] Sent: Thursday, August 18, 2016 11:12 AM To: Santhapur Naveen; Wu, Jiaxin; edk2-devel@lists.01.org Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Naveen, Can you help to verify this patch to support the classless IP. Thanks, Jiaxin > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Jiaxin Wu > Sent: Thursday, August 18, 2016 1:39 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; > Santhapur Naveen <naveens@amiindia.co.in> > Subject: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 > TransmitReceive() > > The IP address should not be treated as classful one if DHCP options > contain a classless IP with its true subnet mask. Otherwise, DHCPv4 > TransmitReceive() will failed. This real subnet mask will be parsed > and recorded in DhcpSb->Netmask. So, we need check it before get the > IP's corresponding subnet mask. > > Cc: Santhapur Naveen <naveens@amiindia.co.in> > Cc: Ye Ting <ting.ye@intel.com> > Cc: Fu Siyuan <siyuan.fu@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> > --- > .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 +++++++++++++++- > ------ > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > index 4f491b4..79f7cde 100644 > --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > @@ -1,9 +1,9 @@ > /** @file > This file implement the EFI_DHCP4_PROTOCOL interface. > > -Copyright (c) 2006 - 2015, Intel Corporation. All rights > reserved.<BR> > +Copyright (c) 2006 - 2016, Intel Corporation. All rights > +reserved.<BR> > This program and the accompanying materials are licensed and made > available under the terms and conditions of the BSD License which > accompanies this distribution. The full text of the license may be > found at http://opensource.org/licenses/bsd-license.php > > @@ -1186,18 +1186,20 @@ Dhcp4InstanceConfigUdpIo ( > IN UDP_IO *UdpIo, > IN VOID *Context > ) > { > DHCP_PROTOCOL *Instance; > + DHCP_SERVICE *DhcpSb; > EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token; > EFI_UDP4_CONFIG_DATA UdpConfigData; > IP4_ADDR ClientAddr; > IP4_ADDR Ip; > INTN Class; > IP4_ADDR SubnetMask; > > Instance = (DHCP_PROTOCOL *) Context; > + DhcpSb = Instance->Service; > Token = Instance->Token; > > ZeroMem (&UdpConfigData, sizeof (EFI_UDP4_CONFIG_DATA)); > > UdpConfigData.AcceptBroadcast = TRUE; > @@ -1206,14 +1208,19 @@ Dhcp4InstanceConfigUdpIo ( > UdpConfigData.DoNotFragment = TRUE; > > ClientAddr = EFI_NTOHL (Token->Packet->Dhcp4.Header.ClientAddr); > Ip = HTONL (ClientAddr); > CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof > (EFI_IPv4_ADDRESS)); > - > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > + > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > Ip = HTONL (SubnetMask); > CopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof > (EFI_IPv4_ADDRESS)); > > if ((Token->ListenPointCount == 0) || > (Token->ListenPoints[0].ListenPort > == 0)) { > UdpConfigData.StationPort = DHCP_CLIENT_PORT; @@ -1574,16 > +1581,21 @@ EfiDhcp4TransmitReceive ( > EndPoint.RemotePort = DHCP_SERVER_PORT; > } else { > EndPoint.RemotePort = Token->RemotePort; > } > > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > // > // Get the gateway. > // > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > ZeroMem (&Gateway, sizeof (Gateway)); > if (!IP4_NET_EQUAL (ClientAddr, EndPoint.RemoteAddr.Addr[0], > SubnetMask)) { > CopyMem (&Gateway.v4, &Token->GatewayAddress, sizeof > (EFI_IPv4_ADDRESS)); > Gateway.Addr[0] = NTOHL (Gateway.Addr[0]); > } > -- > 1.9.5.msysgit.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() 2016-10-14 7:18 ` Santhapur Naveen @ 2016-10-18 2:45 ` Fu, Siyuan 2016-10-18 6:44 ` Santhapur Naveen 0 siblings, 1 reply; 10+ messages in thread From: Fu, Siyuan @ 2016-10-18 2:45 UTC (permalink / raw) To: Santhapur Naveen, Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Ye, Ting, Li, Ruth Hi, Naveen I checked the code and found the IP4 stack is actually doesn't support classless IP address now, the main reason is in the NetLib interface NetGetIpClass() and NetIp4IsUnicast(). These 2 interfaces do not consider the netmask so it won't recognize a classless IP configuration. Almost all other network drivers (IP4, ARP, iSCSI, Mtftp, PXE, TCP, UDP) are using these 2 interfaces so I guess they may have the same problem. Please help to submit a ticket in tianocore Bugzilla for this issue, thanks. BestRegards Fu Siyuan From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Santhapur Naveen Sent: Friday, October 14, 2016 3:19 PM To: Wu, Jiaxin <jiaxin.wu@intel.com>; edk2-devel@lists.01.org Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com> Subject: Re: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Hello Jiaxin, We've run into one more problem with PXE boot. The PXE boot is not happening when the server tries to assign an IP address whose last octet is zero. The below is my configuration: [Server Configuration] Ipv4 address : 192.168.0.1/16 Netmask: 255.255.0.0 DHCPv4 Scope: Range: 192.168.0.2 to 192.168.10.10 Netmask: 255.255.0.0 I've observed that in the given address range, if the server tries to allocate any IP address with the last octet as 0 i.e., for instance 192.168.A.0 where A vary from 1 to 10, then the PXE boot fails saying "PXE-E09: Could not allocate I/O buffers." I agree that the x.y.z.0 and x.y.z.255 are network address any can't be assigned based on the subnet (In this case, 192.168.0.0 and 192.168.255.255). But here, the Netmask is different which expects the IP address x.y.a.0 which is within the range is valid and can be assigned to any client in the network. I captured Wireshark log and as per it, the D.O.R.A process is finished but the client is sending a Decline packet. I suspect the function NetIp4IsUnicast() has a role to play in this. Please provide your comments on this. Best regards, Naveen -----Original Message----- From: Santhapur Naveen Sent: Friday, September 02, 2016 11:46 AM To: 'Wu, Jiaxin'; 'edk2-devel@lists.01.org' Cc: 'Ye, Ting'; 'Fu, Siyuan' Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Hello Jiaxin, My sincere apologies for the delayed response. I've verified the patch from my side and PXE boot is happening successfully even in classless IP network. May I know whether this will be included in EDK2? If yes, can you please provide any schedule for the same? Best regards, Naveen -----Original Message----- From: Santhapur Naveen Sent: Thursday, August 18, 2016 11:14 AM To: 'Wu, Jiaxin'; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Jiaxin, We will verify the patch and update you the result. Thanks, Naveen -----Original Message----- From: Wu, Jiaxin [mailto:jiaxin.wu@intel.com] Sent: Thursday, August 18, 2016 11:12 AM To: Santhapur Naveen; Wu, Jiaxin; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Naveen, Can you help to verify this patch to support the classless IP. Thanks, Jiaxin > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Jiaxin Wu > Sent: Thursday, August 18, 2016 1:39 PM > To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> > Cc: Ye, Ting <ting.ye@intel.com<mailto:ting.ye@intel.com>>; Fu, Siyuan <siyuan.fu@intel.com<mailto:siyuan.fu@intel.com>>; > Santhapur Naveen <naveens@amiindia.co.in<mailto:naveens@amiindia.co.in>> > Subject: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 > TransmitReceive() > > The IP address should not be treated as classful one if DHCP options > contain a classless IP with its true subnet mask. Otherwise, DHCPv4 > TransmitReceive() will failed. This real subnet mask will be parsed > and recorded in DhcpSb->Netmask. So, we need check it before get the > IP's corresponding subnet mask. > > Cc: Santhapur Naveen <naveens@amiindia.co.in<mailto:naveens@amiindia.co.in>> > Cc: Ye Ting <ting.ye@intel.com<mailto:ting.ye@intel.com>> > Cc: Fu Siyuan <siyuan.fu@intel.com<mailto:siyuan.fu@intel.com>> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com<mailto:jiaxin.wu@intel.com>> > --- > .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 +++++++++++++++- > ------ > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > index 4f491b4..79f7cde 100644 > --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > @@ -1,9 +1,9 @@ > /** @file > This file implement the EFI_DHCP4_PROTOCOL interface. > > -Copyright (c) 2006 - 2015, Intel Corporation. All rights > reserved.<BR> > +Copyright (c) 2006 - 2016, Intel Corporation. All rights > +reserved.<BR> > This program and the accompanying materials are licensed and made > available under the terms and conditions of the BSD License which > accompanies this distribution. The full text of the license may be > found at http://opensource.org/licenses/bsd-license.php > > @@ -1186,18 +1186,20 @@ Dhcp4InstanceConfigUdpIo ( > IN UDP_IO *UdpIo, > IN VOID *Context > ) > { > DHCP_PROTOCOL *Instance; > + DHCP_SERVICE *DhcpSb; > EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token; > EFI_UDP4_CONFIG_DATA UdpConfigData; > IP4_ADDR ClientAddr; > IP4_ADDR Ip; > INTN Class; > IP4_ADDR SubnetMask; > > Instance = (DHCP_PROTOCOL *) Context; > + DhcpSb = Instance->Service; > Token = Instance->Token; > > ZeroMem (&UdpConfigData, sizeof (EFI_UDP4_CONFIG_DATA)); > > UdpConfigData.AcceptBroadcast = TRUE; > @@ -1206,14 +1208,19 @@ Dhcp4InstanceConfigUdpIo ( > UdpConfigData.DoNotFragment = TRUE; > > ClientAddr = EFI_NTOHL (Token->Packet->Dhcp4.Header.ClientAddr); > Ip = HTONL (ClientAddr); > CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof > (EFI_IPv4_ADDRESS)); > - > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > + > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > Ip = HTONL (SubnetMask); > CopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof > (EFI_IPv4_ADDRESS)); > > if ((Token->ListenPointCount == 0) || > (Token->ListenPoints[0].ListenPort > == 0)) { > UdpConfigData.StationPort = DHCP_CLIENT_PORT; @@ -1574,16 > +1581,21 @@ EfiDhcp4TransmitReceive ( > EndPoint.RemotePort = DHCP_SERVER_PORT; > } else { > EndPoint.RemotePort = Token->RemotePort; > } > > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > // > // Get the gateway. > // > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > ZeroMem (&Gateway, sizeof (Gateway)); > if (!IP4_NET_EQUAL (ClientAddr, EndPoint.RemoteAddr.Addr[0], > SubnetMask)) { > CopyMem (&Gateway.v4, &Token->GatewayAddress, sizeof > (EFI_IPv4_ADDRESS)); > Gateway.Addr[0] = NTOHL (Gateway.Addr[0]); > } > -- > 1.9.5.msysgit.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() 2016-10-18 2:45 ` Fu, Siyuan @ 2016-10-18 6:44 ` Santhapur Naveen 0 siblings, 0 replies; 10+ messages in thread From: Santhapur Naveen @ 2016-10-18 6:44 UTC (permalink / raw) To: Fu, Siyuan, Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Ye, Ting, Li, Ruth Hello Fu Siyuan, Thanks for the update. I had reported a bug in the Bugzilla site. Please use the link https://bugzilla.tianocore.org/show_bug.cgi?id=155 to view the details. Please let me know if any other details are needed. Thank you, Naveen From: Fu, Siyuan [mailto:siyuan.fu@intel.com] Sent: Tuesday, October 18, 2016 8:16 AM To: Santhapur Naveen; Wu, Jiaxin; edk2-devel@lists.01.org Cc: Ye, Ting; Li, Ruth Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Hi, Naveen I checked the code and found the IP4 stack is actually doesn't support classless IP address now, the main reason is in the NetLib interface NetGetIpClass() and NetIp4IsUnicast(). These 2 interfaces do not consider the netmask so it won't recognize a classless IP configuration. Almost all other network drivers (IP4, ARP, iSCSI, Mtftp, PXE, TCP, UDP) are using these 2 interfaces so I guess they may have the same problem. Please help to submit a ticket in tianocore Bugzilla for this issue, thanks. BestRegards Fu Siyuan From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Santhapur Naveen Sent: Friday, October 14, 2016 3:19 PM To: Wu, Jiaxin <jiaxin.wu@intel.com<mailto:jiaxin.wu@intel.com>>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Cc: Ye, Ting <ting.ye@intel.com<mailto:ting.ye@intel.com>>; Fu, Siyuan <siyuan.fu@intel.com<mailto:siyuan.fu@intel.com>> Subject: Re: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Hello Jiaxin, We've run into one more problem with PXE boot. The PXE boot is not happening when the server tries to assign an IP address whose last octet is zero. The below is my configuration: [Server Configuration] Ipv4 address : 192.168.0.1/16 Netmask: 255.255.0.0 DHCPv4 Scope: Range: 192.168.0.2 to 192.168.10.10 Netmask: 255.255.0.0 I've observed that in the given address range, if the server tries to allocate any IP address with the last octet as 0 i.e., for instance 192.168.A.0 where A vary from 1 to 10, then the PXE boot fails saying "PXE-E09: Could not allocate I/O buffers." I agree that the x.y.z.0 and x.y.z.255 are network address any can't be assigned based on the subnet (In this case, 192.168.0.0 and 192.168.255.255). But here, the Netmask is different which expects the IP address x.y.a.0 which is within the range is valid and can be assigned to any client in the network. I captured Wireshark log and as per it, the D.O.R.A process is finished but the client is sending a Decline packet. I suspect the function NetIp4IsUnicast() has a role to play in this. Please provide your comments on this. Best regards, Naveen -----Original Message----- From: Santhapur Naveen Sent: Friday, September 02, 2016 11:46 AM To: 'Wu, Jiaxin'; 'edk2-devel@lists.01.org' Cc: 'Ye, Ting'; 'Fu, Siyuan' Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Hello Jiaxin, My sincere apologies for the delayed response. I've verified the patch from my side and PXE boot is happening successfully even in classless IP network. May I know whether this will be included in EDK2? If yes, can you please provide any schedule for the same? Best regards, Naveen -----Original Message----- From: Santhapur Naveen Sent: Thursday, August 18, 2016 11:14 AM To: 'Wu, Jiaxin'; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Jiaxin, We will verify the patch and update you the result. Thanks, Naveen -----Original Message----- From: Wu, Jiaxin [mailto:jiaxin.wu@intel.com] Sent: Thursday, August 18, 2016 11:12 AM To: Santhapur Naveen; Wu, Jiaxin; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Cc: Ye, Ting; Fu, Siyuan; Sivaraman Nainar; Madhan B. Santharam Subject: RE: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Naveen, Can you help to verify this patch to support the classless IP. Thanks, Jiaxin > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Jiaxin Wu > Sent: Thursday, August 18, 2016 1:39 PM > To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> > Cc: Ye, Ting <ting.ye@intel.com<mailto:ting.ye@intel.com>>; Fu, Siyuan <siyuan.fu@intel.com<mailto:siyuan.fu@intel.com>>; > Santhapur Naveen <naveens@amiindia.co.in<mailto:naveens@amiindia.co.in>> > Subject: [edk2] [Patch] MdeModulePkg: Support classless IP for DHCPv4 > TransmitReceive() > > The IP address should not be treated as classful one if DHCP options > contain a classless IP with its true subnet mask. Otherwise, DHCPv4 > TransmitReceive() will failed. This real subnet mask will be parsed > and recorded in DhcpSb->Netmask. So, we need check it before get the > IP's corresponding subnet mask. > > Cc: Santhapur Naveen <naveens@amiindia.co.in<mailto:naveens@amiindia.co.in>> > Cc: Ye Ting <ting.ye@intel.com<mailto:ting.ye@intel.com>> > Cc: Fu Siyuan <siyuan.fu@intel.com<mailto:siyuan.fu@intel.com>> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com<mailto:jiaxin.wu@intel.com>> > --- > .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 +++++++++++++++- > ------ > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > index 4f491b4..79f7cde 100644 > --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > @@ -1,9 +1,9 @@ > /** @file > This file implement the EFI_DHCP4_PROTOCOL interface. > > -Copyright (c) 2006 - 2015, Intel Corporation. All rights > reserved.<BR> > +Copyright (c) 2006 - 2016, Intel Corporation. All rights > +reserved.<BR> > This program and the accompanying materials are licensed and made > available under the terms and conditions of the BSD License which > accompanies this distribution. The full text of the license may be > found at http://opensource.org/licenses/bsd-license.php > > @@ -1186,18 +1186,20 @@ Dhcp4InstanceConfigUdpIo ( > IN UDP_IO *UdpIo, > IN VOID *Context > ) > { > DHCP_PROTOCOL *Instance; > + DHCP_SERVICE *DhcpSb; > EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token; > EFI_UDP4_CONFIG_DATA UdpConfigData; > IP4_ADDR ClientAddr; > IP4_ADDR Ip; > INTN Class; > IP4_ADDR SubnetMask; > > Instance = (DHCP_PROTOCOL *) Context; > + DhcpSb = Instance->Service; > Token = Instance->Token; > > ZeroMem (&UdpConfigData, sizeof (EFI_UDP4_CONFIG_DATA)); > > UdpConfigData.AcceptBroadcast = TRUE; > @@ -1206,14 +1208,19 @@ Dhcp4InstanceConfigUdpIo ( > UdpConfigData.DoNotFragment = TRUE; > > ClientAddr = EFI_NTOHL (Token->Packet->Dhcp4.Header.ClientAddr); > Ip = HTONL (ClientAddr); > CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof > (EFI_IPv4_ADDRESS)); > - > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > + > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > Ip = HTONL (SubnetMask); > CopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof > (EFI_IPv4_ADDRESS)); > > if ((Token->ListenPointCount == 0) || > (Token->ListenPoints[0].ListenPort > == 0)) { > UdpConfigData.StationPort = DHCP_CLIENT_PORT; @@ -1574,16 > +1581,21 @@ EfiDhcp4TransmitReceive ( > EndPoint.RemotePort = DHCP_SERVER_PORT; > } else { > EndPoint.RemotePort = Token->RemotePort; > } > > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > // > // Get the gateway. > // > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > ZeroMem (&Gateway, sizeof (Gateway)); > if (!IP4_NET_EQUAL (ClientAddr, EndPoint.RemoteAddr.Addr[0], > SubnetMask)) { > CopyMem (&Gateway.v4, &Token->GatewayAddress, sizeof > (EFI_IPv4_ADDRESS)); > Gateway.Addr[0] = NTOHL (Gateway.Addr[0]); > } > -- > 1.9.5.msysgit.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> https://lists.01.org/mailman/listinfo/edk2-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() 2016-08-18 5:38 [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Jiaxin Wu 2016-08-18 5:41 ` Wu, Jiaxin @ 2016-09-06 1:02 ` Fu, Siyuan 1 sibling, 0 replies; 10+ messages in thread From: Fu, Siyuan @ 2016-09-06 1:02 UTC (permalink / raw) To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Santhapur Naveen, Ye, Ting Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> > -----Original Message----- > From: Wu, Jiaxin > Sent: Thursday, August 18, 2016 1:39 PM > To: edk2-devel@lists.01.org > Cc: Santhapur Naveen <naveens@amiindia.co.in>; Ye, Ting > <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com> > Subject: [Patch] MdeModulePkg: Support classless IP for DHCPv4 > TransmitReceive() > > The IP address should not be treated as classful one if DHCP options > contain a classless IP with its true subnet mask. Otherwise, DHCPv4 > TransmitReceive() will failed. This real subnet mask will be parsed > and recorded in DhcpSb->Netmask. So, we need check it before get the > IP's corresponding subnet mask. > > Cc: Santhapur Naveen <naveens@amiindia.co.in> > Cc: Ye Ting <ting.ye@intel.com> > Cc: Fu Siyuan <siyuan.fu@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> > --- > .../Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 28 +++++++++++++++-- > ----- > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > index 4f491b4..79f7cde 100644 > --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c > @@ -1,9 +1,9 @@ > /** @file > This file implement the EFI_DHCP4_PROTOCOL interface. > > -Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> > +Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD > License > which accompanies this distribution. The full text of the license may be > found at > http://opensource.org/licenses/bsd-license.php > > @@ -1186,18 +1186,20 @@ Dhcp4InstanceConfigUdpIo ( > IN UDP_IO *UdpIo, > IN VOID *Context > ) > { > DHCP_PROTOCOL *Instance; > + DHCP_SERVICE *DhcpSb; > EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token; > EFI_UDP4_CONFIG_DATA UdpConfigData; > IP4_ADDR ClientAddr; > IP4_ADDR Ip; > INTN Class; > IP4_ADDR SubnetMask; > > Instance = (DHCP_PROTOCOL *) Context; > + DhcpSb = Instance->Service; > Token = Instance->Token; > > ZeroMem (&UdpConfigData, sizeof (EFI_UDP4_CONFIG_DATA)); > > UdpConfigData.AcceptBroadcast = TRUE; > @@ -1206,14 +1208,19 @@ Dhcp4InstanceConfigUdpIo ( > UdpConfigData.DoNotFragment = TRUE; > > ClientAddr = EFI_NTOHL (Token->Packet->Dhcp4.Header.ClientAddr); > Ip = HTONL (ClientAddr); > CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof (EFI_IPv4_ADDRESS)); > - > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > + > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; > + } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > Ip = HTONL (SubnetMask); > CopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof (EFI_IPv4_ADDRESS)); > > if ((Token->ListenPointCount == 0) || (Token- > >ListenPoints[0].ListenPort == 0)) { > UdpConfigData.StationPort = DHCP_CLIENT_PORT; > @@ -1574,16 +1581,21 @@ EfiDhcp4TransmitReceive ( > EndPoint.RemotePort = DHCP_SERVER_PORT; > } else { > EndPoint.RemotePort = Token->RemotePort; > } > > + if (DhcpSb->Netmask == 0) { > + Class = NetGetIpClass (ClientAddr); > + ASSERT (Class < IP4_ADDR_CLASSE); > + SubnetMask = gIp4AllMasks[Class << 3]; > + } else { > + SubnetMask = DhcpSb->Netmask; > + } > + > // > // Get the gateway. > // > - Class = NetGetIpClass (ClientAddr); > - ASSERT (Class < IP4_ADDR_CLASSE); > - SubnetMask = gIp4AllMasks[Class << 3]; > ZeroMem (&Gateway, sizeof (Gateway)); > if (!IP4_NET_EQUAL (ClientAddr, EndPoint.RemoteAddr.Addr[0], > SubnetMask)) { > CopyMem (&Gateway.v4, &Token->GatewayAddress, sizeof > (EFI_IPv4_ADDRESS)); > Gateway.Addr[0] = NTOHL (Gateway.Addr[0]); > } > -- > 1.9.5.msysgit.1 ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-10-18 6:44 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-08-18 5:38 [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive() Jiaxin Wu 2016-08-18 5:41 ` Wu, Jiaxin 2016-08-18 5:43 ` Santhapur Naveen 2016-09-02 6:16 ` Santhapur Naveen 2016-09-06 11:05 ` Wu, Jiaxin 2016-09-06 11:47 ` Santhapur Naveen 2016-10-14 7:18 ` Santhapur Naveen 2016-10-18 2:45 ` Fu, Siyuan 2016-10-18 6:44 ` Santhapur Naveen 2016-09-06 1:02 ` Fu, Siyuan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox