From owner-svn-src-all@freebsd.org Tue Sep 15 00:38:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 846C8A01C61; Tue, 15 Sep 2015 00:38:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id AF3321911; Tue, 15 Sep 2015 00:38:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.15.2/8.15.2) with ESMTPS id t8F0bv4c099810 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 15 Sep 2015 03:37:57 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.15.2/8.15.2/Submit) id t8F0bvHv099809; Tue, 15 Sep 2015 03:37:57 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 15 Sep 2015 03:37:57 +0300 From: Gleb Smirnoff To: Alexander Motin , Dmitry Luhtionov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r287654 - head/sys/netgraph Message-ID: <20150915003757.GW1023@FreeBSD.org> References: <201509110915.t8B9FSMJ036344@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201509110915.t8B9FSMJ036344@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2015 00:38:09 -0000 Hi! The change definitely lacks the documentation change :) On Fri, Sep 11, 2015 at 09:15:28AM +0000, Alexander Motin wrote: A> Author: mav A> Date: Fri Sep 11 09:15:27 2015 A> New Revision: 287654 A> URL: https://svnweb.freebsd.org/changeset/base/287654 A> A> Log: A> Add support for PPP-Max-Payload PPPoE tag (RFC4638). A> A> Submitted by: Dmitry Luhtionov A> MFC after: 2 weeks A> A> Modified: A> head/sys/netgraph/ng_pppoe.c A> head/sys/netgraph/ng_pppoe.h A> A> Modified: head/sys/netgraph/ng_pppoe.c A> ============================================================================== A> --- head/sys/netgraph/ng_pppoe.c Fri Sep 11 08:48:16 2015 (r287653) A> +++ head/sys/netgraph/ng_pppoe.c Fri Sep 11 09:15:27 2015 (r287654) A> @@ -168,6 +168,13 @@ static const struct ng_cmdlist ng_pppoe_ A> &ng_parse_enaddr_type, A> NULL A> }, A> + { A> + NGM_PPPOE_COOKIE, A> + NGM_PPPOE_SETMAXP, A> + "setmaxp", A> + &ng_parse_uint16_type, A> + NULL A> + }, A> { 0 } A> }; A> A> @@ -262,6 +269,7 @@ struct PPPoE { A> struct ether_header eh; A> LIST_HEAD(, sess_con) listeners; A> struct sess_hash_entry sesshash[SESSHASHSIZE]; A> + struct maxptag max_payload; /* PPP-Max-Payload (RFC4638) */ A> }; A> typedef struct PPPoE *priv_p; A> A> @@ -1004,6 +1012,13 @@ ng_pppoe_rcvmsg(node_p node, item_p item A> bcopy(msg->data, &privp->eh.ether_shost, A> ETHER_ADDR_LEN); A> break; A> + case NGM_PPPOE_SETMAXP: A> + if (msg->header.arglen != sizeof(uint16_t)) A> + LEAVE(EINVAL); A> + privp->max_payload.hdr.tag_type = PTT_MAX_PAYL; A> + privp->max_payload.hdr.tag_len = htons(sizeof(uint16_t)); A> + privp->max_payload.data = htons(*((uint16_t *)msg->data)); A> + break; A> default: A> LEAVE(EINVAL); A> } A> @@ -1071,6 +1086,8 @@ pppoe_start(sessp sp) A> init_tags(sp); A> insert_tag(sp, &uniqtag.hdr); A> insert_tag(sp, &neg->service.hdr); A> + if (privp->max_payload.data != 0) A> + insert_tag(sp, &privp->max_payload.hdr); A> make_packet(sp); A> /* A> * Send packet and prepare to retransmit it after timeout. A> @@ -1124,6 +1141,28 @@ send_sessionid(sessp sp) A> return (error); A> } A> A> +static int A> +send_maxp(sessp sp, const struct pppoe_tag *tag) A> +{ A> + int error; A> + struct ng_mesg *msg; A> + struct ngpppoe_maxp *maxp; A> + A> + CTR2(KTR_NET, "%20s: called %d", __func__, sp->Session_ID); A> + A> + NG_MKMESSAGE(msg, NGM_PPPOE_COOKIE, NGM_PPPOE_SETMAXP, A> + sizeof(struct ngpppoe_maxp), M_NOWAIT); A> + if (msg == NULL) A> + return (ENOMEM); A> + A> + maxp = (struct ngpppoe_maxp *)msg->data; A> + strncpy(maxp->hook, NG_HOOK_NAME(sp->hook), NG_HOOKSIZ); A> + maxp->data = ntohs(((const struct maxptag *)tag)->data); A> + NG_SEND_MSG_ID(error, NG_HOOK_NODE(sp->hook), msg, sp->creator, 0); A> + A> + return (error); A> +} A> + A> /* A> * Receive data from session hook and do something with it. A> */ A> @@ -1464,6 +1503,9 @@ ng_pppoe_rcvdata_ether(hook_p hook, item A> insert_tag(sp, tag); /* return it */ A> send_acname(sp, tag); A> } A> + if ((tag = get_tag(ph, PTT_MAX_PAYL)) && A> + (privp->max_payload.data != 0)) A> + insert_tag(sp, tag); /* return it */ A> insert_tag(sp, &neg->service.hdr); /* Service */ A> scan_tags(sp, ph); A> make_packet(sp); A> @@ -1602,6 +1644,9 @@ ng_pppoe_rcvdata_ether(hook_p hook, item A> m_freem(neg->m); A> free(sp->neg, M_NETGRAPH_PPPOE); A> sp->neg = NULL; A> + if ((tag = get_tag(ph, PTT_MAX_PAYL)) && A> + (privp->max_payload.data != 0)) A> + send_maxp(sp, tag); A> pppoe_send_event(sp, NGM_PPPOE_SUCCESS); A> break; A> case PADT_CODE: A> A> Modified: head/sys/netgraph/ng_pppoe.h A> ============================================================================== A> --- head/sys/netgraph/ng_pppoe.h Fri Sep 11 08:48:16 2015 (r287653) A> +++ head/sys/netgraph/ng_pppoe.h Fri Sep 11 09:15:27 2015 (r287654) A> @@ -51,6 +51,7 @@ A> #define NG_PPPOE_NODE_TYPE "pppoe" A> A> #define NGM_PPPOE_COOKIE 1089893072 A> +#define NGM_PPPOE_SETMAXP_COOKIE 1441624322 A> A> #define PPPOE_SERVICE_NAME_SIZE 64 /* for now */ A> A> @@ -83,6 +84,7 @@ enum cmd { A> NGM_PPPOE_SETMODE = 12, /* set to standard or compat modes */ A> NGM_PPPOE_GETMODE = 13, /* see current mode */ A> NGM_PPPOE_SETENADDR = 14, /* set Ethernet address */ A> + NGM_PPPOE_SETMAXP = 15 /* Set PPP-Max-Payload value */ A> }; A> A> /*********************** A> @@ -147,6 +149,13 @@ struct ngpppoe_sts { A> { NULL } \ A> } A> A> +/* A> + * This structure is used to send PPP-Max-Payload value from server to client. A> + */ A> +struct ngpppoe_maxp { A> + char hook[NG_HOOKSIZ]; /* hook associated with event session */ A> + uint16_t data; A> +}; A> A> /******************************************************************** A> * Constants and definitions specific to pppoe A> @@ -229,6 +238,10 @@ struct datatag { A> u_int8_t data[PPPOE_SERVICE_NAME_SIZE]; A> }; A> A> +struct maxptag { A> + struct pppoe_tag hdr; A> + uint16_t data; A> +}; A> A> /* A> * Define the order in which we will place tags in packets A> _______________________________________________ A> svn-src-all@freebsd.org mailing list A> https://lists.freebsd.org/mailman/listinfo/svn-src-all A> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" -- Totus tuus, Glebius.