public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Santhapur Naveen <naveens@amiindia.co.in>
To: "Wu, Jiaxin" <jiaxin.wu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Ye, Ting" <ting.ye@intel.com>,
	"Fu, Siyuan" <siyuan.fu@intel.com>,
	Sivaraman Nainar <sivaramann@amiindia.co.in>,
	"Madhan B. Santharam" <madhans@ami.com>
Subject: Re: [Patch] MdeModulePkg: Support classless IP for DHCPv4 TransmitReceive()
Date: Thu, 18 Aug 2016 05:43:59 +0000	[thread overview]
Message-ID: <625A2455CC232F40B0F38F05ACED6D976C4DADF9@VENUS1.in.megatrends.com> (raw)
In-Reply-To: <895558F6EA4E3B41AC93A00D163B7274137C87CB@SHSMSX103.ccr.corp.intel.com>

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


  reply	other threads:[~2016-08-18  5:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=625A2455CC232F40B0F38F05ACED6D976C4DADF9@VENUS1.in.megatrends.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox