Commit Graph

32 Commits

Author SHA1 Message Date
Olivier Martin b81cc7d624 StdLib: Fix more GCC warnings/errors caused by variables being set but not used.
Removed variables that had no effect on code behavior.
Normalized comment formatting.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed by: Daryl McDaniel <daryl.mcdaniel@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16286 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-31 20:32:02 +00:00
Olivier Martin beaaa3b715 StdLib: Fix more GCC warnings/errors caused by variables being set but not used.
Removed variables that had no effect on code behavior.
Normalized comment formatting.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed by: Daryl McDaniel <daryl.mcdaniel@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16284 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-31 17:50:33 +00:00
Olivier Martin 0e565888ee StdLib: Fix GCC warnings/errors caused by variables being set but not used.
Removed variables that had no effect on code behavior.

Fifo.c::FIFO_Dequeue: Replaced instances of "Self->ElementSize" with preexisting variable "SizeOfElement".

IIOutilities.c::IIO_GetInChar: Fixed variable of wrong, but compatible, type and made updating of housekeeping variables dependent upon successful completion of reading from the buffer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed by: Daryl McDaniel <daryl.mcdaniel@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16276 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-30 01:05:22 +00:00
daryl.mcdaniel 0164fc8e76 StdLib: Fix some build problems and obscure bugs.
StdLib\
  BsdSocketLib\
    ns_print.c
      Use "%lu" format instead of "%Lu".  A capital 'L' specifies (long double) in print formats.
      Add a cast from char to (unsigned int) to match its sprintf format.
    res_debug.c
      Use "%lu" format instead of "%Lu".  A capital 'L' specifies (long double) in print formats.
  EfiSocketLib\
    Socket.c
      Update copyright & correct formatting
  Include\
    sys\
      EfiCdefs.h
        Update copyright date
        Change type of LONGN and ULONGN to INTN and UINTN, respectively.
      errno.h
        Update copyright date
        Add enum member '__ESUCCESS = 0'
      fcntl.h
        Update copyright date
        Improve comment for O_EXCL
      stat.h
        Update copyright date
        Reorder the S_* flags
        Put the S_* predicate macros in the same order as their flag definitions
        Add a function header comment to the stat() function declaration.
    errno.h
      Update copyright date
      Define new ESUCCESS error code
    wchar.h
      Update copyright date
      Correct the description of the Nptr parameter to the wcstol, wcstoll, wcstoul, and wcstoull functions.
    x86\float.h
      Update copyright date
      Define 'long double' limits for non-Microsoft compilers
  LibC\
    Containers\Queues\Fifo.c
      Rewrite to make more robust and secure (zeros out old data)
    StdLib\realpath.c
      Update copyright date
      Reformat descriptive comment for realpath()
      Add terminating CRLF

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by:  daryl.mcdaniel@intel.com
Reviewed-by:  Erik Bjorge <erik.c.bjorge@intel.com>
Reviewed-by:  Jaben Carsey <Jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16096 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-11 21:42:26 +00:00
leroy.p.leahy eb5b60155a Fix TCP4/TCP6 connections. Connections were transitioning into the connected state and the polling was returning an error. Fix the polling routine to return success in this case.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: leroy.p.leahy@intel.com
Reviewed-by: SREENIVASULA_REDDY@Dell.com



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15355 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-20 22:05:51 +00:00
lpleahy leroy.p.leahy ceecdc62ab Fix the non-blocking behavior for connect. The behavior was correct if the code polled the connect routine but was not correct when using select to complete the asynchronous request. This change fixes the select case by moving where some of the operations performed upon the connection completion.
Signed-off-by: lpleahy  leroy.p.leahy@intel.com
Reviewed-by: Daniel Moura  oxesoft@gmail.com


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14984 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-13 19:22:39 +00:00
Lee Leahy a93b0f4549 Fix GCC build errors
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14876 6f19259b-4bc3-4df7-8a09-765794883524
2013-11-20 19:07:31 +00:00
Lee Leahy 2dc09dd50f Ignore transmit errors for UDPv4, UDPv6 and IPv4.
Support local bind by validating the IP address using the IP configuration protocol.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com>
Reviewed-by: Ankit Singh3 <Ankit_Singh3@Dell.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14875 6f19259b-4bc3-4df7-8a09-765794883524
2013-11-20 18:31:01 +00:00
lpleahy 985fef803e Otherwise gcc can default to the "sysv_abi" (as opposed to the "ms_abi") calling convention on X64, causing problems like <http://sourceforge.net/mailarchive/message.php?msg_id=30356166>.
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@14148 6f19259b-4bc3-4df7-8a09-765794883524
2013-02-27 22:15:36 +00:00
lpleahy 7d5c23a737 Increase sockets performance by increasing the maximum buffer sizes.
Tested using: DataSource/DataSink
Signed-off-by: lpleahy


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14125 6f19259b-4bc3-4df7-8a09-765794883524
2013-02-08 21:31:16 +00:00
lpleahy 1c740a7d05 Allow fragmentation of large UDP packets
Reviewed-by: Ankit Singh of Dell
Signed-off-by: lpleahy


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14124 6f19259b-4bc3-4df7-8a09-765794883524
2013-02-08 21:29:03 +00:00
lpleahy 10e726cf65 Poll the network adapter during connect
Signed-off-by: lpleahy
Reviewed-by: Dell, Sreenivasula Reddy

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13803 6f19259b-4bc3-4df7-8a09-765794883524
2012-10-08 22:02:23 +00:00
lpleahy 4652be0c5a Fixed close for socket to properly release the socket context structure and the handle.
Signed-off-by: lpleahy


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13802 6f19259b-4bc3-4df7-8a09-765794883524
2012-10-08 21:39:35 +00:00
lpleahy 884ed92356 Modify UDP and IP to transmit on all network adapters instead of just the first network adapter.
Fix comment in Socket.c.

