Deleted Added
sdiff udiff text old ( 184588 ) new ( 196503 )
full compact
1/* $NetBSD: rpc_generic.c,v 1.4 2000/09/28 09:07:04 kleink Exp $ */
2
3/*
4 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5 * unrestricted use provided that this legend is included on all tape
6 * media and as a part of the software program in whole or part. Users
7 * may copy or modify Sun RPC without charge, but are not authorized
8 * to license or distribute it to anyone else except as part of a product or

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

29 * Mountain View, California 94043
30 */
31/*
32 * Copyright (c) 1986-1991 by Sun Microsystems Inc.
33 */
34
35/* #pragma ident "@(#)rpc_generic.c 1.17 94/04/24 SMI" */
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/rpc/rpc_generic.c 196503 2009-08-24 10:09:30Z zec $");
38
39/*
40 * rpc_generic.c, Miscl routines for RPC.
41 *
42 */
43
44#include "opt_inet6.h"
45

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

51#include <sys/proc.h>
52#include <sys/protosw.h>
53#include <sys/sbuf.h>
54#include <sys/systm.h>
55#include <sys/socket.h>
56#include <sys/socketvar.h>
57#include <sys/syslog.h>
58
59#include <net/vnet.h>
60
61#include <rpc/rpc.h>
62#include <rpc/nettype.h>
63
64#include <rpc/rpc_com.h>
65
66#if __FreeBSD_version < 700000
67#define strrchr rindex
68#endif

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

819 default:
820 return (EPFNOSUPPORT);
821 }
822
823 sa->sa_family = af;
824 sa->sa_len = salen;
825
826 if (*portp == 0) {
827 CURVNET_SET(so->so_vnet);
828 bzero(&opt, sizeof(opt));
829 opt.sopt_dir = SOPT_GET;
830 opt.sopt_level = proto;
831 opt.sopt_name = portrange;
832 opt.sopt_val = &old;
833 opt.sopt_valsize = sizeof(old);
834 error = sogetopt(so, &opt);
835 if (error) {
836 CURVNET_RESTORE();
837 goto out;
838 }
839
840 opt.sopt_dir = SOPT_SET;
841 opt.sopt_val = &portlow;
842 error = sosetopt(so, &opt);
843 CURVNET_RESTORE();
844 if (error)
845 goto out;
846 }
847
848 error = sobind(so, sa, curthread);
849
850 if (*portp == 0) {
851 if (error) {
852 opt.sopt_dir = SOPT_SET;
853 opt.sopt_val = &old;
854 CURVNET_SET(so->so_vnet);
855 sosetopt(so, &opt);
856 CURVNET_RESTORE();
857 }
858 }
859out:
860 if (freesa)
861 free(sa, M_SONAME);
862
863 return (error);
864}

--- 19 unchanged lines hidden ---