mtu discovery padding added

FossilOrigin-Name: 391a17b2ab460b54a220c3e128578a37610e71f524b3d127316f201bf4dfd4af
This commit is contained in:
7u83@mail.ru
2018-03-11 09:34:20 +00:00
parent 4171d208d0
commit 41688c4e60
28 changed files with 352 additions and 276 deletions

View File

@ -16,6 +16,7 @@ OBJS=\
capwap_out_ac_ip_list.o \
capwap_in_session_id.o \
capwap_in_vendor_specific_payload.o \
capwap_in_mtu_discovery_padding.o
LIBDIR := ../../../lib

View File

@ -88,6 +88,18 @@ static struct cw_ElemHandler handlers[] = {
capwap_in_vendor_specific_payload /* get */
}
,
{
"MTU Discovery Padding", /* name */
CAPWAP_ELEM_MTU_DISCOVERY_PADDING, /* Element ID */
0,0, /* Vendor / Proto */
0,0, /* min/max length */
NULL, /* type */
NULL, /* Key */
capwap_in_mtu_discovery_padding /* get */
}
,
{0,0,0,0,0,0,0,0}
@ -97,10 +109,11 @@ static struct cw_ElemHandler handlers[] = {
static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
static struct cw_ElemDef discovery_request_elements[] ={
{0,0,CAPWAP_ELEM_DISCOVERY_TYPE, 1, 0},
{0,0,CAPWAP_ELEM_WTP_MAC_TYPE, 1, 0},
{0,0,CAPWAP_ELEM_WTP_BOARD_DATA, 1, 0},
{0,0,CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
{0,0,CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
{0,0,CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE, 1, 0},
{0,0,CAPWAP_ELEM_WTP_MAC_TYPE, 1, 0},
{0,0,CAPWAP_ELEM_MTU_DISCOVERY_PADDING, 0, 0},
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, 0},
{0,0,0,0,0}

View File

@ -0,0 +1,43 @@
/*
This file is part of libcapwap.
libcapwap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libcapwap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cw/capwap.h"
#include "cw/msget.h"
#include "cw/dbg.h"
int capwap_in_mtu_discovery_padding(struct cw_ElemHandler *eh,
struct cw_ElemHandlerParams *params, uint8_t * data,
int len)
{
int i, n;
n = 0;
for (i = 0; i < len; i++) {
if (data[i] != 0xff)
n++;
}
if (n){
cw_dbg(DBG_RFC,
"MTU discovery padding msg elem contains %d non-0xFF byte(s) out of %d, See RFC 5415.",
n, len);
if (params->conn->strict_capwap)
return CAPWAP_RESULT_UNRECOGNIZED_MESSAGE_ELEMENT;
}
return CAPWAP_RESULT_SUCCESS;
}

View File

@ -25,6 +25,10 @@ int capwap_in_vendor_specific_payload(struct cw_ElemHandler *handler,
struct cw_ElemHandlerParams *params,
uint8_t * data, int len);
int capwap_in_mtu_discovery_padding(struct cw_ElemHandler *eh,
struct cw_ElemHandlerParams *params, uint8_t * data,
int len);
/*
extern int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a,
uint8_t * dst);