1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 18:36:16 +02:00
wernermisc/m1/patches/rtems/bootp-dhcp-cleanup.patch

188 lines
6.0 KiB
Diff
Raw Normal View History

commit c4fc8e1f7ebc16926a7b2c64cb433bf03408a04f
Author: Sebastien Bourdeauducq <sebastien@milkymist.org>
Date: Fri Feb 24 21:57:21 2012 +0100
BOOTP/DHCP header cleanup
2012-05-14 07:36:46 +03:00
Index: rtems/cpukit/libnetworking/nfs/bootp_subr.c
===================================================================
--- rtems.orig/cpukit/libnetworking/nfs/bootp_subr.c 2012-05-14 12:34:47.187532000 +0800
+++ rtems/cpukit/libnetworking/nfs/bootp_subr.c 2012-05-14 12:35:20.155040001 +0800
@@ -69,9 +69,12 @@
#include <fcntl.h>
#include <rtems/mkrootfs.h>
#include <rtems/rtems_bsdnet.h>
+#include <rtems/rtems_bsdnet_internal.h>
#include <rtems/bsdnet/servers.h>
#include <inttypes.h>
+#include "rtems/bootp.h"
+
#define BOOTP_MIN_LEN 300 /* Minimum size of bootp udp packet */
/*
2012-05-14 07:36:46 +03:00
@@ -136,20 +139,6 @@
void bootpboot_p_iflist(void);
#endif
-int bootpc_call(struct bootp_packet *call,
- struct bootp_packet *reply,
- struct proc *procp);
-
-int bootpc_fakeup_interface(struct ifreq *ireq,struct socket *so,
- struct proc *procp);
-
-int
-bootpc_adjust_interface(struct ifreq *ireq,struct socket *so,
- struct sockaddr_in *myaddr,
- struct sockaddr_in *netmask,
- struct sockaddr_in *gw,
- struct proc *procp);
-
#ifdef BOOTP_DEBUG
void
bootpboot_p_sa(struct sockaddr *sa, struct sockaddr *ma)
2012-05-14 07:36:46 +03:00
@@ -269,7 +258,7 @@
* - allocate or reallocate dst, so that string fits in
* - copy string from src to dest
*/
-static void *bootp_strdup_realloc(char *dst,const char *src)
+void *bootp_strdup_realloc(char *dst,const char *src)
{
size_t len;
2012-05-14 07:36:46 +03:00
Index: rtems/cpukit/libnetworking/rtems/bootp.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ rtems/cpukit/libnetworking/rtems/bootp.h 2012-05-14 12:35:20.155040001 +0800
@@ -0,0 +1,39 @@
+/* Subroutines from c/src/libnetworking/nfs/bootp_subr.c */
+
+#if !defined (__RTEMS_BOOTP_H__)
+#define __RTEMS_BOOTP_H__
+
+#if __cplusplus
+extern "C"
+{
+#endif
+
+struct bootp_packet;
+struct proc;
+struct ifreq;
+struct socket;
+struct sockaddr_in;
+
+bool bootpc_init(bool, bool);
+
+int bootpc_call(
+ struct bootp_packet *call,
+ struct bootp_packet *reply,
+ struct proc *procp);
+int bootpc_fakeup_interface(struct ifreq *ireq,
+ struct socket *so,
+ struct proc *procp);
+int bootpc_adjust_interface(struct ifreq *ireq,
+ struct socket *so,
+ struct sockaddr_in *myaddr,
+ struct sockaddr_in *netmask,
+ struct sockaddr_in *gw,
+ struct proc *procp);
+
+void *bootp_strdup_realloc(char *dst, const char *src);
+
+#if __cplusplus
+}
+#endif
+
+#endif
2012-05-14 07:36:46 +03:00
Index: rtems/cpukit/libnetworking/rtems/rtems_bootp.c
===================================================================
--- rtems.orig/cpukit/libnetworking/rtems/rtems_bootp.c 2012-05-14 12:34:47.195528000 +0800
+++ rtems/cpukit/libnetworking/rtems/rtems_bootp.c 2012-05-14 12:35:20.155040001 +0800
@@ -8,6 +8,8 @@
#include <rtems/rtems_bsdnet.h>
#include <rtems/rtems_bsdnet_internal.h>
+#include "rtems/bootp.h"
+
/*
* Perform a BOOTP request
*/
2012-05-14 07:36:46 +03:00
Index: rtems/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
===================================================================
--- rtems.orig/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h 2012-05-14 12:34:47.223514000 +0800
+++ rtems/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h 2012-05-14 12:35:20.155040001 +0800
@@ -178,7 +178,6 @@
void ifinit (void *);
void ipintr (void);
void arpintr (void);
-bool bootpc_init(bool, bool);
int socket (int, int, int);
int ioctl (int, ioctl_command_t, ...);
2012-05-14 07:36:46 +03:00
Index: rtems/cpukit/libnetworking/rtems/rtems_dhcp.c
===================================================================
--- rtems.orig/cpukit/libnetworking/rtems/rtems_dhcp.c 2012-05-14 12:35:04.922660000 +0800
+++ rtems/cpukit/libnetworking/rtems/rtems_dhcp.c 2012-05-14 12:35:20.155040001 +0800
@@ -99,6 +99,7 @@
#include <rtems/mkrootfs.h>
#include "rtems/dhcp.h"
+#include "rtems/bootp.h"
#ifndef EALEN
#define EALEN 6
2012-05-14 07:36:46 +03:00
@@ -167,25 +168,6 @@
};
/*
- * External Declarations for Functions found in
- * rtems/c/src/libnetworking/nfs/
- */
-extern int bootpc_call (struct dhcp_packet *call,
- struct dhcp_packet *reply,
- struct proc *procp);
-extern int bootpc_fakeup_interface (struct ifreq *ireq,
- struct socket *so,
- struct proc *procp);
-extern int bootpc_adjust_interface (struct ifreq *ireq,
- struct socket *so,
- struct sockaddr_in *myaddr,
- struct sockaddr_in *netmask,
- struct sockaddr_in *gw,
- struct proc *procp);
-extern void *bootp_strdup_realloc (char *dst,
- const char *src);
-
-/*
* Variables
*/
static int dhcp_option_overload = 0;
2012-05-14 07:36:46 +03:00
@@ -755,7 +737,7 @@
/*
* Send the Request.
*/
- error = bootpc_call (&call, &dhcp_req, procp);
+ error = bootpc_call ((struct bootp_packet *)&call, (struct bootp_packet *)&dhcp_req, procp);
if (error) {
rtems_bsdnet_semaphore_release ();
printf ("DHCP call failed -- error %d", error);
2012-05-14 07:36:46 +03:00
@@ -960,7 +942,7 @@
/*
* Send the Discover.
*/
- error = bootpc_call (&call, &reply, procp);
+ error = bootpc_call ((struct bootp_packet *)&call, (struct bootp_packet *)&reply, procp);
if (error) {
printf ("BOOTP call failed -- %s\n", strerror(error));
soclose (so);
2012-05-14 07:36:46 +03:00
@@ -989,7 +971,7 @@
*/
dhcp_request_req (&call, &reply, sdl, true);
- error = bootpc_call (&call, &reply, procp);
+ error = bootpc_call ((struct bootp_packet *)&call, (struct bootp_packet *)&reply, procp);
if (error) {
printf ("BOOTP call failed -- %s\n", strerror(error));
soclose (so);