summaryrefslogtreecommitdiff
path: root/AppPkg
diff options
context:
space:
mode:
authorlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>2013-02-08 21:33:02 +0000
committerlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>2013-02-08 21:33:02 +0000
commitb8a86b22291344499256f735c47c341d2a105986 (patch)
treecacf840d69be211d5ea215db8424252259723344 /AppPkg
parent7d5c23a737d1f2b9aca34731e813aa77eaae4ab5 (diff)
downloadedk2-platforms-b8a86b22291344499256f735c47c341d2a105986.tar.xz
- For writing sin_port, htons() must be used.
- For reading sin_port, ntohs() must be used. - EFI_TCP4_ACCESS_POINT.RemotePort is in host byte order (see StdLib/EfiSocketLib/Tcp4.c for example). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: lpleahy git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14126 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'AppPkg')
-rw-r--r--AppPkg/Applications/Sockets/DataSource/DataSource.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/AppPkg/Applications/Sockets/DataSource/DataSource.c b/AppPkg/Applications/Sockets/DataSource/DataSource.c
index cf4caa2b45..0dcd882edf 100644
--- a/AppPkg/Applications/Sockets/DataSource/DataSource.c
+++ b/AppPkg/Applications/Sockets/DataSource/DataSource.c
@@ -386,7 +386,7 @@ SocketConnect (
( pRemoteAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pRemoteAddress4->sin_port ));
+ ntohs ( pRemoteAddress4->sin_port ));
}
else {
Print ( L"Connecting to remote system [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n",
@@ -406,7 +406,7 @@ SocketConnect (
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pRemoteAddress6->sin6_port ));
+ ntohs ( pRemoteAddress6->sin6_port ));
}
//
@@ -441,7 +441,7 @@ SocketConnect (
( pRemoteAddress4->sin_addr.s_addr >> 8 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 16 ) & 0xff,
( pRemoteAddress4->sin_addr.s_addr >> 24 ) & 0xff,
- htons ( pRemoteAddress4->sin_port ));
+ ntohs ( pRemoteAddress4->sin_port ));
}
else {
Print ( L"Connected to remote system [%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%d\r\n",
@@ -461,8 +461,9 @@ SocketConnect (
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 13 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 14 ],
pRemoteAddress6->sin6_addr.__u6_addr.__u6_addr8[ 15 ],
- htons ( pRemoteAddress6->sin6_port ));
+ ntohs ( pRemoteAddress6->sin6_port ));
}
+Print ( L"ConnectStatus: %d, Status: %r\r\n", ConnectStatus, Status );
}
else {
//
@@ -478,6 +479,7 @@ SocketConnect (
//
// Return the operation status
//
+Print ( L"SocketConnect returning Status: %r\r\n", Status );
return Status;
}
@@ -571,6 +573,7 @@ SocketSend (
DEBUG (( DEBUG_INFO,
"ERROR: send failed, errno: %d\r\n",
errno ));
+Print ( L"ERROR: send failed, errno: %d\r\n", errno );
//
// Try again
@@ -636,6 +639,7 @@ SocketOpen (
// Wait for the remote network application to start
//
Status = SocketConnect ( );
+Print ( L"Status: %r\r\n", Status );
if ( EFI_NOT_STARTED == Status ) {
Status = SocketClose ( );
continue;
@@ -659,6 +663,7 @@ SocketOpen (
//
// Return the operation status
//
+Print ( L"Returning Status: %r\r\n", Status );
return Status;
}
@@ -720,7 +725,7 @@ Tcp4Close (
pIpAddress[1],
pIpAddress[2],
pIpAddress[3],
- htons ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));
+ ntohs ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));
}
}
}
@@ -922,7 +927,7 @@ Tcp4Locate (
pIpAddress[1],
pIpAddress[2],
pIpAddress[3],
- htons ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));
+ ntohs ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));
bTcp4Connecting = FALSE;
}
@@ -1229,7 +1234,7 @@ Tcp4Open (
Tcp4ConfigData.AccessPoint.RemoteAddress.Addr[1] = (UINT8)( ((struct sockaddr_in *)&RemoteHostAddress)->sin_addr.s_addr >> 8 );
Tcp4ConfigData.AccessPoint.RemoteAddress.Addr[2] = (UINT8)( ((struct sockaddr_in *)&RemoteHostAddress)->sin_addr.s_addr >> 16 );
Tcp4ConfigData.AccessPoint.RemoteAddress.Addr[3] = (UINT8)( ((struct sockaddr_in *)&RemoteHostAddress)->sin_addr.s_addr >> 24 );
- Tcp4ConfigData.AccessPoint.RemotePort = ((struct sockaddr_in *)&RemoteHostAddress)->sin_port;
+ Tcp4ConfigData.AccessPoint.RemotePort = ntohs (((struct sockaddr_in *)&RemoteHostAddress)->sin_port);
Tcp4ConfigData.AccessPoint.UseDefaultAddress = TRUE;
Tcp4ConfigData.AccessPoint.SubnetMask.Addr[0] = 0;
Tcp4ConfigData.AccessPoint.SubnetMask.Addr[1] = 0;
@@ -1288,7 +1293,7 @@ Tcp4Open (
pIpAddress[1],
pIpAddress[2],
pIpAddress[3],
- htons ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));
+ ntohs ( ((struct sockaddr_in *)&RemoteHostAddress)->sin_port ));
} while ( 0 );
if ( EFI_ERROR ( Status )) {