Werner's Miscellanea
Sign in or create your account | Project List | Help
Werner's Miscellanea Git Source Tree
Root/
Source at commit b6b61b1 created 11 years 10 months ago. By Xiangfu, m1/patches/rtems: refresh | |
---|---|
1 | commit c4fc8e1f7ebc16926a7b2c64cb433bf03408a04f |
2 | Author: Sebastien Bourdeauducq <sebastien@milkymist.org> |
3 | Date: Fri Feb 24 21:57:21 2012 +0100 |
4 | |
5 | BOOTP/DHCP header cleanup |
6 | |
7 | Index: rtems/cpukit/libnetworking/nfs/bootp_subr.c |
8 | =================================================================== |
9 | --- rtems.orig/cpukit/libnetworking/nfs/bootp_subr.c 2012-05-14 12:34:47.187532000 +0800 |
10 | +++ rtems/cpukit/libnetworking/nfs/bootp_subr.c 2012-05-14 12:35:20.155040001 +0800 |
11 | @@ -69,9 +69,12 @@ |
12 | #include <fcntl.h> |
13 | #include <rtems/mkrootfs.h> |
14 | #include <rtems/rtems_bsdnet.h> |
15 | +#include <rtems/rtems_bsdnet_internal.h> |
16 | #include <rtems/bsdnet/servers.h> |
17 | #include <inttypes.h> |
18 | |
19 | +#include "rtems/bootp.h" |
20 | + |
21 | #define BOOTP_MIN_LEN 300 /* Minimum size of bootp udp packet */ |
22 | |
23 | /* |
24 | @@ -136,20 +139,6 @@ |
25 | void bootpboot_p_iflist(void); |
26 | #endif |
27 | |
28 | -int bootpc_call(struct bootp_packet *call, |
29 | - struct bootp_packet *reply, |
30 | - struct proc *procp); |
31 | - |
32 | -int bootpc_fakeup_interface(struct ifreq *ireq,struct socket *so, |
33 | - struct proc *procp); |
34 | - |
35 | -int |
36 | -bootpc_adjust_interface(struct ifreq *ireq,struct socket *so, |
37 | - struct sockaddr_in *myaddr, |
38 | - struct sockaddr_in *netmask, |
39 | - struct sockaddr_in *gw, |
40 | - struct proc *procp); |
41 | - |
42 | #ifdef BOOTP_DEBUG |
43 | void |
44 | bootpboot_p_sa(struct sockaddr *sa, struct sockaddr *ma) |
45 | @@ -269,7 +258,7 @@ |
46 | * - allocate or reallocate dst, so that string fits in |
47 | * - copy string from src to dest |
48 | */ |
49 | -static void *bootp_strdup_realloc(char *dst,const char *src) |
50 | +void *bootp_strdup_realloc(char *dst,const char *src) |
51 | { |
52 | size_t len; |
53 | |
54 | Index: rtems/cpukit/libnetworking/rtems/bootp.h |
55 | =================================================================== |
56 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
57 | +++ rtems/cpukit/libnetworking/rtems/bootp.h 2012-05-14 12:35:20.155040001 +0800 |
58 | @@ -0,0 +1,39 @@ |
59 | +/* Subroutines from c/src/libnetworking/nfs/bootp_subr.c */ |
60 | + |
61 | +#if !defined (__RTEMS_BOOTP_H__) |
62 | +#define __RTEMS_BOOTP_H__ |
63 | + |
64 | +#if __cplusplus |
65 | +extern "C" |
66 | +{ |
67 | +#endif |
68 | + |
69 | +struct bootp_packet; |
70 | +struct proc; |
71 | +struct ifreq; |
72 | +struct socket; |
73 | +struct sockaddr_in; |
74 | + |
75 | +bool bootpc_init(bool, bool); |
76 | + |
77 | +int bootpc_call( |
78 | + struct bootp_packet *call, |
79 | + struct bootp_packet *reply, |
80 | + struct proc *procp); |
81 | +int bootpc_fakeup_interface(struct ifreq *ireq, |
82 | + struct socket *so, |
83 | + struct proc *procp); |
84 | +int bootpc_adjust_interface(struct ifreq *ireq, |
85 | + struct socket *so, |
86 | + struct sockaddr_in *myaddr, |
87 | + struct sockaddr_in *netmask, |
88 | + struct sockaddr_in *gw, |
89 | + struct proc *procp); |
90 | + |
91 | +void *bootp_strdup_realloc(char *dst, const char *src); |
92 | + |
93 | +#if __cplusplus |
94 | +} |
95 | +#endif |
96 | + |
97 | +#endif |
98 | Index: rtems/cpukit/libnetworking/rtems/rtems_bootp.c |
99 | =================================================================== |
100 | --- rtems.orig/cpukit/libnetworking/rtems/rtems_bootp.c 2012-05-14 12:34:47.195528000 +0800 |
101 | +++ rtems/cpukit/libnetworking/rtems/rtems_bootp.c 2012-05-14 12:35:20.155040001 +0800 |
102 | @@ -8,6 +8,8 @@ |
103 | #include <rtems/rtems_bsdnet.h> |
104 | #include <rtems/rtems_bsdnet_internal.h> |
105 | |
106 | +#include "rtems/bootp.h" |
107 | + |
108 | /* |
109 | * Perform a BOOTP request |
110 | */ |
111 | Index: rtems/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h |
112 | =================================================================== |
113 | --- rtems.orig/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h 2012-05-14 12:34:47.223514000 +0800 |
114 | +++ rtems/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h 2012-05-14 12:35:20.155040001 +0800 |
115 | @@ -178,7 +178,6 @@ |
116 | void ifinit (void *); |
117 | void ipintr (void); |
118 | void arpintr (void); |
119 | -bool bootpc_init(bool, bool); |
120 | int socket (int, int, int); |
121 | int ioctl (int, ioctl_command_t, ...); |
122 | |
123 | Index: rtems/cpukit/libnetworking/rtems/rtems_dhcp.c |
124 | =================================================================== |
125 | --- rtems.orig/cpukit/libnetworking/rtems/rtems_dhcp.c 2012-05-14 12:35:04.922660000 +0800 |
126 | +++ rtems/cpukit/libnetworking/rtems/rtems_dhcp.c 2012-05-14 12:35:20.155040001 +0800 |
127 | @@ -99,6 +99,7 @@ |
128 | #include <rtems/mkrootfs.h> |
129 | |
130 | #include "rtems/dhcp.h" |
131 | +#include "rtems/bootp.h" |
132 | |
133 | #ifndef EALEN |
134 | #define EALEN 6 |
135 | @@ -167,25 +168,6 @@ |
136 | }; |
137 | |
138 | /* |
139 | - * External Declarations for Functions found in |
140 | - * rtems/c/src/libnetworking/nfs/ |
141 | - */ |
142 | -extern int bootpc_call (struct dhcp_packet *call, |
143 | - struct dhcp_packet *reply, |
144 | - struct proc *procp); |
145 | -extern int bootpc_fakeup_interface (struct ifreq *ireq, |
146 | - struct socket *so, |
147 | - struct proc *procp); |
148 | -extern int bootpc_adjust_interface (struct ifreq *ireq, |
149 | - struct socket *so, |
150 | - struct sockaddr_in *myaddr, |
151 | - struct sockaddr_in *netmask, |
152 | - struct sockaddr_in *gw, |
153 | - struct proc *procp); |
154 | -extern void *bootp_strdup_realloc (char *dst, |
155 | - const char *src); |
156 | - |
157 | -/* |
158 | * Variables |
159 | */ |
160 | static int dhcp_option_overload = 0; |
161 | @@ -755,7 +737,7 @@ |
162 | /* |
163 | * Send the Request. |
164 | */ |
165 | - error = bootpc_call (&call, &dhcp_req, procp); |
166 | + error = bootpc_call ((struct bootp_packet *)&call, (struct bootp_packet *)&dhcp_req, procp); |
167 | if (error) { |
168 | rtems_bsdnet_semaphore_release (); |
169 | printf ("DHCP call failed -- error %d", error); |
170 | @@ -960,7 +942,7 @@ |
171 | /* |
172 | * Send the Discover. |
173 | */ |
174 | - error = bootpc_call (&call, &reply, procp); |
175 | + error = bootpc_call ((struct bootp_packet *)&call, (struct bootp_packet *)&reply, procp); |
176 | if (error) { |
177 | printf ("BOOTP call failed -- %s\n", strerror(error)); |
178 | soclose (so); |
179 | @@ -989,7 +971,7 @@ |
180 | */ |
181 | dhcp_request_req (&call, &reply, sdl, true); |
182 | |
183 | - error = bootpc_call (&call, &reply, procp); |
184 | + error = bootpc_call ((struct bootp_packet *)&call, (struct bootp_packet *)&reply, procp); |
185 | if (error) { |
186 | printf ("BOOTP call failed -- %s\n", strerror(error)); |
187 | soclose (so); |
188 |
Branches:
master