summaryrefslogtreecommitdiffstats
path: root/cpukit/libnetworking/lib/tftpDriver.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-30 09:24:44 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-05-02 09:56:48 +0200
commitc3bab73b4bb1b02879671d72ff96e625a1b4807e (patch)
tree0e4967c81c4e9ae913b465fecef7d55436537d13 /cpukit/libnetworking/lib/tftpDriver.c
parentlibdebugger: Move to separate library (diff)
downloadrtems-c3bab73b4bb1b02879671d72ff96e625a1b4807e.tar.bz2
tftpfs: Always build TFTP client
Move TFTP client filesystem to separate library libtftpfs.a. Conditionally use legacy network stack features, e.g. BOOTP support. Update #3419.
Diffstat (limited to '')
-rw-r--r--cpukit/libnetworking/lib/tftpDriver.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/cpukit/libnetworking/lib/tftpDriver.c b/cpukit/libnetworking/lib/tftpDriver.c
index 97c9998aec..514f931b13 100644
--- a/cpukit/libnetworking/lib/tftpDriver.c
+++ b/cpukit/libnetworking/lib/tftpDriver.c
@@ -28,7 +28,6 @@
#include <rtems.h>
#include <rtems/libio_.h>
#include <rtems/seterr.h>
-#include <rtems/rtems_bsdnet.h>
#include <rtems/tftp.h>
#include <rtems/thread.h>
#include <sys/types.h>
@@ -37,6 +36,10 @@
#include <arpa/inet.h>
#include <netdb.h>
+#ifdef RTEMS_NETWORKING
+#include <rtems/rtems_bsdnet.h>
+#endif
+
#ifdef RTEMS_TFTP_DRIVER_DEBUG
int rtems_tftp_driver_debug = 1;
#endif
@@ -537,9 +540,11 @@ static int rtems_tftp_open_worker(
*/
hostname = full_path_name;
cp1 = strchr (full_path_name, ':');
- if (!cp1)
+ if (!cp1) {
+#ifdef RTEMS_NETWORKING
hostname = "BOOTP_HOST";
- else {
+#endif
+ } else {
*cp1 = '\0';
++cp1;
}
@@ -547,9 +552,12 @@ static int rtems_tftp_open_worker(
/*
* Convert hostname to Internet address
*/
+#ifdef RTEMS_NETWORKING
if (strcmp (hostname, "BOOTP_HOST") == 0)
farAddress = rtems_bsdnet_bootp_server_address;
- else if (inet_aton (hostname, &farAddress) == 0) {
+ else
+#endif
+ if (inet_aton (hostname, &farAddress) == 0) {
struct hostent *he = gethostbyname(hostname);
if (he == NULL)
return ENOENT;
@@ -559,9 +567,11 @@ static int rtems_tftp_open_worker(
/*
* Extract file pathname component
*/
+#ifdef RTEMS_NETWORKING
if (strcmp (cp1, "BOOTP_FILE") == 0) {
cp1 = rtems_bsdnet_bootp_boot_file_name;
}
+#endif
if (*cp1 == '\0')
return ENOENT;
remoteFilename = cp1;