Deleted Added
full compact
if_spppsubr.c (105228) if_spppsubr.c (109623)
1/*
2 * Synchronous PPP/Cisco link level subroutines.
3 * Keepalive protocol implemented in both Cisco and PPP modes.
4 *
5 * Copyright (C) 1994-1996 Cronyx Engineering Ltd.
6 * Author: Serge Vakulenko, <vak@cronyx.ru>
7 *
8 * Heavily revamped to conform to RFC 1661.
9 * Copyright (C) 1997, 2001 Joerg Wunsch.
10 *
11 * This software is distributed with NO WARRANTIES, not even the implied
12 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 *
14 * Authors grant any other persons or organisations permission to use
15 * or modify this software as long as this message is kept with the software,
16 * all derivative works or modified versions.
17 *
18 * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997
19 *
1/*
2 * Synchronous PPP/Cisco link level subroutines.
3 * Keepalive protocol implemented in both Cisco and PPP modes.
4 *
5 * Copyright (C) 1994-1996 Cronyx Engineering Ltd.
6 * Author: Serge Vakulenko, <vak@cronyx.ru>
7 *
8 * Heavily revamped to conform to RFC 1661.
9 * Copyright (C) 1997, 2001 Joerg Wunsch.
10 *
11 * This software is distributed with NO WARRANTIES, not even the implied
12 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 *
14 * Authors grant any other persons or organisations permission to use
15 * or modify this software as long as this message is kept with the software,
16 * all derivative works or modified versions.
17 *
18 * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997
19 *
20 * $FreeBSD: head/sys/net/if_spppsubr.c 105228 2002-10-16 10:45:53Z phk $
20 * $FreeBSD: head/sys/net/if_spppsubr.c 109623 2003-01-21 08:56:16Z alfred $
21 */
22
23#include <sys/param.h>
24
25#if defined(__FreeBSD__) && __FreeBSD__ >= 3
26#include "opt_inet.h"
27#include "opt_inet6.h"
28#include "opt_ipx.h"

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

613
614 /*
615 * Trim the VJ header off the packet, and prepend
616 * the uncompressed IP header (which will usually
617 * end up in two chained mbufs since there's not
618 * enough leading space in the existing mbuf).
619 */
620 m_adj(m, vjlen);
21 */
22
23#include <sys/param.h>
24
25#if defined(__FreeBSD__) && __FreeBSD__ >= 3
26#include "opt_inet.h"
27#include "opt_inet6.h"
28#include "opt_ipx.h"

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

613
614 /*
615 * Trim the VJ header off the packet, and prepend
616 * the uncompressed IP header (which will usually
617 * end up in two chained mbufs since there's not
618 * enough leading space in the existing mbuf).
619 */
620 m_adj(m, vjlen);
621 M_PREPEND(m, hlen, M_DONTWAIT);
621 M_PREPEND(m, hlen, M_NOWAIT);
622 if (m == NULL)
623 goto drop2;
624 bcopy(iphdr, mtod(m, u_char *), hlen);
625
626 schednetisr (NETISR_IP);
627 inq = &ipintrq;
628 }
629 do_account++;

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

887 if (dst->sa_family == AF_INET6) {
888 /* XXX do something tricky here? */
889 }
890#endif
891
892 /*
893 * Prepend general data packet PPP header. For now, IP only.
894 */
622 if (m == NULL)
623 goto drop2;
624 bcopy(iphdr, mtod(m, u_char *), hlen);
625
626 schednetisr (NETISR_IP);
627 inq = &ipintrq;
628 }
629 do_account++;

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

887 if (dst->sa_family == AF_INET6) {
888 /* XXX do something tricky here? */
889 }
890#endif
891
892 /*
893 * Prepend general data packet PPP header. For now, IP only.
894 */
895 M_PREPEND (m, PPP_HEADER_LEN, M_DONTWAIT);
895 M_PREPEND (m, PPP_HEADER_LEN, M_NOWAIT);
896 if (! m) {
897 if (debug)
898 log(LOG_DEBUG, SPP_FMT "no memory for transmit header\n",
899 SPP_ARGS(ifp));
900 ++ifp->if_oerrors;
901 splx (s);
902 return (ENOBUFS);
903 }

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

1029 sp->pp_last_recv = sp->pp_last_sent = time_second;
1030 sp->confflags = 0;
1031#ifdef INET
1032 sp->confflags |= CONF_ENABLE_VJ;
1033#endif
1034#ifdef INET6
1035 sp->confflags |= CONF_ENABLE_IPV6;
1036#endif
896 if (! m) {
897 if (debug)
898 log(LOG_DEBUG, SPP_FMT "no memory for transmit header\n",
899 SPP_ARGS(ifp));
900 ++ifp->if_oerrors;
901 splx (s);
902 return (ENOBUFS);
903 }

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

