summaryrefslogtreecommitdiff
path: root/StdLib/EfiSocketLib
diff options
context:
space:
mode:
authorlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>2012-06-29 00:46:58 +0000
committerlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>2012-06-29 00:46:58 +0000
commit6e1450f3095c90cf7119a4dbc8e6710daf988444 (patch)
treedf3672fbdadaf446bcf56df3beb00d9a6d83039b /StdLib/EfiSocketLib
parent79a45605ca06542a7b2f074651619e4e8038992a (diff)
downloadedk2-platforms-6e1450f3095c90cf7119a4dbc8e6710daf988444.tar.xz
Choose a better subnet mask value for the IPv4 address.
Signed-off-by: lpleahy git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13479 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'StdLib/EfiSocketLib')
-rw-r--r--StdLib/EfiSocketLib/Ip4.c6
-rw-r--r--StdLib/EfiSocketLib/Tcp4.c6
-rw-r--r--StdLib/EfiSocketLib/Udp4.c6
3 files changed, 9 insertions, 9 deletions
diff --git a/StdLib/EfiSocketLib/Ip4.c b/StdLib/EfiSocketLib/Ip4.c
index 5a0f5284f5..80f328a8dd 100644
--- a/StdLib/EfiSocketLib/Ip4.c
+++ b/StdLib/EfiSocketLib/Ip4.c
@@ -143,9 +143,9 @@ EslIp4LocalAddressSet (
}
else {
pConfig->SubnetMask.Addr[0] = 0xff;
- pConfig->SubnetMask.Addr[1] = 0xff;
- pConfig->SubnetMask.Addr[2] = 0xff;
- pConfig->SubnetMask.Addr[3] = 0xff;
+ pConfig->SubnetMask.Addr[1] = ( 128 <= pConfig->StationAddress.Addr[0]) ? 0xff : 0;
+ pConfig->SubnetMask.Addr[2] = ( 192 <= pConfig->StationAddress.Addr[0]) ? 0xff : 0;
+ pConfig->SubnetMask.Addr[3] = ( 224 <= pConfig->StationAddress.Addr[0]) ? 0xff : 0;
}
}
diff --git a/StdLib/EfiSocketLib/Tcp4.c b/StdLib/EfiSocketLib/Tcp4.c
index 145186bb36..34e60e2a7f 100644
--- a/StdLib/EfiSocketLib/Tcp4.c
+++ b/StdLib/EfiSocketLib/Tcp4.c
@@ -1157,9 +1157,9 @@ EslTcp4LocalAddressSet (
}
else {
pAccessPoint->SubnetMask.Addr[0] = 0xff;
- pAccessPoint->SubnetMask.Addr[1] = 0xff;
- pAccessPoint->SubnetMask.Addr[2] = 0xff;
- pAccessPoint->SubnetMask.Addr[3] = 0xff;
+ pAccessPoint->SubnetMask.Addr[1] = ( 128 <= pAccessPoint->StationAddress.Addr[0]) ? 0xff : 0;
+ pAccessPoint->SubnetMask.Addr[2] = ( 192 <= pAccessPoint->StationAddress.Addr[0]) ? 0xff : 0;
+ pAccessPoint->SubnetMask.Addr[3] = ( 224 <= pAccessPoint->StationAddress.Addr[0]) ? 0xff : 0;
}
//
diff --git a/StdLib/EfiSocketLib/Udp4.c b/StdLib/EfiSocketLib/Udp4.c
index ae67c4e8c5..026f850377 100644
--- a/StdLib/EfiSocketLib/Udp4.c
+++ b/StdLib/EfiSocketLib/Udp4.c
@@ -131,9 +131,9 @@ EslUdp4LocalAddressSet (
}
else {
pConfig->SubnetMask.Addr[0] = 0xff;
- pConfig->SubnetMask.Addr[1] = 0xff;
- pConfig->SubnetMask.Addr[2] = 0xff;
- pConfig->SubnetMask.Addr[3] = 0xff;
+ pConfig->SubnetMask.Addr[1] = ( 128 <= pConfig->StationAddress.Addr[0]) ? 0xff : 0;
+ pConfig->SubnetMask.Addr[2] = ( 192 <= pConfig->StationAddress.Addr[0]) ? 0xff : 0;
+ pConfig->SubnetMask.Addr[3] = ( 224 <= pConfig->StationAddress.Addr[0]) ? 0xff : 0;
}
//