summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/Network/Ip4Dxe
diff options
context:
space:
mode:
authorFu Siyuan <siyuan.fu@intel.com>2017-10-18 10:13:39 +0800
committerFu Siyuan <siyuan.fu@intel.com>2017-11-13 13:52:17 +0800
commit29788f178e48fa5ffe7d3262d73c9548e9285d2d (patch)
treef333e83a1769b7ea13dd77b6c66fb0c0e38fa57a /MdeModulePkg/Universal/Network/Ip4Dxe
parentdb04b706b7326da7292bfe313cf3cd05ca3d5e11 (diff)
downloadedk2-29788f178e48fa5ffe7d3262d73c9548e9285d2d.tar.gz
edk2-29788f178e48fa5ffe7d3262d73c9548e9285d2d.tar.bz2
edk2-29788f178e48fa5ffe7d3262d73c9548e9285d2d.zip
MdeModulePkg: Update IP4 stack to support point-to-point link with 31-bit mask.
V2 update: Directly use NetIp4IsUnicast() to check station address in IP driver. This patch is to follow RFC3021 which allows to use 31-bit mask in point-to-point link. If a 31-bit subnet mask is assigned to a point-to-point link, it leaves the <Host-number> with only 1 bit. Consequently, only two possible addresses may result: {<Network-number>, 0} and {<Network-number>, -1} These addresses have historically been associated with network and broadcast addresses (see Section 2.2). In a point-to-point link with a 31-bit subnet mask, the two addresses above MUST be interpreted as host addresses. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal/Network/Ip4Dxe')
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.c
index 7c7d182073..b582ccf13f 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.c
@@ -287,10 +287,6 @@ Ip4StationAddressValid (
IN IP4_ADDR Netmask
)
{
- IP4_ADDR NetBrdcastMask;
- INTN Len;
- INTN Type;
-
//
// Only support the station address with 0.0.0.0/0 to enable DHCP client.
//
@@ -301,29 +297,16 @@ Ip4StationAddressValid (
//
// Only support the continuous net masks
//
- if ((Len = NetGetMaskLength (Netmask)) == (IP4_MASK_MAX + 1)) {
+ if (NetGetMaskLength (Netmask) == (IP4_MASK_MAX + 1)) {
return FALSE;
}
//
// Station address can't be class D or class E address
//
- if ((Type = NetGetIpClass (Ip)) > IP4_ADDR_CLASSC) {
- return FALSE;
- }
-
- //
- // Station address can't be subnet broadcast/net broadcast address
- //
- if ((Ip == (Ip & Netmask)) || (Ip == (Ip | ~Netmask))) {
+ if (NetGetIpClass (Ip) > IP4_ADDR_CLASSC) {
return FALSE;
}
- NetBrdcastMask = gIp4AllMasks[MIN (Len, Type << 3)];
-
- if (Ip == (Ip | ~NetBrdcastMask)) {
- return FALSE;
- }
-
- return TRUE;
-} \ No newline at end of file
+ return NetIp4IsUnicast (Ip, Netmask);
+}