1029 sp->pp_last_recv = sp->pp_last_sent = time_second;
1030 sp->confflags = 0;
1031#ifdef INET
1032 sp->confflags |= CONF_ENABLE_VJ;
1033#endif
1034#ifdef INET6
1035 sp->confflags |= CONF_ENABLE_IPV6;
1036#endif
1037 sp->pp_comp = malloc(sizeof(struct slcompress), M_TEMP, M_WAIT);
1037 sp->pp_comp = malloc(sizeof(struct slcompress), M_TEMP, 0);
1038 sl_compress_init(sp->pp_comp, -1);
1039 sppp_lcp_init(sp);
1040 sppp_ipcp_init(sp);
1041 sppp_ipv6cp_init(sp);
1042 sppp_pap_init(sp);
1043 sppp_chap_init(sp);
1044}
1045

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

1350#else
1351 u_long t = (time.tv_sec - boottime.tv_sec) * 1000;
1352#endif
1353
1354#if defined(__FreeBSD__) && __FreeBSD__ >= 3
1355 getmicrouptime(&tv);
1356#endif
1357
1038 sl_compress_init(sp->pp_comp, -1);
1039 sppp_lcp_init(sp);
1040 sppp_ipcp_init(sp);
1041 sppp_ipv6cp_init(sp);
1042 sppp_pap_init(sp);
1043 sppp_chap_init(sp);
1044}
1045

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

1350#else
1351 u_long t = (time.tv_sec - boottime.tv_sec) * 1000;
1352#endif
1353
1354#if defined(__FreeBSD__) && __FreeBSD__ >= 3
1355 getmicrouptime(&tv);
1356#endif
1357
1358 MGETHDR (m, M_DONTWAIT, MT_DATA);
1358 MGETHDR (m, M_NOWAIT, MT_DATA);
1359 if (! m)
1360 return;
1361 m->m_pkthdr.len = m->m_len = PPP_HEADER_LEN + CISCO_PACKET_LEN;
1362 m->m_pkthdr.rcvif = 0;
1363
1364 h = mtod (m, struct ppp_header*);
1365 h->address = CISCO_MULTICAST;
1366 h->control = 0;

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

1403{
1404 STDDCL;
1405 struct ppp_header *h;
1406 struct lcp_header *lh;
1407 struct mbuf *m;
1408
1409 if (len > MHLEN - PPP_HEADER_LEN - LCP_HEADER_LEN)
1410 len = MHLEN - PPP_HEADER_LEN - LCP_HEADER_LEN;
1359 if (! m)
1360 return;
1361 m->m_pkthdr.len = m->m_len = PPP_HEADER_LEN + CISCO_PACKET_LEN;
1362 m->m_pkthdr.rcvif = 0;
1363
1364 h = mtod (m, struct ppp_header*);
1365 h->address = CISCO_MULTICAST;
1366 h->control = 0;

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

1403{
1404 STDDCL;
1405 struct ppp_header *h;
1406 struct lcp_header *lh;
1407 struct mbuf *m;
1408
1409 if (len > MHLEN - PPP_HEADER_LEN - LCP_HEADER_LEN)
1410 len = MHLEN - PPP_HEADER_LEN - LCP_HEADER_LEN;
1411 MGETHDR (m, M_DONTWAIT, MT_DATA);
1411 MGETHDR (m, M_NOWAIT, MT_DATA);
1412 if (! m)
1413 return;
1414 m->m_pkthdr.len = m->m_len = PPP_HEADER_LEN + LCP_HEADER_LEN + len;
1415 m->m_pkthdr.rcvif = 0;
1416
1417 h = mtod (m, struct ppp_header*);
1418 h->address = PPP_ALLSTATIONS; /* broadcast address */
1419 h->control = PPP_UI; /* Unnumbered Info */

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

4609 struct lcp_header *lh;
4610 struct mbuf *m;
4611 u_char *p;
4612 int len;
4613 unsigned int mlen;
4614 const char *msg;
4615 va_list ap;
4616
1412 if (! m)
1413 return;
1414 m->m_pkthdr.len = m->m_len = PPP_HEADER_LEN + LCP_HEADER_LEN + len;
1415 m->m_pkthdr.rcvif = 0;
1416
1417 h = mtod (m, struct ppp_header*);
1418 h->address = PPP_ALLSTATIONS; /* broadcast address */
1419 h->control = PPP_UI; /* Unnumbered Info */

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

4609 struct lcp_header *lh;
4610 struct mbuf *m;
4611 u_char *p;
4612 int len;
4613 unsigned int mlen;
4614 const char *msg;
4615 va_list ap;
4616
4617 MGETHDR (m, M_DONTWAIT, MT_DATA);
4617 MGETHDR (m, M_NOWAIT, MT_DATA);
4618 if (! m)
4619 return;
4620 m->m_pkthdr.rcvif = 0;
4621
4622 h = mtod (m, struct ppp_header*);
4623 h->address = PPP_ALLSTATIONS; /* broadcast address */
4624 h->control = PPP_UI; /* Unnumbered Info */
4625 h->protocol = htons(cp->proto);

--- 749 unchanged lines hidden ---
4618 if (! m)
4619 return;
4620 m->m_pkthdr.rcvif = 0;
4621
4622 h = mtod (m, struct ppp_header*);
4623 h->address = PPP_ALLSTATIONS; /* broadcast address */
4624 h->control = PPP_UI; /* Unnumbered Info */
4625 h->protocol = htons(cp->proto);

--- 749 unchanged lines hidden ---