Deleted Added
full compact
if_spppsubr.c (139823) if_spppsubr.c (147256)
1/*
2 * Synchronous PPP/Cisco/Frame Relay link level subroutines.
3 * Keepalive protocol implemented in both Cisco and PPP modes.
4 */
5/*-
6 * Copyright (C) 1994-2000 Cronyx Engineering.
7 * Author: Serge Vakulenko, <vak@cronyx.ru>
8 *

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

13 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 *
15 * Authors grant any other persons or organisations permission to use
16 * or modify this software as long as this message is kept with the software,
17 * all derivative works or modified versions.
18 *
19 * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997
20 *
1/*
2 * Synchronous PPP/Cisco/Frame Relay link level subroutines.
3 * Keepalive protocol implemented in both Cisco and PPP modes.
4 */
5/*-
6 * Copyright (C) 1994-2000 Cronyx Engineering.
7 * Author: Serge Vakulenko, <vak@cronyx.ru>
8 *

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

13 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 *
15 * Authors grant any other persons or organisations permission to use
16 * or modify this software as long as this message is kept with the software,
17 * all derivative works or modified versions.
18 *
19 * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997
20 *
21 * $FreeBSD: head/sys/net/if_spppsubr.c 139823 2005-01-07 01:45:51Z imp $
21 * $FreeBSD: head/sys/net/if_spppsubr.c 147256 2005-06-10 16:49:24Z brooks $
22 */
23
24#include <sys/param.h>
25
26#if defined(__FreeBSD__) && __FreeBSD__ >= 3
27#include "opt_inet.h"
28#include "opt_inet6.h"
29#include "opt_ipx.h"

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

193#define STATE_STOPPED 3
194#define STATE_CLOSING 4
195#define STATE_STOPPING 5
196#define STATE_REQ_SENT 6
197#define STATE_ACK_RCVD 7
198#define STATE_ACK_SENT 8
199#define STATE_OPENED 9
200
22 */
23
24#include <sys/param.h>
25
26#if defined(__FreeBSD__) && __FreeBSD__ >= 3
27#include "opt_inet.h"
28#include "opt_inet6.h"
29#include "opt_ipx.h"

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

