1
2/*
3 * ng_ppp.c
4 *
5 * Copyright (c) 1996-2000 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and
--- 22 unchanged lines hidden (view full) ---
31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Archie Cobbs <archie@freebsd.org>
38 *
39 * $FreeBSD: head/sys/netgraph/ng_ppp.c 106665 2002-11-08 21:13:18Z jhb $
40 * $Whistle: ng_ppp.c,v 1.24 1999/11/01 09:24:52 julian Exp $
41 */
42
43/*
44 * PPP node type.
45 */
46
47#include <sys/param.h>
--- 1542 unchanged lines hidden (view full) ---
1590 if (len > link->conf.mru - hdr_len)
1591 len = link->conf.mru - hdr_len;
1592 distrib[activeLinkNum] -= len;
1593 lastFragment = (len == m->m_pkthdr.len);
1594
1595 /* Split off next fragment as "m2" */
1596 m2 = m;
1597 if (!lastFragment) {
1598 struct mbuf *n = m_split(m, len, M_NOWAIT);
1599
1600 if (n == NULL) {
1601 NG_FREE_M(m);
1602 NG_FREE_META(meta);
1603 return (ENOMEM);
1604 }
1605 m = n;
1606 }
--- 304 unchanged lines hidden (view full) ---
1911}
1912
1913/*
1914 * Prepend some bytes to an mbuf
1915 */
1916static struct mbuf *
1917ng_ppp_prepend(struct mbuf *m, const void *buf, int len)
1918{
1919 M_PREPEND(m, len, M_NOWAIT);
1920 if (m == NULL || (m->m_len < len && (m = m_pullup(m, len)) == NULL))
1921 return (NULL);
1922 bcopy(buf, mtod(m, u_char *), len);
1923 return (m);
1924}
1925
1926/*
1927 * Update private information that is derived from other private information
--- 173 unchanged lines hidden ---
2/*
3 * ng_ppp.c
4 *
5 * Copyright (c) 1996-2000 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and
--- 22 unchanged lines hidden (view full) ---
31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Archie Cobbs <archie@freebsd.org>
38 *
39 * $FreeBSD: head/sys/netgraph/ng_ppp.c 106665 2002-11-08 21:13:18Z jhb $
40 * $Whistle: ng_ppp.c,v 1.24 1999/11/01 09:24:52 julian Exp $
41 */
42
43/*
44 * PPP node type.
45 */
46
47#include <sys/param.h>
--- 1542 unchanged lines hidden (view full) ---
1590 if (len > link->conf.mru - hdr_len)
1591 len = link->conf.mru - hdr_len;
1592 distrib[activeLinkNum] -= len;
1593 lastFragment = (len == m->m_pkthdr.len);
1594
1595 /* Split off next fragment as "m2" */
1596 m2 = m;
1597 if (!lastFragment) {
1598 struct mbuf *n = m_split(m, len, M_NOWAIT);
1599
1600 if (n == NULL) {
1601 NG_FREE_M(m);
1602 NG_FREE_META(meta);
1603 return (ENOMEM);
1604 }
1605 m = n;
1606 }
--- 304 unchanged lines hidden (view full) ---
1911}
1912
1913/*
1914 * Prepend some bytes to an mbuf
1915 */
1916static struct mbuf *
1917ng_ppp_prepend(struct mbuf *m, const void *buf, int len)
1918{
1919 M_PREPEND(m, len, M_NOWAIT);
1920 if (m == NULL || (m->m_len < len && (m = m_pullup(m, len)) == NULL))
1921 return (NULL);
1922 bcopy(buf, mtod(m, u_char *), len);
1923 return (m);
1924}
1925
1926/*
1927 * Update private information that is derived from other private information
--- 173 unchanged lines hidden ---