Signed-off-by: lpleahy
Reviewed and tested by: Sreenivasula Reddy of Dell


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13713 6f19259b-4bc3-4df7-8a09-765794883524
2012-09-10 19:04:41 +00:00
lpleahy bb3aa953b3 Return the proper status after one of the ports is configured for UDP or IP communications.
Reviewed by: Ankit Singh of Dell
Submitted by: lpleahy


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13604 6f19259b-4bc3-4df7-8a09-765794883524
2012-08-10 01:13:05 +00:00
lpleahy 6e1450f309 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
2012-06-29 00:46:58 +00:00
lpleahy 18757e7028 Define the global variables as weak to enable the proper linking with applications and the Sockets driver.
Submitted-by: Oliver Martin
Reviewed-by: lpleahy


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13475 6f19259b-4bc3-4df7-8a09-765794883524
2012-06-26 17:45:56 +00:00
lpleahy b497a8a894 Fix listen exit path when last port returns an error.
Signed-off-by: lpleahy


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13466 6f19259b-4bc3-4df7-8a09-765794883524
2012-06-22 21:46:55 +00:00
lpleahy 44538ba5aa Fix port retry behavior during connect - All port error paths exit through ConnectComplete to try the next port. When the last port fails to connect, the port error status to errno translation gets done by ConnectPoll.
Testing:
Using two network adapters, second one always connected to the network.

1. Eth0 not configured, not connected - short delay
2. Eth0 not configured, connected - short delay
3. Eth0 configured, not connected - short delay
4. Eth0 configured, connected to private network - long delay due to connection timeout, failover to Eth1
5. Eth1 configured, connected, no server - long delay due to connection timeout, returned timeout error.


Signed-off-by: lpleahy

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13436 6f19259b-4bc3-4df7-8a09-765794883524
2012-06-08 20:53:12 +00:00
lpleahy 3a2fc8780f Only use ports with a network connection (media present) when connecting to a remote host.
Fix bug causing early exit with NO_MEDIA.
Add fix to TCP6.

Signed-off-by: lpleahy


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13432 6f19259b-4bc3-4df7-8a09-765794883524
2012-06-07 17:38:09 +00:00
lpleahy d6f19057f0 Only use ports with a network connection (media present) when connecting to a remote host.
Signed-off-by: lpleahy
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13427 6f19259b-4bc3-4df7-8a09-765794883524
2012-06-04 20:38:03 +00:00
lpleahy 441f48f5b0 UseEfiSocketLib.c - Only exit for out of resources, otherwise use all network adapters.
Service.c - Return EFI_SUCCESS if any of the protocols are present.  Return failure only when no protocols are available or no more memory available.

Signed-off-by: lpleahy
Reviewed-by: vzimmer

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13426 6f19259b-4bc3-4df7-8a09-765794883524
2012-06-01 20:01:30 +00:00
lpleahy fcb6f89d01 Fix read issue detected by the following Python program. The issue was that the caller's buffer pointer was not being advanced between segments of the read data.
Signed-off-by: lpleahy