193#define STATE_STOPPED 3
194#define STATE_CLOSING 4
195#define STATE_STOPPING 5
196#define STATE_REQ_SENT 6
197#define STATE_ACK_RCVD 7
198#define STATE_ACK_SENT 8
199#define STATE_OPENED 9
200
201MALLOC_DEFINE(M_SPPP, "sppp", "synchronous PPP interface internals");
202
201struct ppp_header {
202 u_char address;
203 u_char control;
204 u_short protocol;
205} __packed;
206#define PPP_HEADER_LEN sizeof (struct ppp_header)
207
208struct lcp_header {

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

259#define SPP_ARGS(ifp) (ifp)->if_name, (ifp)->if_unit
260#else
261#define SPP_FMT "%s: "
262#define SPP_ARGS(ifp) (ifp)->if_xname
263#endif
264
265#define SPPP_LOCK(sp) \
266 do { \
203struct ppp_header {
204 u_char address;
205 u_char control;
206 u_short protocol;
207} __packed;
208#define PPP_HEADER_LEN sizeof (struct ppp_header)
209
210struct lcp_header {

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

261#define SPP_ARGS(ifp) (ifp)->if_name, (ifp)->if_unit
262#else
263#define SPP_FMT "%s: "
264#define SPP_ARGS(ifp) (ifp)->if_xname
265#endif
266
267#define SPPP_LOCK(sp) \
268 do { \
267 if (!((sp)->pp_if.if_flags & IFF_NEEDSGIANT)) \
269 if (!(SP2IFP(sp)->if_flags & IFF_NEEDSGIANT)) \
268 mtx_lock (&(sp)->mtx); \
269 } while (0)
270#define SPPP_UNLOCK(sp) \
271 do { \
270 mtx_lock (&(sp)->mtx); \
271 } while (0)
272#define SPPP_UNLOCK(sp) \
273 do { \
272 if (!((sp)->pp_if.if_flags & IFF_NEEDSGIANT)) \
274 if (!(SP2IFP(sp)->if_flags & IFF_NEEDSGIANT)) \
273 mtx_unlock (&(sp)->mtx); \
274 } while (0)
275
276#define SPPP_LOCK_ASSERT(sp) \
277 do { \
275 mtx_unlock (&(sp)->mtx); \
276 } while (0)
277
278#define SPPP_LOCK_ASSERT(sp) \
279 do { \
278 if (!((sp)->pp_if.if_flags & IFF_NEEDSGIANT)) \
280 if (!(SP2IFP(sp)->if_flags & IFF_NEEDSGIANT)) \
279 mtx_assert (&(sp)->mtx, MA_OWNED); \
280 } while (0)
281#define SPPP_LOCK_OWNED(sp) \
281 mtx_assert (&(sp)->mtx, MA_OWNED); \
282 } while (0)
283#define SPPP_LOCK_OWNED(sp) \
282 (!((sp)->pp_if.if_flags & IFF_NEEDSGIANT) && \
284 (!(SP2IFP(sp)->if_flags & IFF_NEEDSGIANT) && \
283 mtx_owned (&sp->mtx))
284
285#ifdef INET
286/*
287 * The following disgusting hack gets around the problem that IP TOS
288 * can't be set yet. We want to put "interactive" traffic on a high
289 * priority queue. To decide if traffic is interactive, we check that
290 * a) it is TCP and b) one of its ports is telnet, rlogin or ftp control.

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

295 0, 513, 0, 0,
296 0, 21, 0, 23,
297};
298#define INTERACTIVE(p) (interactive_ports[(p) & 7] == (p))
299#endif
300
301/* almost every function needs these */
302#define STDDCL \
285 mtx_owned (&sp->mtx))
286
287#ifdef INET
288/*
289 * The following disgusting hack gets around the problem that IP TOS
290 * can't be set yet. We want to put "interactive" traffic on a high
291 * priority queue. To decide if traffic is interactive, we check that
292 * a) it is TCP and b) one of its ports is telnet, rlogin or ftp control.

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

297 0, 513, 0, 0,
298 0, 21, 0, 23,
299};
300#define INTERACTIVE(p) (interactive_ports[(p) & 7] == (p))
301#endif
302
303/* almost every function needs these */
304#define STDDCL \
303 struct ifnet *ifp = &sp->pp_if; \
305 struct ifnet *ifp = SP2IFP(sp); \
304 int debug = ifp->if_flags & IFF_DEBUG
305
306static int sppp_output(struct ifnet *ifp, struct mbuf *m,
307 struct sockaddr *dst, struct rtentry *rt);
308
309static void sppp_cisco_send(struct sppp *sp, int type, long par1, long par2);
310static void sppp_cisco_input(struct sppp *sp, struct mbuf *m);
311

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

485static const struct cp *cps[IDX_COUNT] = {
486 &lcp, /* IDX_LCP */
487 &ipcp, /* IDX_IPCP */
488 &ipv6cp, /* IDX_IPV6CP */
489 &pap, /* IDX_PAP */
490 &chap, /* IDX_CHAP */
491};
492
306 int debug = ifp->if_flags & IFF_DEBUG
307
308static int sppp_output(struct ifnet *ifp, struct mbuf *m,
309 struct sockaddr *dst, struct rtentry *rt);
310
311static void sppp_cisco_send(struct sppp *sp, int type, long par1, long par2);
312static void sppp_cisco_input(struct sppp *sp, struct mbuf *m);
313

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

487static const struct cp *cps[IDX_COUNT] = {
488 &lcp, /* IDX_LCP */
489 &ipcp, /* IDX_IPCP */
490 &ipv6cp, /* IDX_IPV6CP */
491 &pap, /* IDX_PAP */
492 &chap, /* IDX_CHAP */
493};
494
495static void*
496sppp_alloc(u_char type, struct ifnet *ifp)
497{
498 struct sppp *sp;
499
500 sp = malloc(sizeof(struct sppp), M_SPPP, M_WAITOK | M_ZERO);
501 sp->pp_ifp = ifp;
502
503 return (sp);
504}
505
506static void
507sppp_free(void *com, u_char type)
508{
509
510 free(com, M_SPPP);
511}
512
493static int
494sppp_modevent(module_t mod, int type, void *unused)
495{
496 switch (type) {
497 case MOD_LOAD:
513static int
514sppp_modevent(module_t mod, int type, void *unused)
515{
516 switch (type) {
517 case MOD_LOAD:
518 /*
519 * XXX: should probably be IFT_SPPP, but it's fairly
520 * harmless to allocate struct sppp's for non-sppp
521 * interfaces.
522 */
523
524 if_register_com_alloc(IFT_PPP, sppp_alloc, sppp_free);
498 break;
499 case MOD_UNLOAD:
525 break;
526 case MOD_UNLOAD:
527 /* if_deregister_com_alloc(IFT_PPP); */
500 return EACCES;
501 default:
502 return EOPNOTSUPP;
503 }
504 return 0;
505}
506static moduledata_t spppmod = {
507 "sppp",

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

518/*
519 * Process the received packet.
520 */
521void
522sppp_input(struct ifnet *ifp, struct mbuf *m)
523{
524 struct ppp_header *h;
525 int isr = -1;
528 return EACCES;
529 default:
530 return EOPNOTSUPP;
531 }
532 return 0;
533}
534static moduledata_t spppmod = {
535 "sppp",

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

546/*
547 * Process the received packet.
548 */
549void
550sppp_input(struct ifnet *ifp, struct mbuf *m)
551{
552 struct ppp_header *h;
553 int isr = -1;
526 struct sppp *sp = (struct sppp *)ifp;
554 struct sppp *sp = IFP2SP(ifp);
527 u_char *iphdr;
528 int hlen, vjlen, do_account = 0;
529 int debug;
530
531 SPPP_LOCK(sp);
532 debug = ifp->if_flags & IFF_DEBUG;
533
534 if (ifp->if_flags & IFF_UP)

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

703 h->address, h->control, ntohs(h->protocol));
704 goto drop;
705 }
706 switch (ntohs (h->protocol)) {
707 default:
708 ++ifp->if_noproto;
709 goto invalid;
710 case CISCO_KEEPALIVE:
555 u_char *iphdr;
556 int hlen, vjlen, do_account = 0;
557 int debug;
558
559 SPPP_LOCK(sp);
560 debug = ifp->if_flags & IFF_DEBUG;
561
562 if (ifp->if_flags & IFF_UP)

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

731 h->address, h->control, ntohs(h->protocol));
732 goto drop;
733 }
734 switch (ntohs (h->protocol)) {
735 default:
736 ++ifp->if_noproto;
737 goto invalid;
738 case CISCO_KEEPALIVE:
711 sppp_cisco_input ((struct sppp*) ifp, m);
739 sppp_cisco_input (sp, m);
712 m_freem (m);
713 SPPP_UNLOCK(sp);
714 return;
715#ifdef INET
716 case ETHERTYPE_IP:
717 isr = NETISR_IP;
718 do_account++;
719 break;

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

764 sp->pp_last_recv = time_second;
765}
766
767static void
768sppp_ifstart_sched(void *dummy)
769{
770 struct sppp *sp = dummy;
771
740 m_freem (m);
741 SPPP_UNLOCK(sp);
742 return;
743#ifdef INET
744 case ETHERTYPE_IP:
745 isr = NETISR_IP;
746 do_account++;
747 break;

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

792 sp->pp_last_recv = time_second;
793}
794
795static void
796sppp_ifstart_sched(void *dummy)
797{
798 struct sppp *sp = dummy;
799
772 sp->if_start(&sp->pp_if);
800 sp->if_start(SP2IFP(sp));
773}
774
775/* if_start () wrapper function. We use it to schedule real if_start () for
776 * execution. We can't call it directly
777 */
778static void
779sppp_ifstart(struct ifnet *ifp)
780{
801}
802
803/* if_start () wrapper function. We use it to schedule real if_start () for
804 * execution. We can't call it directly
805 */
806static void
807sppp_ifstart(struct ifnet *ifp)
808{
781 struct sppp *sp = (struct sppp*) ifp;
809 struct sppp *sp = IFP2SP(ifp);
782
783 if (SPPP_LOCK_OWNED(sp)) {
784 if (callout_pending(&sp->ifstart_callout))
785 return;
786 callout_reset(&sp->ifstart_callout, 1, sppp_ifstart_sched,
787 (void *)sp);
788 } else {
789 sp->if_start(ifp);
790 }
791}
792
793/*
794 * Enqueue transmit packet.
795 */
796static int
797sppp_output(struct ifnet *ifp, struct mbuf *m,
798 struct sockaddr *dst, struct rtentry *rt)
799{
810
811 if (SPPP_LOCK_OWNED(sp)) {
812 if (callout_pending(&sp->ifstart_callout))
813 return;
814 callout_reset(&sp->ifstart_callout, 1, sppp_ifstart_sched,
815 (void *)sp);
816 } else {
817 sp->if_start(ifp);
818 }
819}
820
821/*
822 * Enqueue transmit packet.
823 */
824static int
825sppp_output(struct ifnet *ifp, struct mbuf *m,
826 struct sockaddr *dst, struct rtentry *rt)
827{
800 struct sppp *sp = (struct sppp*) ifp;
828 struct sppp *sp = IFP2SP(ifp);
801 struct ppp_header *h;
802 struct ifqueue *ifq = NULL;
803 int s, error, rv = 0;
804 int ipproto = PPP_IP;
805 int debug = ifp->if_flags & IFF_DEBUG;
806
807 s = splimp();
808 SPPP_LOCK(sp);

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

1034 */
1035 sp->pp_last_sent = time_second;
1036 return (0);
1037}
1038
1039void
1040sppp_attach(struct ifnet *ifp)
1041{
829 struct ppp_header *h;
830 struct ifqueue *ifq = NULL;
831 int s, error, rv = 0;
832 int ipproto = PPP_IP;
833 int debug = ifp->if_flags & IFF_DEBUG;
834
835 s = splimp();
836 SPPP_LOCK(sp);

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

1062 */
1063 sp->pp_last_sent = time_second;
1064 return (0);
1065}
1066
1067void
1068sppp_attach(struct ifnet *ifp)
1069{
1042 struct sppp *sp = (struct sppp*) ifp;
1070 struct sppp *sp = IFP2SP(ifp);
1043
1044 /* Initialize mtx lock */
1045 mtx_init(&sp->mtx, "sppp", MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE);
1046
1047 /* Initialize keepalive handler. */
1048 callout_init(&sp->keepalive_callout,
1049 (ifp->if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
1050 callout_reset(&sp->keepalive_callout, hz * 10, sppp_keepalive,
1051 (void *)sp);
1052
1071
1072 /* Initialize mtx lock */
1073 mtx_init(&sp->mtx, "sppp", MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE);
1074
1075 /* Initialize keepalive handler. */
1076 callout_init(&sp->keepalive_callout,
1077 (ifp->if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
1078 callout_reset(&sp->keepalive_callout, hz * 10, sppp_keepalive,
1079 (void *)sp);
1080
1053 sp->pp_if.if_mtu = PP_MTU;
1054 sp->pp_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
1055 sp->pp_if.if_type = IFT_PPP;
1056 sp->pp_if.if_output = sppp_output;
1081 ifp->if_mtu = PP_MTU;
1082 ifp->if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
1083 ifp->if_output = sppp_output;
1057#if 0
1058 sp->pp_flags = PP_KEEPALIVE;
1059#endif
1084#if 0
1085 sp->pp_flags = PP_KEEPALIVE;
1086#endif
1060 sp->pp_if.if_snd.ifq_maxlen = 32;
1087 ifp->if_snd.ifq_maxlen = 32;
1061 sp->pp_fastq.ifq_maxlen = 32;
1062 sp->pp_cpq.ifq_maxlen = 20;
1063 sp->pp_loopcnt = 0;
1064 sp->pp_alivecnt = 0;
1065 bzero(&sp->pp_seq[0], sizeof(sp->pp_seq));
1066 bzero(&sp->pp_rseq[0], sizeof(sp->pp_rseq));
1067 sp->pp_phase = PHASE_DEAD;
1068 sp->pp_up = sppp_pp_up;

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

1090 sppp_ipv6cp_init(sp);
1091 sppp_pap_init(sp);
1092 sppp_chap_init(sp);
1093}
1094
1095void
1096sppp_detach(struct ifnet *ifp)
1097{
1088 sp->pp_fastq.ifq_maxlen = 32;
1089 sp->pp_cpq.ifq_maxlen = 20;
1090 sp->pp_loopcnt = 0;
1091 sp->pp_alivecnt = 0;
1092 bzero(&sp->pp_seq[0], sizeof(sp->pp_seq));
1093 bzero(&sp->pp_rseq[0], sizeof(sp->pp_rseq));
1094 sp->pp_phase = PHASE_DEAD;
1095 sp->pp_up = sppp_pp_up;

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

1117 sppp_ipv6cp_init(sp);
1118 sppp_pap_init(sp);
1119 sppp_chap_init(sp);
1120}
1121
1122void
1123sppp_detach(struct ifnet *ifp)
1124{
1098 struct sppp *sp = (struct sppp*) ifp;
1125 struct sppp *sp = IFP2SP(ifp);
1099 int i;
1100
1101 KASSERT(mtx_initialized(&sp->mtx), ("sppp mutex is not initialized"));
1102
1103 /* Stop keepalive handler. */
1104 if (!callout_drain(&sp->keepalive_callout))
1105 callout_stop(&sp->keepalive_callout);
1106

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

1116}
1117
1118/*
1119 * Flush the interface output queue.
1120 */
1121static void
1122sppp_flush_unlocked(struct ifnet *ifp)
1123{
1126 int i;
1127
1128 KASSERT(mtx_initialized(&sp->mtx), ("sppp mutex is not initialized"));
1129
1130 /* Stop keepalive handler. */
1131 if (!callout_drain(&sp->keepalive_callout))
1132 callout_stop(&sp->keepalive_callout);
1133

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

1143}
1144
1145/*
1146 * Flush the interface output queue.
1147 */
1148static void
1149sppp_flush_unlocked(struct ifnet *ifp)
1150{
1124 struct sppp *sp = (struct sppp*) ifp;
1151 struct sppp *sp = IFP2SP(ifp);
1125
1152
1126 sppp_qflush ((struct ifqueue *)&sp->pp_if.if_snd);
1153 sppp_qflush ((struct ifqueue *)&SP2IFP(sp)->if_snd);
1127 sppp_qflush (&sp->pp_fastq);
1128 sppp_qflush (&sp->pp_cpq);
1129}
1130
1131void
1132sppp_flush(struct ifnet *ifp)
1133{
1154 sppp_qflush (&sp->pp_fastq);
1155 sppp_qflush (&sp->pp_cpq);
1156}
1157
1158void
1159sppp_flush(struct ifnet *ifp)
1160{
1134 struct sppp *sp = (struct sppp*) ifp;
1161 struct sppp *sp = IFP2SP(ifp);
1135
1136 SPPP_LOCK(sp);
1137 sppp_flush_unlocked (ifp);
1138 SPPP_UNLOCK(sp);
1139}
1140
1141/*
1142 * Check if the output queue is empty.
1143 */
1144int
1145sppp_isempty(struct ifnet *ifp)
1146{
1162
1163 SPPP_LOCK(sp);
1164 sppp_flush_unlocked (ifp);
1165 SPPP_UNLOCK(sp);
1166}
1167
1168/*
1169 * Check if the output queue is empty.
1170 */
1171int
1172sppp_isempty(struct ifnet *ifp)
1173{
1147 struct sppp *sp = (struct sppp*) ifp;
1174 struct sppp *sp = IFP2SP(ifp);
1148 int empty, s;
1149
1150 s = splimp();
1151 SPPP_LOCK(sp);
1152 empty = !sp->pp_fastq.ifq_head && !sp->pp_cpq.ifq_head &&
1175 int empty, s;
1176
1177 s = splimp();
1178 SPPP_LOCK(sp);
1179 empty = !sp->pp_fastq.ifq_head && !sp->pp_cpq.ifq_head &&
1153 !sp->pp_if.if_snd.ifq_head;
1180 !SP2IFP(sp)->if_snd.ifq_head;
1154 SPPP_UNLOCK(sp);
1155 splx(s);
1156 return (empty);
1157}
1158
1159/*
1160 * Get next packet to send.
1161 */
1162struct mbuf *
1163sppp_dequeue(struct ifnet *ifp)
1164{
1181 SPPP_UNLOCK(sp);
1182 splx(s);
1183 return (empty);
1184}
1185
1186/*
1187 * Get next packet to send.
1188 */
1189struct mbuf *
1190sppp_dequeue(struct ifnet *ifp)
1191{
1165 struct sppp *sp = (struct sppp*) ifp;
1192 struct sppp *sp = IFP2SP(ifp);
1166 struct mbuf *m;
1167 int s;
1168
1169 s = splimp();
1170 SPPP_LOCK(sp);
1171 /*
1172 * Process only the control protocol queue until we have at
1173 * least one NCP open.
1174 *
1175 * Do always serve all three queues in Cisco mode.
1176 */
1177 IF_DEQUEUE(&sp->pp_cpq, m);
1178 if (m == NULL &&
1179 (sppp_ncp_check(sp) || sp->pp_mode == IFF_CISCO ||
1180 sp->pp_mode == PP_FR)) {
1181 IF_DEQUEUE(&sp->pp_fastq, m);
1182 if (m == NULL)
1193 struct mbuf *m;
1194 int s;
1195
1196 s = splimp();
1197 SPPP_LOCK(sp);
1198 /*
1199 * Process only the control protocol queue until we have at
1200 * least one NCP open.
1201 *
1202 * Do always serve all three queues in Cisco mode.
1203 */
1204 IF_DEQUEUE(&sp->pp_cpq, m);
1205 if (m == NULL &&
1206 (sppp_ncp_check(sp) || sp->pp_mode == IFF_CISCO ||
1207 sp->pp_mode == PP_FR)) {
1208 IF_DEQUEUE(&sp->pp_fastq, m);
1209 if (m == NULL)
1183 IF_DEQUEUE (&sp->pp_if.if_snd, m);
1210 IF_DEQUEUE (&SP2IFP(sp)->if_snd, m);
1184 }
1185 SPPP_UNLOCK(sp);
1186 splx(s);
1187 return m;
1188}
1189
1190/*
1191 * Pick the next packet, do not remove it from the queue.
1192 */
1193struct mbuf *
1194sppp_pick(struct ifnet *ifp)
1195{
1211 }
1212 SPPP_UNLOCK(sp);
1213 splx(s);
1214 return m;
1215}
1216
1217/*
1218 * Pick the next packet, do not remove it from the queue.
1219 */
1220struct mbuf *
1221sppp_pick(struct ifnet *ifp)
1222{
1196 struct sppp *sp = (struct sppp*)ifp;
1223 struct sppp *sp = IFP2SP(ifp);
1197 struct mbuf *m;
1198 int s;
1199
1200 s = splimp ();
1201 SPPP_LOCK(sp);
1202
1203 m = sp->pp_cpq.ifq_head;
1204 if (m == NULL &&
1205 (sp->pp_phase == PHASE_NETWORK ||
1206 sp->pp_mode == IFF_CISCO ||
1207 sp->pp_mode == PP_FR))
1208 if ((m = sp->pp_fastq.ifq_head) == NULL)
1224 struct mbuf *m;
1225 int s;
1226
1227 s = splimp ();
1228 SPPP_LOCK(sp);
1229
1230 m = sp->pp_cpq.ifq_head;
1231 if (m == NULL &&
1232 (sp->pp_phase == PHASE_NETWORK ||
1233 sp->pp_mode == IFF_CISCO ||
1234 sp->pp_mode == PP_FR))
1235 if ((m = sp->pp_fastq.ifq_head) == NULL)
1209 m = sp->pp_if.if_snd.ifq_head;
1236 m = SP2IFP(sp)->if_snd.ifq_head;
1210 SPPP_UNLOCK(sp);
1211 splx (s);
1212 return (m);
1213}
1214
1215/*
1216 * Process an ioctl request. Called on low priority level.
1217 */
1218int
1219sppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, void *data)
1220{
1221 struct ifreq *ifr = (struct ifreq*) data;
1237 SPPP_UNLOCK(sp);
1238 splx (s);
1239 return (m);
1240}
1241
1242/*
1243 * Process an ioctl request. Called on low priority level.
1244 */
1245int
1246sppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, void *data)
1247{
1248 struct ifreq *ifr = (struct ifreq*) data;
1222 struct sppp *sp = (struct sppp*) ifp;
1249 struct sppp *sp = IFP2SP(ifp);
1223 int s, rv, going_up, going_down, newmode;
1224
1225 s = splimp();
1226 SPPP_LOCK(sp);
1227 rv = 0;
1228 switch (cmd) {
1229 case SIOCAIFADDR:
1230 case SIOCSIFDSTADDR:

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

2202 sp->lcp.mru = sp->lcp.their_mru = PP_MTU;
2203
2204 /* Note that these values are relevant for all control protocols */
2205 sp->lcp.timeout = 3 * hz;
2206 sp->lcp.max_terminate = 2;
2207 sp->lcp.max_configure = 10;
2208 sp->lcp.max_failure = 10;
2209 callout_init(&sp->ch[IDX_LCP],
1250 int s, rv, going_up, going_down, newmode;
1251
1252 s = splimp();
1253 SPPP_LOCK(sp);
1254 rv = 0;
1255 switch (cmd) {
1256 case SIOCAIFADDR:
1257 case SIOCSIFDSTADDR:

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

2229 sp->lcp.mru = sp->lcp.their_mru = PP_MTU;
2230
2231 /* Note that these values are relevant for all control protocols */
2232 sp->lcp.timeout = 3 * hz;
2233 sp->lcp.max_terminate = 2;
2234 sp->lcp.max_configure = 10;
2235 sp->lcp.max_failure = 10;
2236 callout_init(&sp->ch[IDX_LCP],
2210 (sp->pp_if.if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
2237 (SP2IFP(sp)->if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
2211}
2212
2213static void
2214sppp_lcp_up(struct sppp *sp)
2215{
2216 STDDCL;
2217
2218 sp->pp_alivecnt = 0;

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

2897{
2898 sp->ipcp.opts = 0;
2899 sp->ipcp.flags = 0;
2900 sp->state[IDX_IPCP] = STATE_INITIAL;
2901 sp->fail_counter[IDX_IPCP] = 0;
2902 sp->pp_seq[IDX_IPCP] = 0;
2903 sp->pp_rseq[IDX_IPCP] = 0;
2904 callout_init(&sp->ch[IDX_IPCP],
2238}
2239
2240static void
2241sppp_lcp_up(struct sppp *sp)
2242{
2243 STDDCL;
2244
2245 sp->pp_alivecnt = 0;

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

2924{
2925 sp->ipcp.opts = 0;
2926 sp->ipcp.flags = 0;
2927 sp->state[IDX_IPCP] = STATE_INITIAL;
2928 sp->fail_counter[IDX_IPCP] = 0;
2929 sp->pp_seq[IDX_IPCP] = 0;
2930 sp->pp_rseq[IDX_IPCP] = 0;
2931 callout_init(&sp->ch[IDX_IPCP],
2905 (sp->pp_if.if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
2932 (SP2IFP(sp)->if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
2906}
2907
2908static void
2909sppp_ipcp_up(struct sppp *sp)
2910{
2911 sppp_up_event(&ipcp, sp);
2912}
2913

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

2980 * caused action sca, false if it has been rejected or nak'ed, and
2981 * caused action scn. (The return value is used to make the state
2982 * transition decision in the state automaton.)
2983 */
2984static int
2985sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len)
2986{
2987 u_char *buf, *r, *p;
2933}
2934
2935static void
2936sppp_ipcp_up(struct sppp *sp)
2937{
2938 sppp_up_event(&ipcp, sp);
2939}
2940

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

3007 * caused action sca, false if it has been rejected or nak'ed, and
3008 * caused action scn. (The return value is used to make the state
3009 * transition decision in the state automaton.)
3010 */
3011static int
3012sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len)
3013{
3014 u_char *buf, *r, *p;
2988 struct ifnet *ifp = &sp->pp_if;
3015 struct ifnet *ifp = SP2IFP(sp);
2989 int rlen, origlen, debug = ifp->if_flags & IFF_DEBUG;
2990 u_long hisaddr, desiredaddr;
2991 int gotmyaddr = 0;
2992 int desiredcomp;
2993
2994 len -= 4;
2995 origlen = len;
2996 /*

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

3188/*
3189 * Analyze the IPCP Configure-Reject option list, and adjust our
3190 * negotiation.
3191 */
3192static void
3193sppp_ipcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len)
3194{
3195 u_char *buf, *p;
3016 int rlen, origlen, debug = ifp->if_flags & IFF_DEBUG;
3017 u_long hisaddr, desiredaddr;
3018 int gotmyaddr = 0;
3019 int desiredcomp;
3020
3021 len -= 4;
3022 origlen = len;
3023 /*

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

3215/*
3216 * Analyze the IPCP Configure-Reject option list, and adjust our
3217 * negotiation.
3218 */
3219static void
3220sppp_ipcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len)
3221{
3222 u_char *buf, *p;
3196 struct ifnet *ifp = &sp->pp_if;
3223 struct ifnet *ifp = SP2IFP(sp);
3197 int debug = ifp->if_flags & IFF_DEBUG;
3198
3199 len -= 4;
3200 buf = malloc (len, M_TEMP, M_NOWAIT);
3201 if (!buf)
3202 return;
3203
3204 if (debug)

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

3232/*
3233 * Analyze the IPCP Configure-NAK option list, and adjust our
3234 * negotiation.
3235 */
3236static void
3237sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
3238{
3239 u_char *buf, *p;
3224 int debug = ifp->if_flags & IFF_DEBUG;
3225
3226 len -= 4;
3227 buf = malloc (len, M_TEMP, M_NOWAIT);
3228 if (!buf)
3229 return;
3230
3231 if (debug)

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

3259/*
3260 * Analyze the IPCP Configure-NAK option list, and adjust our
3261 * negotiation.
3262 */
3263static void
3264sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
3265{
3266 u_char *buf, *p;
3240 struct ifnet *ifp = &sp->pp_if;
3267 struct ifnet *ifp = SP2IFP(sp);
3241 int debug = ifp->if_flags & IFF_DEBUG;
3242 int desiredcomp;
3243 u_long wantaddr;
3244
3245 len -= 4;
3246 buf = malloc (len, M_TEMP, M_NOWAIT);
3247 if (!buf)
3248 return;

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

3381{
3382 sp->ipv6cp.opts = 0;
3383 sp->ipv6cp.flags = 0;
3384 sp->state[IDX_IPV6CP] = STATE_INITIAL;
3385 sp->fail_counter[IDX_IPV6CP] = 0;
3386 sp->pp_seq[IDX_IPV6CP] = 0;
3387 sp->pp_rseq[IDX_IPV6CP] = 0;
3388 callout_init(&sp->ch[IDX_IPV6CP],
3268 int debug = ifp->if_flags & IFF_DEBUG;
3269 int desiredcomp;
3270 u_long wantaddr;
3271
3272 len -= 4;
3273 buf = malloc (len, M_TEMP, M_NOWAIT);
3274 if (!buf)
3275 return;

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

3408{
3409 sp->ipv6cp.opts = 0;
3410 sp->ipv6cp.flags = 0;
3411 sp->state[IDX_IPV6CP] = STATE_INITIAL;
3412 sp->fail_counter[IDX_IPV6CP] = 0;
3413 sp->pp_seq[IDX_IPV6CP] = 0;
3414 sp->pp_rseq[IDX_IPV6CP] = 0;
3415 callout_init(&sp->ch[IDX_IPV6CP],
3389 (sp->pp_if.if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
3416 (SP2IFP(sp)->if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
3390}
3391
3392static void
3393sppp_ipv6cp_up(struct sppp *sp)
3394{
3395 sppp_up_event(&ipv6cp, sp);
3396}
3397

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

3450 * caused action sca, false if it has been rejected or nak'ed, and
3451 * caused action scn. (The return value is used to make the state
3452 * transition decision in the state automaton.)
3453 */
3454static int
3455sppp_ipv6cp_RCR(struct sppp *sp, struct lcp_header *h, int len)
3456{
3457 u_char *buf, *r, *p;
3417}
3418
3419static void
3420sppp_ipv6cp_up(struct sppp *sp)
3421{
3422 sppp_up_event(&ipv6cp, sp);
3423}
3424

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

3477 * caused action sca, false if it has been rejected or nak'ed, and
3478 * caused action scn. (The return value is used to make the state
3479 * transition decision in the state automaton.)
3480 */
3481static int
3482sppp_ipv6cp_RCR(struct sppp *sp, struct lcp_header *h, int len)
3483{
3484 u_char *buf, *r, *p;
3458 struct ifnet *ifp = &sp->pp_if;
3485 struct ifnet *ifp = SP2IFP(sp);
3459 int rlen, origlen, debug = ifp->if_flags & IFF_DEBUG;
3460 struct in6_addr myaddr, desiredaddr, suggestaddr;
3461 int ifidcount;
3462 int type;
3463 int collision, nohisaddr;
3464
3465 len -= 4;
3466 origlen = len;

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

3539 case IPV6CP_OPT_IFID:
3540 bzero(&desiredaddr, sizeof(desiredaddr));
3541 bcopy(&p[2], &desiredaddr.s6_addr[8], 8);
3542 collision = (bcmp(&desiredaddr.s6_addr[8],
3543 &myaddr.s6_addr[8], 8) == 0);
3544 nohisaddr = IN6_IS_ADDR_UNSPECIFIED(&desiredaddr);
3545
3546 desiredaddr.s6_addr16[0] = htons(0xfe80);
3486 int rlen, origlen, debug = ifp->if_flags & IFF_DEBUG;
3487 struct in6_addr myaddr, desiredaddr, suggestaddr;
3488 int ifidcount;
3489 int type;
3490 int collision, nohisaddr;
3491
3492 len -= 4;
3493 origlen = len;

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

3566 case IPV6CP_OPT_IFID:
3567 bzero(&desiredaddr, sizeof(desiredaddr));
3568 bcopy(&p[2], &desiredaddr.s6_addr[8], 8);
3569 collision = (bcmp(&desiredaddr.s6_addr[8],
3570 &myaddr.s6_addr[8], 8) == 0);
3571 nohisaddr = IN6_IS_ADDR_UNSPECIFIED(&desiredaddr);
3572
3573 desiredaddr.s6_addr16[0] = htons(0xfe80);
3547 desiredaddr.s6_addr16[1] = htons(sp->pp_if.if_index);
3574 desiredaddr.s6_addr16[1] = htons(SP2IFP(sp)->if_index);
3548
3549 if (!collision && !nohisaddr) {
3550 /* no collision, hisaddr known - Conf-Ack */
3551 type = CONF_ACK;
3552
3553 if (debug) {
3554 log(-1, " %s [%s]",
3555 ip6_sprintf(&desiredaddr),

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

3609/*
3610 * Analyze the IPv6CP Configure-Reject option list, and adjust our
3611 * negotiation.
3612 */
3613static void
3614sppp_ipv6cp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len)
3615{
3616 u_char *buf, *p;
3575
3576 if (!collision && !nohisaddr) {
3577 /* no collision, hisaddr known - Conf-Ack */
3578 type = CONF_ACK;
3579
3580 if (debug) {
3581 log(-1, " %s [%s]",
3582 ip6_sprintf(&desiredaddr),

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

3636/*
3637 * Analyze the IPv6CP Configure-Reject option list, and adjust our
3638 * negotiation.
3639 */
3640static void
3641sppp_ipv6cp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len)
3642{
3643 u_char *buf, *p;
3617 struct ifnet *ifp = &sp->pp_if;
3644 struct ifnet *ifp = SP2IFP(sp);
3618 int debug = ifp->if_flags & IFF_DEBUG;
3619
3620 len -= 4;
3621 buf = malloc (len, M_TEMP, M_NOWAIT);
3622 if (!buf)
3623 return;
3624
3625 if (debug)

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

3654/*
3655 * Analyze the IPv6CP Configure-NAK option list, and adjust our
3656 * negotiation.
3657 */
3658static void
3659sppp_ipv6cp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
3660{
3661 u_char *buf, *p;
3645 int debug = ifp->if_flags & IFF_DEBUG;
3646
3647 len -= 4;
3648 buf = malloc (len, M_TEMP, M_NOWAIT);
3649 if (!buf)
3650 return;
3651
3652 if (debug)

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

3681/*
3682 * Analyze the IPv6CP Configure-NAK option list, and adjust our
3683 * negotiation.
3684 */
3685static void
3686sppp_ipv6cp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
3687{
3688 u_char *buf, *p;
3662 struct ifnet *ifp = &sp->pp_if;
3689 struct ifnet *ifp = SP2IFP(sp);
3663 int debug = ifp->if_flags & IFF_DEBUG;
3664 struct in6_addr suggestaddr;
3665
3666 len -= 4;
3667 buf = malloc (len, M_TEMP, M_NOWAIT);
3668 if (!buf)
3669 return;
3670

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

3682 * Peer doesn't like our local ifid. See
3683 * if we can do something for him. We'll drop
3684 * him our address then.
3685 */
3686 if (len < 10 || p[1] != 10)
3687 break;
3688 bzero(&suggestaddr, sizeof(suggestaddr));
3689 suggestaddr.s6_addr16[0] = htons(0xfe80);
3690 int debug = ifp->if_flags & IFF_DEBUG;
3691 struct in6_addr suggestaddr;
3692
3693 len -= 4;
3694 buf = malloc (len, M_TEMP, M_NOWAIT);
3695 if (!buf)
3696 return;
3697

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

3709 * Peer doesn't like our local ifid. See
3710 * if we can do something for him. We'll drop
3711 * him our address then.
3712 */
3713 if (len < 10 || p[1] != 10)
3714 break;
3715 bzero(&suggestaddr, sizeof(suggestaddr));
3716 suggestaddr.s6_addr16[0] = htons(0xfe80);
3690 suggestaddr.s6_addr16[1] = htons(sp->pp_if.if_index);
3717 suggestaddr.s6_addr16[1] = htons(SP2IFP(sp)->if_index);
3691 bcopy(&p[2], &suggestaddr.s6_addr[8], 8);
3692
3693 sp->ipv6cp.opts |= (1 << IPV6CP_OPT_IFID);
3694 if (debug)
3695 log(-1, " [suggestaddr %s]",
3696 ip6_sprintf(&suggestaddr));
3697#ifdef IPV6CP_MYIFID_DYN
3698 /*

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

4182sppp_chap_init(struct sppp *sp)
4183{
4184 /* Chap doesn't have STATE_INITIAL at all. */
4185 sp->state[IDX_CHAP] = STATE_CLOSED;
4186 sp->fail_counter[IDX_CHAP] = 0;
4187 sp->pp_seq[IDX_CHAP] = 0;
4188 sp->pp_rseq[IDX_CHAP] = 0;
4189 callout_init(&sp->ch[IDX_CHAP],
3718 bcopy(&p[2], &suggestaddr.s6_addr[8], 8);
3719
3720 sp->ipv6cp.opts |= (1 << IPV6CP_OPT_IFID);
3721 if (debug)
3722 log(-1, " [suggestaddr %s]",
3723 ip6_sprintf(&suggestaddr));
3724#ifdef IPV6CP_MYIFID_DYN
3725 /*

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

4209sppp_chap_init(struct sppp *sp)
4210{
4211 /* Chap doesn't have STATE_INITIAL at all. */
4212 sp->state[IDX_CHAP] = STATE_CLOSED;
4213 sp->fail_counter[IDX_CHAP] = 0;
4214 sp->pp_seq[IDX_CHAP] = 0;
4215 sp->pp_rseq[IDX_CHAP] = 0;
4216 callout_init(&sp->ch[IDX_CHAP],
4190 (sp->pp_if.if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
4217 (SP2IFP(sp)->if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
4191}
4192
4193static void
4194sppp_chap_open(struct sppp *sp)
4195{
4196 if (sp->myauth.proto == PPP_CHAP &&
4197 (sp->lcp.opts & (1 << LCP_OPT_AUTH_PROTO)) != 0) {
4198 /* we are authenticator for CHAP, start it */

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

4522sppp_pap_init(struct sppp *sp)
4523{
4524 /* PAP doesn't have STATE_INITIAL at all. */
4525 sp->state[IDX_PAP] = STATE_CLOSED;
4526 sp->fail_counter[IDX_PAP] = 0;
4527 sp->pp_seq[IDX_PAP] = 0;
4528 sp->pp_rseq[IDX_PAP] = 0;
4529 callout_init(&sp->ch[IDX_PAP],
4218}
4219
4220static void
4221sppp_chap_open(struct sppp *sp)
4222{
4223 if (sp->myauth.proto == PPP_CHAP &&
4224 (sp->lcp.opts & (1 << LCP_OPT_AUTH_PROTO)) != 0) {
4225 /* we are authenticator for CHAP, start it */

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

4549sppp_pap_init(struct sppp *sp)
4550{
4551 /* PAP doesn't have STATE_INITIAL at all. */
4552 sp->state[IDX_PAP] = STATE_CLOSED;
4553 sp->fail_counter[IDX_PAP] = 0;
4554 sp->pp_seq[IDX_PAP] = 0;
4555 sp->pp_rseq[IDX_PAP] = 0;
4556 callout_init(&sp->ch[IDX_PAP],
4530 (sp->pp_if.if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
4557 (SP2IFP(sp)->if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
4531 callout_init(&sp->pap_my_to_ch,
4558 callout_init(&sp->pap_my_to_ch,
4532 (sp->pp_if.if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
4559 (SP2IFP(sp)->if_flags & IFF_NEEDSGIANT) ? 0 : CALLOUT_MPSAFE);
4533}
4534
4535static void
4536sppp_pap_open(struct sppp *sp)
4537{
4538 if (sp->hisauth.proto == PPP_PAP &&
4539 (sp->lcp.opts & (1 << LCP_OPT_AUTH_PROTO)) != 0) {
4540 /* we are authenticator for PAP, start our timer */

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

4776
4777/*
4778 * Send keepalive packets, every 10 seconds.
4779 */
4780static void
4781sppp_keepalive(void *dummy)
4782{
4783 struct sppp *sp = (struct sppp*)dummy;
4560}
4561
4562static void
4563sppp_pap_open(struct sppp *sp)
4564{
4565 if (sp->hisauth.proto == PPP_PAP &&
4566 (sp->lcp.opts & (1 << LCP_OPT_AUTH_PROTO)) != 0) {
4567 /* we are authenticator for PAP, start our timer */

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

4803
4804/*
4805 * Send keepalive packets, every 10 seconds.
4806 */
4807static void
4808sppp_keepalive(void *dummy)
4809{
4810 struct sppp *sp = (struct sppp*)dummy;
4784 struct ifnet *ifp = &sp->pp_if;
4811 struct ifnet *ifp = SP2IFP(sp);
4785 int s;
4786
4787 s = splimp();
4788 SPPP_LOCK(sp);
4789 /* Keepalive mode disabled or channel down? */
4790 if (! (sp->pp_flags & PP_KEEPALIVE) ||
4791 ! (ifp->if_flags & IFF_RUNNING))
4792 goto out;

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

4833}
4834
4835/*
4836 * Get both IP addresses.
4837 */
4838void
4839sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst, u_long *srcmask)
4840{
4812 int s;
4813
4814 s = splimp();
4815 SPPP_LOCK(sp);
4816 /* Keepalive mode disabled or channel down? */
4817 if (! (sp->pp_flags & PP_KEEPALIVE) ||
4818 ! (ifp->if_flags & IFF_RUNNING))
4819 goto out;

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

4860}
4861
4862/*
4863 * Get both IP addresses.
4864 */
4865void
4866sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst, u_long *srcmask)
4867{
4841 struct ifnet *ifp = &sp->pp_if;
4868 struct ifnet *ifp = SP2IFP(sp);
4842 struct ifaddr *ifa;
4843 struct sockaddr_in *si, *sm;
4844 u_long ssrc, ddst;
4845
4846 sm = NULL;
4847 ssrc = ddst = 0L;
4848 /*
4849 * Pick the first AF_INET address from the list,

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

4961#ifdef INET6
4962/*
4963 * Get both IPv6 addresses.
4964 */
4965static void
4966sppp_get_ip6_addrs(struct sppp *sp, struct in6_addr *src, struct in6_addr *dst,
4967 struct in6_addr *srcmask)
4968{
4869 struct ifaddr *ifa;
4870 struct sockaddr_in *si, *sm;
4871 u_long ssrc, ddst;
4872
4873 sm = NULL;
4874 ssrc = ddst = 0L;
4875 /*
4876 * Pick the first AF_INET address from the list,

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

4988#ifdef INET6
4989/*
4990 * Get both IPv6 addresses.
4991 */
4992static void
4993sppp_get_ip6_addrs(struct sppp *sp, struct in6_addr *src, struct in6_addr *dst,
4994 struct in6_addr *srcmask)
4995{
4969 struct ifnet *ifp = &sp->pp_if;
4996 struct ifnet *ifp = SP2IFP(sp);
4970 struct ifaddr *ifa;
4971 struct sockaddr_in6 *si, *sm;
4972 struct in6_addr ssrc, ddst;
4973
4974 sm = NULL;
4975 bzero(&ssrc, sizeof(ssrc));
4976 bzero(&ddst, sizeof(ddst));
4977 /*

--- 498 unchanged lines hidden ---
4997 struct ifaddr *ifa;
4998 struct sockaddr_in6 *si, *sm;
4999 struct in6_addr ssrc, ddst;
5000
5001 sm = NULL;
5002 bzero(&ssrc, sizeof(ssrc));
5003 bzero(&ddst, sizeof(ddst));
5004 /*

--- 498 unchanged lines hidden ---