Deleted Added
full compact
krpc_subr.c (38412) krpc_subr.c (38482)
1/* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */
1/* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */
2/* $Id: krpc_subr.c,v 1.9 1998/03/28 10:33:15 bde Exp $ */
2/* $Id: krpc_subr.c,v 1.10 1998/08/18 00:32:48 bde Exp $ */
3
4/*
5 * Copyright (c) 1995 Gordon Ross, Adam Glass
6 * Copyright (c) 1992 Regents of the University of California.
7 * All rights reserved.
8 *
9 * This software was developed by the Computer Systems Engineering group
10 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and

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

193 struct proc *procp;
194{
195 struct socket *so;
196 struct sockaddr_in *sin, ssin;
197 struct sockaddr *from;
198 struct mbuf *m, *nam, *mhead;
199 struct rpc_call *call;
200 struct rpc_reply *reply;
3
4/*
5 * Copyright (c) 1995 Gordon Ross, Adam Glass
6 * Copyright (c) 1992 Regents of the University of California.
7 * All rights reserved.
8 *
9 * This software was developed by the Computer Systems Engineering group
10 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and

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

193 struct proc *procp;
194{
195 struct socket *so;
196 struct sockaddr_in *sin, ssin;
197 struct sockaddr *from;
198 struct mbuf *m, *nam, *mhead;
199 struct rpc_call *call;
200 struct rpc_reply *reply;
201 struct sockopt sopt;
202 struct timeval tv;
201 struct uio auio;
202 int error, rcvflg, timo, secs, len;
203 static u_int32_t xid = ~0xFF;
204 u_int16_t tport;
205
206 /*
207 * Validate address family.
208 * Sorry, this is INET specific...

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

215 from = NULL;
216
217 /*
218 * Create socket and set its recieve timeout.
219 */
220 if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0, procp)))
221 goto out;
222
203 struct uio auio;
204 int error, rcvflg, timo, secs, len;
205 static u_int32_t xid = ~0xFF;
206 u_int16_t tport;
207
208 /*
209 * Validate address family.
210 * Sorry, this is INET specific...

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

217 from = NULL;
218
219 /*
220 * Create socket and set its recieve timeout.
221 */
222 if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0, procp)))
223 goto out;
224
223 m = m_get(M_WAIT, MT_SOOPTS);
224 if (m == NULL) {
225 error = ENOBUFS;
225 tv.tv_sec = 1;
226 tv.tv_usec = 0;
227 bzero(&sopt, sizeof sopt);
228 sopt.sopt_level = SOL_SOCKET;
229 sopt.sopt_name = SO_RCVTIMEO;
230 sopt.sopt_val = &tv;
231 sopt.sopt_valsize = sizeof tv;
232
233 if (error = sosetopt(so, &sopt))
226 goto out;
234 goto out;
227 } else {
228 struct timeval *tv;
229 tv = mtod(m, struct timeval *);
230 m->m_len = sizeof(*tv);
231 tv->tv_sec = 1;
232 tv->tv_usec = 0;
233 if ((error = sosetopt(so, SOL_SOCKET, SO_RCVTIMEO, m, procp)))
234 goto out;
235 }
236
237 /*
238 * Enable broadcast if necessary.
239 */
240 if (from_p) {
235
236 /*
237 * Enable broadcast if necessary.
238 */
239 if (from_p) {
241 int32_t *on;
242 m = m_get(M_WAIT, MT_SOOPTS);
243 if (m == NULL) {
244 error = ENOBUFS;
240 int on = 1;
241 sopt.sopt_name = SO_BROADCAST;
242 sopt.sopt_val = &on;
243 sopt.sopt_valsize = sizeof on;
244 if (error = sosetopt(so, &sopt))
245 goto out;
245 goto out;
246 }
247 on = mtod(m, int32_t *);
248 m->m_len = sizeof(*on);
249 *on = 1;
250 if ((error = sosetopt(so, SOL_SOCKET, SO_BROADCAST, m, procp)))
251 goto out;
252 }
253
254 /*
255 * Bind the local endpoint to a reserved port,
256 * because some NFS servers refuse requests from
257 * non-reserved (non-privileged) ports.
258 */
259 sin = &ssin;

--- 228 unchanged lines hidden ---
246 }
247
248 /*
249 * Bind the local endpoint to a reserved port,
250 * because some NFS servers refuse requests from
251 * non-reserved (non-privileged) ports.
252 */
253 sin = &ssin;

--- 228 unchanged lines hidden ---