Deleted Added
full compact
rmpproto.c (27077) rmpproto.c (27079)
1/*
2 * Copyright (c) 1988, 1992 The University of Utah and the Center
3 * for Software Science (CSS).
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * the Center for Software Science of the University of Utah Computer

--- 25 unchanged lines hidden (view full) ---

34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 *
41 * from: @(#)rmpproto.c 8.1 (Berkeley) 6/4/93
1/*
2 * Copyright (c) 1988, 1992 The University of Utah and the Center
3 * for Software Science (CSS).
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * the Center for Software Science of the University of Utah Computer

--- 25 unchanged lines hidden (view full) ---

34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 *
41 * from: @(#)rmpproto.c 8.1 (Berkeley) 6/4/93
42 * $Id$
42 * $Id: rmpproto.c,v 1.2 1997/06/29 19:00:24 steve Exp $
43 *
44 * From: Utah Hdr: rmpproto.c 3.1 92/07/06
45 * Author: Jeff Forys, University of Utah CSS
46 */
47
48#ifndef lint
49static const char sccsid[] = "@(#)rmpproto.c 8.1 (Berkeley) 6/4/93";
50#endif /* not lint */

--- 120 unchanged lines hidden (view full) ---

171**
172** Side Effects:
173** none.
174*/
175int
176SendServerID(rconn)
177 RMPCONN *rconn;
178{
43 *
44 * From: Utah Hdr: rmpproto.c 3.1 92/07/06
45 * Author: Jeff Forys, University of Utah CSS
46 */
47
48#ifndef lint
49static const char sccsid[] = "@(#)rmpproto.c 8.1 (Berkeley) 6/4/93";
50#endif /* not lint */

--- 120 unchanged lines hidden (view full) ---

171**
172** Side Effects:
173** none.
174*/
175int
176SendServerID(rconn)
177 RMPCONN *rconn;
178{
179 register struct rmp_packet *rpl;
180 register char *src, *dst;
181 register u_int8_t *size;
179 struct rmp_packet *rpl;
180 char *src, *dst;
181 u_int8_t *size;
182
183 rpl = &rconn->rmp; /* cache ptr to RMP packet */
184
185 /*
186 * Set up assorted fields in reply packet.
187 */
188 rpl->r_brpl.rmp_type = RMP_BOOT_REPL;
189 rpl->r_brpl.rmp_retcode = RMP_E_OKAY;

--- 35 unchanged lines hidden (view full) ---

225** none.
226*/
227int
228SendFileNo(req, rconn, filelist)
229 struct rmp_packet *req;
230 RMPCONN *rconn;
231 char *filelist[];
232{
182
183 rpl = &rconn->rmp; /* cache ptr to RMP packet */
184
185 /*
186 * Set up assorted fields in reply packet.
187 */
188 rpl->r_brpl.rmp_type = RMP_BOOT_REPL;
189 rpl->r_brpl.rmp_retcode = RMP_E_OKAY;

--- 35 unchanged lines hidden (view full) ---

225** none.
226*/
227int
228SendFileNo(req, rconn, filelist)
229 struct rmp_packet *req;
230 RMPCONN *rconn;
231 char *filelist[];
232{
233 register struct rmp_packet *rpl;
234 register char *src, *dst;
235 register u_int8_t *size;
236 register int i;
233 struct rmp_packet *rpl;
234 char *src, *dst;
235 u_int8_t *size;
236 int i;
237
238 GETWORD(req->r_brpl.rmp_seqno, i); /* SeqNo is really FileNo */
239 rpl = &rconn->rmp; /* cache ptr to RMP packet */
240
241 /*
242 * Set up assorted fields in reply packet.
243 */
244 rpl->r_brpl.rmp_type = RMP_BOOT_REPL;

--- 46 unchanged lines hidden (view full) ---

291SendBootRepl(req, rconn, filelist)
292 struct rmp_packet *req;
293 RMPCONN *rconn;
294 char *filelist[];
295{
296 int retval;
297 char *filename, filepath[RMPBOOTDATA+1];
298 RMPCONN *oldconn;
237
238 GETWORD(req->r_brpl.rmp_seqno, i); /* SeqNo is really FileNo */
239 rpl = &rconn->rmp; /* cache ptr to RMP packet */
240
241 /*
242 * Set up assorted fields in reply packet.
243 */
244 rpl->r_brpl.rmp_type = RMP_BOOT_REPL;

--- 46 unchanged lines hidden (view full) ---

291SendBootRepl(req, rconn, filelist)
292 struct rmp_packet *req;
293 RMPCONN *rconn;
294 char *filelist[];
295{
296 int retval;
297 char *filename, filepath[RMPBOOTDATA+1];
298 RMPCONN *oldconn;
299 register struct rmp_packet *rpl;
300 register char *src, *dst1, *dst2;
301 register u_int8_t i;
299 struct rmp_packet *rpl;
300 char *src, *dst1, *dst2;
301 u_int8_t i;
302
303 /*
304 * If another connection already exists, delete it since we
305 * are obviously starting again.
306 */
307 if ((oldconn = FindConn(rconn)) != NULL) {
308 syslog(LOG_WARNING, "%s: dropping existing connection",
309 EnetStr(oldconn));

--- 24 unchanged lines hidden (view full) ---

334 /*
335 * If we are booting HP-UX machines, their secondary loader will
336 * ask for files like "/hp-ux". As a security measure, we do not
337 * allow boot files to lay outside the boot directory (unless they
338 * are purposely link'd out. So, make `filename' become the path-
339 * stripped file name and spoof the client into thinking that it
340 * really got what it wanted.
341 */
302
303 /*
304 * If another connection already exists, delete it since we
305 * are obviously starting again.
306 */
307 if ((oldconn = FindConn(rconn)) != NULL) {
308 syslog(LOG_WARNING, "%s: dropping existing connection",
309 EnetStr(oldconn));

--- 24 unchanged lines hidden (view full) ---

334 /*
335 * If we are booting HP-UX machines, their secondary loader will
336 * ask for files like "/hp-ux". As a security measure, we do not
337 * allow boot files to lay outside the boot directory (unless they
338 * are purposely link'd out. So, make `filename' become the path-
339 * stripped file name and spoof the client into thinking that it
340 * really got what it wanted.
341 */
342 filename = (filename = rindex(filepath,'/'))? ++filename: filepath;
342 filename = (filename = strrchr(filepath,'/'))? ++filename: filepath;
343
344 /*
345 * Check that this is a valid boot file name.
346 */
347 for (i = 0; i < C_MAXFILE && filelist[i] != NULL; i++)
348 if (STREQN(filename, filelist[i]))
349 goto match;
350

--- 46 unchanged lines hidden (view full) ---

397** none.
398*/
399int
400SendReadRepl(rconn)
401 RMPCONN *rconn;
402{
403 int retval = 0;
404 RMPCONN *oldconn;
343
344 /*
345 * Check that this is a valid boot file name.
346 */
347 for (i = 0; i < C_MAXFILE && filelist[i] != NULL; i++)
348 if (STREQN(filename, filelist[i]))
349 goto match;
350

--- 46 unchanged lines hidden (view full) ---

397** none.
398*/
399int
400SendReadRepl(rconn)
401 RMPCONN *rconn;
402{
403 int retval = 0;
404 RMPCONN *oldconn;
405 register struct rmp_packet *rpl, *req;
406 register int size = 0;
405 struct rmp_packet *rpl, *req;
406 int size = 0;
407 int madeconn = 0;
408
409 /*
410 * Find the old connection. If one doesnt exist, create one only
411 * to return the error code.
412 */
413 if ((oldconn = FindConn(rconn)) == NULL) {
414 if ((oldconn = NewConn(rconn)) == NULL)

--- 144 unchanged lines hidden (view full) ---

559** Returns:
560** 1 on success, 0 on failure.
561**
562** Side Effects:
563** none.
564*/
565int
566SendPacket(rconn)
407 int madeconn = 0;
408
409 /*
410 * Find the old connection. If one doesnt exist, create one only
411 * to return the error code.
412 */
413 if ((oldconn = FindConn(rconn)) == NULL) {
414 if ((oldconn = NewConn(rconn)) == NULL)

--- 144 unchanged lines hidden (view full) ---

559** Returns:
560** 1 on success, 0 on failure.
561**
562** Side Effects:
563** none.
564*/
565int
566SendPacket(rconn)
567 register RMPCONN *rconn;
567 RMPCONN *rconn;
568{
569 /*
570 * Set Ethernet Destination address to Source (BPF and the enet
571 * driver will take care of getting our source address set).
572 */
568{
569 /*
570 * Set Ethernet Destination address to Source (BPF and the enet
571 * driver will take care of getting our source address set).
572 */
573 bcopy((char *)&rconn->rmp.hp_hdr.saddr[0],
574 (char *)&rconn->rmp.hp_hdr.daddr[0], RMP_ADDRLEN);
573 memmove((char *)&rconn->rmp.hp_hdr.daddr[0],
574 (char *)&rconn->rmp.hp_hdr.saddr[0], RMP_ADDRLEN);
575#ifdef __FreeBSD__
576 /* BPF (incorrectly) wants this in host order. */
577 rconn->rmp.hp_hdr.len = rconn->rmplen - sizeof(struct hp_hdr);
578#else
579 rconn->rmp.hp_hdr.len = htons(rconn->rmplen - sizeof(struct hp_hdr));
580#endif
581
582 /*

--- 18 unchanged lines hidden ---
575#ifdef __FreeBSD__
576 /* BPF (incorrectly) wants this in host order. */
577 rconn->rmp.hp_hdr.len = rconn->rmplen - sizeof(struct hp_hdr);
578#else
579 rconn->rmp.hp_hdr.len = htons(rconn->rmplen - sizeof(struct hp_hdr));
580#endif
581
582 /*

--- 18 unchanged lines hidden ---