Deleted Added
full compact
bootp_subr.c (38412) bootp_subr.c (38482)
1/* $Id: bootp_subr.c,v 1.13 1998/03/30 09:53:38 phk Exp $ */
1/* $Id: bootp_subr.c,v 1.14 1998/08/18 00:32:47 bde Exp $ */
2
3/*
4 * Copyright (c) 1995 Gordon Ross, Adam Glass
5 * Copyright (c) 1992 Regents of the University of California.
6 * All rights reserved.
7 *
8 * This software was developed by the Computer Systems Engineering group
9 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and

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

259 struct bootp_packet *call;
260 struct bootp_packet *reply; /* output */
261 struct proc *procp;
262{
263 struct socket *so;
264 struct sockaddr_in *sin, sa;
265 struct mbuf *m;
266 struct uio auio;
2
3/*
4 * Copyright (c) 1995 Gordon Ross, Adam Glass
5 * Copyright (c) 1992 Regents of the University of California.
6 * All rights reserved.
7 *
8 * This software was developed by the Computer Systems Engineering group
9 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and

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

259 struct bootp_packet *call;
260 struct bootp_packet *reply; /* output */
261 struct proc *procp;
262{
263 struct socket *so;
264 struct sockaddr_in *sin, sa;
265 struct mbuf *m;
266 struct uio auio;
267 struct sockopt sopt;
267 struct iovec aio;
268 struct iovec aio;
268 int error, rcvflg, timo, secs, len;
269 struct timeval tv;
270 int error, on, len, rcvflg, secs, timo;
269 u_int tport;
270
271 /*
272 * Create socket and set its recieve timeout.
273 */
274 if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0,procp)))
275 goto out;
276
271 u_int tport;
272
273 /*
274 * Create socket and set its recieve timeout.
275 */
276 if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0,procp)))
277 goto out;
278
277 m = m_get(M_WAIT, MT_SOOPTS);
278 if (m == NULL) {
279 error = ENOBUFS;
279 tv.tv_sec = 1;
280 tv.tv_usec = 0;
281 bzero(&sopt, sizeof sopt);
282 sopt.sopt_level = SOL_SOCKET;
283 sopt.sopt_name = SO_RCVTIMEO;
284 sopt.sopt_val = &tv;
285 sopt.sopt_valsize = sizeof tv;
286
287 if (error = sosetopt(so, &sopt))
280 goto out;
288 goto out;
281 } else {
282 struct timeval *tv;
283 tv = mtod(m, struct timeval *);
284 m->m_len = sizeof(*tv);
285 tv->tv_sec = 1;
286 tv->tv_usec = 0;
287 if ((error = sosetopt(so, SOL_SOCKET, SO_RCVTIMEO, m, procp)))
288 goto out;
289 }
290
291 /*
292 * Enable broadcast.
293 */
289
290 /*
291 * Enable broadcast.
292 */
294 {
295 int *on;
296 m = m_get(M_WAIT, MT_SOOPTS);
297 if (m == NULL) {
298 error = ENOBUFS;
299 goto out;
300 }
301 on = mtod(m, int *);
302 m->m_len = sizeof(*on);
303 *on = 1;
304 if ((error = sosetopt(so, SOL_SOCKET, SO_BROADCAST, m, procp)))
305 goto out;
306 }
293 on = 1;
294 sopt.sopt_val = &on;
295 sopt.sopt_valsize = sizeof on;
296 sopt.sopt_name = SO_BROADCAST;
297 if (error = sosetopt(so, &sopt))
298 goto out;
307
308 /*
309 * Bind the local endpoint to a bootp client port.
310 */
311 sin = &sa;
312 bzero(sin, sizeof *sin);
313 sin->sin_len = sizeof(*sin);
314 sin->sin_family = AF_INET;

--- 953 unchanged lines hidden ---
299
300 /*
301 * Bind the local endpoint to a bootp client port.
302 */
303 sin = &sa;
304 bzero(sin, sizeof *sin);
305 sin->sin_len = sizeof(*sin);
306 sin->sin_family = AF_INET;

--- 953 unchanged lines hidden ---