}\r
else {\r
pConfig->SubnetMask.Addr[0] = 0xff;\r
- pConfig->SubnetMask.Addr[1] = 0xff;\r
- pConfig->SubnetMask.Addr[2] = 0xff;\r
- pConfig->SubnetMask.Addr[3] = 0xff;\r
+ pConfig->SubnetMask.Addr[1] = ( 128 <= pConfig->StationAddress.Addr[0]) ? 0xff : 0;\r
+ pConfig->SubnetMask.Addr[2] = ( 192 <= pConfig->StationAddress.Addr[0]) ? 0xff : 0;\r
+ pConfig->SubnetMask.Addr[3] = ( 224 <= pConfig->StationAddress.Addr[0]) ? 0xff : 0;\r
}\r
}\r
\r
pIp4->DestinationAddress.Addr[1] = (UINT8)( pRemoteAddress->sin_addr.s_addr >> 8 );\r
pIp4->DestinationAddress.Addr[2] = (UINT8)( pRemoteAddress->sin_addr.s_addr >> 16 );\r
pIp4->DestinationAddress.Addr[3] = (UINT8)( pRemoteAddress->sin_addr.s_addr >> 24 );\r
+ pPort->pSocket->bAddressSet = TRUE;\r
Status = EFI_SUCCESS;\r
\r
//\r
//\r
// Fill in the port list if necessary\r
//\r
+ pSocket->errno = ENETDOWN;\r
if ( NULL == pSocket->pPortList ) {\r
LocalAddress.sin_len = sizeof ( LocalAddress );\r
LocalAddress.sin_family = AF_INET;\r
NULL );\r
}\r
if ( EFI_ERROR ( Status )) {\r
- DEBUG (( DEBUG_LISTEN,\r
- "ERROR - Failed to configure the Ip4 port, Status: %r\r\n",\r
- Status ));\r
- switch ( Status ) {\r
- case EFI_ACCESS_DENIED:\r
- pSocket->errno = EACCES;\r
- break;\r
+ if ( !pSocket->bConfigured ) {\r
+ DEBUG (( DEBUG_LISTEN,\r
+ "ERROR - Failed to configure the Ip4 port, Status: %r\r\n",\r
+ Status ));\r
+ switch ( Status ) {\r
+ case EFI_ACCESS_DENIED:\r
+ pSocket->errno = EACCES;\r
+ break;\r
+\r
+ default:\r
+ case EFI_DEVICE_ERROR:\r
+ pSocket->errno = EIO;\r
+ break;\r
\r
- default:\r
- case EFI_DEVICE_ERROR:\r
- pSocket->errno = EIO;\r
- break;\r
+ case EFI_INVALID_PARAMETER:\r
+ pSocket->errno = EADDRNOTAVAIL;\r
+ break;\r
\r
- case EFI_INVALID_PARAMETER:\r
- pSocket->errno = EADDRNOTAVAIL;\r
- break;\r
+ case EFI_NO_MAPPING:\r
+ pSocket->errno = EAFNOSUPPORT;\r
+ break;\r
\r
- case EFI_NO_MAPPING:\r
- pSocket->errno = EAFNOSUPPORT;\r
- break;\r
-\r
- case EFI_OUT_OF_RESOURCES:\r
- pSocket->errno = ENOBUFS;\r
- break;\r
+ case EFI_OUT_OF_RESOURCES:\r
+ pSocket->errno = ENOBUFS;\r
+ break;\r
\r
- case EFI_UNSUPPORTED:\r
- pSocket->errno = EOPNOTSUPP;\r
- break;\r
+ case EFI_UNSUPPORTED:\r
+ pSocket->errno = EOPNOTSUPP;\r
+ break;\r
+ }\r
}\r
}\r
else {\r
pIp4->ModeData.RouteTable[Index].GatewayAddress.Addr[3]));\r
}\r
pPort->bConfigured = TRUE;\r
+ pSocket->bConfigured = TRUE;\r
\r
//\r
// Start the first read on the port\r
// The socket is connected\r
//\r
pSocket->State = SOCKET_STATE_CONNECTED;\r
+ pSocket->errno = 0;\r
}\r
\r
//\r
//\r
pPort = pNextPort;\r
}\r
-\r
- //\r
- // Determine the configuration status\r
- //\r
- if ( NULL != pSocket->pPortList ) {\r
- pSocket->bConfigured = TRUE;\r
- }\r
}\r
\r
//\r
// Determine the socket configuration status\r
//\r
- if ( !EFI_ERROR ( Status )) {\r
- Status = pSocket->bConfigured ? EFI_SUCCESS : EFI_NOT_STARTED;\r
- }\r
+ Status = pSocket->bConfigured ? EFI_SUCCESS : EFI_NOT_STARTED;\r
\r
//\r
// Return the port connected state.\r
//\r
if ( SOCKET_STATE_CONNECTED == pSocket->State ) {\r
//\r
- // Locate the port\r
+ // Verify that there is enough room to buffer another\r
+ // transmit operation\r
//\r
- pPort = pSocket->pPortList;\r
- if ( NULL != pPort ) {\r
+ pTxBytes = &pSocket->TxBytes;\r
+ if ( pSocket->MaxTxBuf > *pTxBytes ) {\r
//\r
- // Determine the queue head\r
+ // Locate the port\r
//\r
- pIp4 = &pPort->Context.Ip4;\r
- pTxBytes = &pSocket->TxBytes;\r
+ pPort = pSocket->pPortList;\r
+ while ( NULL != pPort ) {\r
+ //\r
+ // Determine the queue head\r
+ //\r
+ pIp4 = &pPort->Context.Ip4;\r
\r
- //\r
- // Verify that there is enough room to buffer another\r
- // transmit operation\r
- //\r
- if ( pSocket->MaxTxBuf > *pTxBytes ) {\r
//\r
// Attempt to allocate the packet\r
//\r
// Free the packet\r
//\r
EslSocketPacketFree ( pPacket, DEBUG_TX );\r
+ break;\r
}\r
\r
//\r
// Packet allocation failed\r
//\r
pSocket->errno = ENOMEM;\r
+ break;\r
}\r
- }\r
- else {\r
+\r
//\r
- // Not enough buffer space available\r
+ // Set the next port\r
//\r
- pSocket->errno = EAGAIN;\r
- Status = EFI_NOT_READY;\r
+ pPort = pPort->pLinkSocket;\r
}\r
}\r
+ else {\r
+ //\r
+ // Not enough buffer space available\r
+ //\r
+ pSocket->errno = EAGAIN;\r
+ Status = EFI_NOT_READY;\r
+ }\r
}\r
\r
//\r