2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright 1999 Internet Business Solutions Ltd., Switzerland
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #define MPPE_POLICY_ALLOWED 1
32 #define MPPE_POLICY_REQUIRED 2
34 #define MPPE_TYPE_40BIT 2
35 #define MPPE_TYPE_128BIT 4
43 struct fdescriptor desc; /* We're a sort of (selectable) fdescriptor */
45 int fd; /* We're selecting on this */
46 struct rad_handle *rad; /* Using this to talk to our lib */
47 struct pppTimer timer; /* for this long */
48 struct authinfo *auth; /* Tell this about success/failure */
50 unsigned valid : 1; /* Is this structure valid ? */
51 unsigned vj : 1; /* FRAMED Compression */
52 struct in_addr ip; /* FRAMED IP */
53 struct in_addr mask; /* FRAMED Netmask */
54 unsigned long mtu; /* FRAMED MTU */
55 unsigned long sessiontime; /* Session-Timeout */
56 char *filterid; /* FRAMED Filter Id */
57 struct sticky_route *routes; /* FRAMED Routes */
58 char *msrepstr; /* MS-CHAP2-Response */
59 char *repstr; /* Reply-Message */
60 char *errstr; /* Error-Message */
62 uint8_t *ipv6prefix; /* FRAMED IPv6 Prefix */
63 struct sticky_route *ipv6routes; /* FRAMED IPv6 Routes */
66 int policy; /* MPPE_POLICY_* */
67 int types; /* MPPE_TYPE_*BIT bitmask */
74 char file[PATH_MAX]; /* Radius config file */
77 struct pppTimer timer; /* for this long */
80 short unsigned int port_id_type;
84 struct radius *rad_parent; /* "Parent" struct radius stored in bundle */
85 char user_name[AUTHLEN]; /* Session User-Name */
86 char session_id[256]; /* Unique session ID */
87 char multi_session_id[51]; /* Unique MP session ID */
88 int authentic; /* How the session has been authenticated */
89 u_short proto; /* Protocol number */
103 #define descriptor2radius(d) \
104 ((d)->type == RADIUS_DESCRIPTOR ? (struct radius *)(d) : NULL)
108 extern void radius_Flush(struct radius *);
109 extern void radius_Init(struct radius *);
110 extern void radius_Destroy(struct radius *);
112 extern void radius_Show(struct radius *, struct prompt *);
113 extern void radius_StartTimer(struct bundle *);
114 extern void radius_StopTimer(struct radius *);
115 extern int radius_Authenticate(struct radius *, struct authinfo *,
116 const char *, const char *, int,
118 extern void radius_Account_Set_Ip(struct radacct *, struct in_addr *,
121 extern void radius_Account_Set_Ipv6(struct radacct *, u_char *);
123 extern void radius_Account(struct radius *, struct radacct *,
124 struct datalink *, int, struct pppThroughput *);
126 /* An (int) parameter to radius_Account, from radlib.h */
127 #if !defined(RAD_START)
134 /* Get address from NAS pool */
135 #define RADIUS_INADDR_POOL htonl(0xfffffffe) /* 255.255.255.254 */