-----  UnbufferedRead.py  -----

import httplib
conn = httplib.HTTPConnection("10.241.97.30")
conn.request('GET', '/')
resp = conn.getresponse(buffering=True)
if resp.status != 200:
   print "status:", resp.status
   print "aborting"
   sys.exit(1)
while True:
   chunk = resp.read()
   if not chunk:
       break
   print chunk


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13077 6f19259b-4bc3-4df7-8a09-765794883524
2012-03-05 19:05:47 +00:00
lpleahy f74dc4bbba Fix issues detected by python web-server.
* Removed display of TPL
* Added NOP implementation for SO_REUSEADDR
* Add better detection of socket address
* Return first address

Signed-off-by: lpleahy

Python Web server below:

---------------

import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler


HandlerClass = SimpleHTTPRequestHandler
ServerClass  = BaseHTTPServer.HTTPServer
Protocol     = "HTTP/1.0"

port = 80
server_address = ('', port)

HandlerClass.protocol_version = Protocol
httpd = ServerClass(server_address, HandlerClass)

sa = httpd.socket.getsockname()
print "Serving HTTP on", sa[0], "port", sa[1], "..."
httpd.serve_forever()




git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13034 6f19259b-4bc3-4df7-8a09-765794883524
2012-02-24 18:45:09 +00:00
lpleahy 28de825561 Bug fix: CreateEvent sometimes returning EFI_INVALID_PARAMETER due to bad TPL value. Use known good TPL value since TPL is a don't care.
Found, reviewed and tested by: Duane Voth
Signed-off-by: lpleahy

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13017 6f19259b-4bc3-4df7-8a09-765794883524
2012-02-15 23:24:58 +00:00
lpleahy 3bdf9aae5f Merged socket development branch:
* Fixed bug report (Duane Voth: Python sockets test application not working) by starting the receive operations when a connection is established!
* Increased performance by extending the idle loop into the network stack with the Poll call.
* Added support for TCPv6 (SOCK_STREAM) and UDPv6 (SOCK_DGRAM).
* Added support for getaddrinfo and getnameinfo calls.
* Moved application PCD values into AppPkg

Signed-off-by: lpleahy

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13002 6f19259b-4bc3-4df7-8a09-765794883524
2012-02-09 19:16:44 +00:00
lpleahy 58081f2c64 Fix compilation errors detected with GCC 4.4
Signed-off-by: lpleahy

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12504 6f19259b-4bc3-4df7-8a09-765794883524
2011-09-30 23:52:45 +00:00
lpleahy a88c31639b Update the sockets library code
* Passes conformance and functional tests.
* Builds with GCC 4.4 compiler.

Signed-off by: lpleahy


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12497 6f19259b-4bc3-4df7-8a09-765794883524
2011-09-30 23:02:35 +00:00
lpleahy 1c34b250f6 Better handle transmit errors
Return 0 receive bytes when socket is closed


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12099 6f19259b-4bc3-4df7-8a09-765794883524
2011-08-08 18:19:45 +00:00
lpleahy d1cab2b8c1 Remove SocketPkg references
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12096 6f19259b-4bc3-4df7-8a09-765794883524
2011-08-08 17:38:14 +00:00
darylm503 eb222aea1d Fix GCC build breaks.
Fix case mismatch for includes of "Socket.h".  Original code was <socket.h> while file was Socket.h in the same directory as the .c file.
Add EFIAPI to function declarations so that they match the definition.
Remove "ineffective" statements from stub functions.


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12076 6f19259b-4bc3-4df7-8a09-765794883524
2011-08-02 20:52:36 +00:00
darylm503 d7ce700605 Add Socket Libraries.
Add Posix functions for porting compatibility.
Fix compliance issues with ISO/IEC 9899:199409
New Functions:
  setenv(), fparseln(), GetFileNameFromPath(), rename(),
  realpath(), setprogname(), getprogname(), strlcat(), strlcpy(),
  strsep(), setitimer(), getitimer(), timegm(), getopt(), basename(),
  mkstemp(), ffs(), vsnprintf(), snprintf(), getpass(), usleep(), select(),
  writev(), strcasecmp(), getcwd(), chdir(), tcgetpgrp(), getpgrp(), gettimeofday(),
  bcopy(), 


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12061 6f19259b-4bc3-4df7-8a09-765794883524
2011-07-30 00:30:44 +00:00