2bae9358d7
FossilOrigin-Name: c53d95729c009f8f80a7d63847cef7668ff73f8af0523ab65f7734696f85399c
20 lines
427 B
C
20 lines
427 B
C
#include <string.h>
|
|
|
|
#include "capwap.h"
|
|
#include "conn.h"
|
|
#include "cwmsg.h"
|
|
|
|
void cwmsg_addelem_mtu_discovery_padding(struct cwmsg * msg, struct conn* conn)
|
|
{
|
|
int len = conn->mtu - (msg->msgelems-msg->buffer+msg->pos)-4;
|
|
|
|
if (len < 0 )
|
|
return;
|
|
|
|
uint32_t val = CWMSGELEM_MTU_DISCOVERY_PADDING<<16|len;
|
|
*((uint32_t*)(msg->msgelems+msg->pos))=htonl(val);
|
|
memset(msg->msgelems+4+msg->pos,0xff,len);
|
|
msg->pos+=4+len;
|
|
}
|
|
|