Deleted Added
full compact
ng_pppoe.c (98636) ng_pppoe.c (102244)
1
2/*
3 * ng_pppoe.c
4 *
5 * Copyright (c) 1996-1999 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: Julian Elischer <julian@freebsd.org>
38 *
1
2/*
3 * ng_pppoe.c
4 *
5 * Copyright (c) 1996-1999 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: Julian Elischer <julian@freebsd.org>
38 *
39 * $FreeBSD: head/sys/netgraph/ng_pppoe.c 98636 2002-06-22 21:00:53Z brian $
39 * $FreeBSD: head/sys/netgraph/ng_pppoe.c 102244 2002-08-22 00:30:03Z archie $
40 * $Whistle: ng_pppoe.c,v 1.10 1999/11/01 09:24:52 julian Exp $
41 */
42#if 0
43#define AAA printf("pppoe: %s\n", __func__ );
44#define BBB printf("-%d-", __LINE__ );
45#else
46#define AAA
47#define BBB

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

901 sizeof(struct ngpppoe_sts), M_NOWAIT);
902 if (msg == NULL)
903 return (ENOMEM);
904
905 sts = (struct ngpppoe_sts *)msg->data;
906 tlen = min(NG_HOOKLEN, ntohs(tag->tag_len));
907 strncpy(sts->hook, tag->tag_data, tlen);
908 sts->hook[tlen] = '\0';
40 * $Whistle: ng_pppoe.c,v 1.10 1999/11/01 09:24:52 julian Exp $
41 */
42#if 0
43#define AAA printf("pppoe: %s\n", __func__ );
44#define BBB printf("-%d-", __LINE__ );
45#else
46#define AAA
47#define BBB

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

901 sizeof(struct ngpppoe_sts), M_NOWAIT);
902 if (msg == NULL)
903 return (ENOMEM);
904
905 sts = (struct ngpppoe_sts *)msg->data;
906 tlen = min(NG_HOOKLEN, ntohs(tag->tag_len));
907 strncpy(sts->hook, tag->tag_data, tlen);
908 sts->hook[tlen] = '\0';
909 NG_SEND_MSG_ID(error, NG_HOOK_NODE(sp->hook), msg, sp->creator, NULL);
909 NG_SEND_MSG_ID(error, NG_HOOK_NODE(sp->hook), msg, sp->creator, 0);
910
911 return (error);
912}
913
914static int
915send_sessionid(sessp sp)
916{
917 int error;
918 struct ng_mesg *msg;
919
920 NG_MKMESSAGE(msg, NGM_PPPOE_COOKIE, NGM_PPPOE_SESSIONID,
921 sizeof(u_int16_t), M_NOWAIT);
922 if (msg == NULL)
923 return (ENOMEM);
924
925 *(u_int16_t *)msg->data = sp->Session_ID;
910
911 return (error);
912}
913
914static int
915send_sessionid(sessp sp)
916{
917 int error;
918 struct ng_mesg *msg;
919
920 NG_MKMESSAGE(msg, NGM_PPPOE_COOKIE, NGM_PPPOE_SESSIONID,
921 sizeof(u_int16_t), M_NOWAIT);
922 if (msg == NULL)
923 return (ENOMEM);
924
925 *(u_int16_t *)msg->data = sp->Session_ID;
926 NG_SEND_MSG_ID(error, NG_HOOK_NODE(sp->hook), msg, sp->creator, NULL);
926 NG_SEND_MSG_ID(error, NG_HOOK_NODE(sp->hook), msg, sp->creator, 0);
927
928 return (error);
929}
930
931/*
932 * Receive data, and do something with it.
933 * The caller will never free m or meta, so
934 * if we use up this data or abort we must free BOTH of these.

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

1732
1733AAA
1734 NG_MKMESSAGE(msg, NGM_PPPOE_COOKIE, cmdid,
1735 sizeof(struct ngpppoe_sts), M_NOWAIT);
1736 if (msg == NULL)
1737 return (ENOMEM);
1738 sts = (struct ngpppoe_sts *)msg->data;
1739 strncpy(sts->hook, NG_HOOK_NAME(sp->hook), NG_HOOKLEN + 1);
927
928 return (error);
929}
930
931/*
932 * Receive data, and do something with it.
933 * The caller will never free m or meta, so
934 * if we use up this data or abort we must free BOTH of these.

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

1732
1733AAA
1734 NG_MKMESSAGE(msg, NGM_PPPOE_COOKIE, cmdid,
1735 sizeof(struct ngpppoe_sts), M_NOWAIT);
1736 if (msg == NULL)
1737 return (ENOMEM);
1738 sts = (struct ngpppoe_sts *)msg->data;
1739 strncpy(sts->hook, NG_HOOK_NAME(sp->hook), NG_HOOKLEN + 1);
1740 NG_SEND_MSG_ID(error, NG_HOOK_NODE(sp->hook), msg, sp->creator, NULL);
1740 NG_SEND_MSG_ID(error, NG_HOOK_NODE(sp->hook), msg, sp->creator, 0);
1741 return (error);
1742}
1741 return (error);
1742}