From: Guillaume Nault Subject: Re: [PATCH v2 net-next 3/5] l2tp: remove l2specific_len dependency in l2tp_core Date: Mon, 15 Jan 2018 19:20:00 +0100 Message-ID: <20180115182000.GB1422@alphalink.fr> References: <7e4c380b853e31d6ec4b25db4c9812efa37b108c.1515940731.git.lorenzo.bianconi@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: davem@davemloft.net, netdev@vger.kernel.org, jchapman@katalix.com To: Lorenzo Bianconi Return-path: Received: from zimbra.alphalink.fr ([217.15.80.77]:58656 "EHLO zimbra.alphalink.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750757AbeAOSUD (ORCPT ); Mon, 15 Jan 2018 13:20:03 -0500 Content-Disposition: inline In-Reply-To: <7e4c380b853e31d6ec4b25db4c9812efa37b108c.1515940731.git.lorenzo.bianconi@redhat.com> Sender: netdev-owner@vger.kernel.org List-ID: On Sun, Jan 14, 2018 at 03:50:56PM +0100, Lorenzo Bianconi wrote: > --- a/net/l2tp/l2tp_core.h > +++ b/net/l2tp/l2tp_core.h > @@ -302,6 +302,17 @@ static inline void l2tp_session_dec_refcount(struct l2tp_session *session) > l2tp_session_free(session); > } > > +static inline int l2tp_get_l2specific_len(struct l2tp_session *session) > +{ > + switch (session->l2specific_type) { > + case L2TP_L2SPECTYPE_NONE: > + return 0; > + case L2TP_L2SPECTYPE_DEFAULT: > + default: > + return 4; > + } > +} > The data path only compares ->l2specific_type to L2SPECTYPE_DEFAULT and treats any other value as L2SPECTYPE_NONE. Therefore, we should keep this logic here and return 0 for unknown types.