[SLOF] [PATCH v2 4/4] net: Remove remainders of the MTFTP code

Thomas Huth thuth at redhat.com
Fri Jun 10 18:33:32 AEST 2016


The separate mtftp.h and mtftp.c files (for doing multicast TFTP)
never really got included into the SLOF repository, so it does
not make sense to keep the "#ifdef USE_MTFTP" code snippets around.

Signed-off-by: Thomas Huth <thuth at redhat.com>
---
 lib/libnet/dhcp.h |  7 +------
 lib/libnet/udp.c  | 38 --------------------------------------
 lib/libnet/udp.h  |  5 -----
 3 files changed, 1 insertion(+), 49 deletions(-)

diff --git a/lib/libnet/dhcp.h b/lib/libnet/dhcp.h
index 645fdd1..4432c9b 100644
--- a/lib/libnet/dhcp.h
+++ b/lib/libnet/dhcp.h
@@ -14,12 +14,7 @@
 #define _DHCP_H_
 
 #include <stdint.h>
-
-#ifdef USE_MTFTP
-#include <mtftp.h>
-#else
-#include <tftp.h>
-#endif
+#include "tftp.h"
 
 /** \struct btphdr
  *  A header for BootP/DHCP-messages.
diff --git a/lib/libnet/udp.c b/lib/libnet/udp.c
index 1203947..d6982ea 100644
--- a/lib/libnet/udp.c
+++ b/lib/libnet/udp.c
@@ -17,34 +17,9 @@
 #include <dhcp.h>
 #include <dhcpv6.h>
 #include <dns.h>
-#ifdef USE_MTFTP
-#include <mtftp.h>
-#else
 #include <tftp.h>
-#endif
 
 
-
-/****************************** LOCAL VARIABLES **************************/
-
-
-#ifdef USE_MTFTP
-
-uint16_t net_tftp_uport;
-uint16_t net_mtftp_uport;
-
-void net_set_tftp_port(uint16_t tftp_port)
-{
-	net_tftp_uport = tftp_port;
-}
-
-void net_set_mtftp_port(uint16_t tftp_port)
-{
-	net_mtftp_uport = tftp_port;
-}
-
-#endif
-
 /****************************** IMPLEMENTATION ***************************/
 
 
@@ -82,21 +57,8 @@ int8_t handle_udp(int fd, uint8_t * udp_packet, uint32_t packetsize)
 		return handle_dhcpv6(udp_packet+sizeof(struct udphdr),
 		                     packetsize - sizeof(struct udphdr));
 	case UDPPORT_TFTPC:
-#ifdef USE_MTFTP
-		return handle_tftp(fd, udp_packet + sizeof(struct udphdr),
-			               packetsize - sizeof(struct udphdr));
-#else
 		return handle_tftp(fd, udp_packet, packetsize);
-#endif
 	default:
-#ifdef USE_MTFTP
-		if (htons(udph -> uh_dport) == net_tftp_uport)
-			return handle_tftp(fd, udp_packet + sizeof(struct udphdr),
-                       packetsize - sizeof(struct udphdr));
-		else if (htons(udph -> uh_dport) == net_mtftp_uport)
-			return handle_tftp(fd, udp_packet + sizeof(struct udphdr),
-                       packetsize - sizeof(struct udphdr));
-#endif
 		return -1;
 	}
 }
diff --git a/lib/libnet/udp.h b/lib/libnet/udp.h
index f154542..e716e04 100644
--- a/lib/libnet/udp.h
+++ b/lib/libnet/udp.h
@@ -50,9 +50,4 @@ extern void handle_udp_dun(uint8_t * udp_packet, uint32_t packetsize, uint8_t er
 extern void fill_udphdr(uint8_t *packet, uint16_t packetsize,
                         uint16_t src_port, uint16_t dest_port);
 
-#ifdef USE_MTFTP
-extern void net_set_tftp_port(uint16_t tftp_port);
-extern void net_set_mtftp_port(uint16_t tftp_port);
-#endif
-
 #endif
-- 
1.8.3.1



More information about the SLOF mailing list