decode/pppoe: Run clang-format

These files have existing problems which prevent patches from
passing the format check on them.
pull/13817/head
Thomas Winter 12 months ago committed by Victor Julien
parent 0662736167
commit 498ae6d1fa

@ -21,7 +21,6 @@
* @{
*/
/**
* \file
*
@ -161,7 +160,7 @@ static int DecodePPPUncompressedProto(ThreadVars *tv, DecodeThreadVars *dtv, Pac
case PPP_CCP:
case PPP_CBCP:
case PPP_COMP_DGRAM:
ENGINE_SET_EVENT(p,PPP_UNSUP_PROTO);
ENGINE_SET_EVENT(p, PPP_UNSUP_PROTO);
return TM_ECODE_OK;
default:
@ -231,7 +230,7 @@ int DecodePPP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *p
* Decode malformed ip layer PPP packet
* Expected test value: 1
*/
static int DecodePPPtest01 (void)
static int DecodePPPtest01(void)
{
uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00 };
Packet *p = PacketGetFromAlloc();
@ -247,7 +246,7 @@ static int DecodePPPtest01 (void)
/* Function my returns here with expected value */
if(ENGINE_ISSET_EVENT(p,PPPIPV4_PKT_TOO_SMALL)) {
if (ENGINE_ISSET_EVENT(p, PPPIPV4_PKT_TOO_SMALL)) {
SCFree(p);
return 1;
}
@ -260,13 +259,12 @@ static int DecodePPPtest01 (void)
* Decode malformed ppp layer packet
* Expected test value: 1
*/
static int DecodePPPtest02 (void)
static int DecodePPPtest02(void)
{
uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0xff, 0x45, 0xc0, 0x00, 0x2c, 0x4d,
0xed, 0x00, 0x00, 0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01,
0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00,
0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1, 0x00, 0x00 };
uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0xff, 0x45, 0xc0, 0x00, 0x2c, 0x4d, 0xed, 0x00, 0x00,
0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01, 0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1,
0x00, 0x00 };
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
@ -280,7 +278,7 @@ static int DecodePPPtest02 (void)
/* Function must returns here */
if(ENGINE_ISSET_EVENT(p,PPP_WRONG_TYPE)) {
if (ENGINE_ISSET_EVENT(p, PPP_WRONG_TYPE)) {
SCFree(p);
return 1;
}
@ -295,13 +293,12 @@ static int DecodePPPtest02 (void)
* \retval 0 Test failed
* \retval 1 Test succeeded
*/
static int DecodePPPtest03 (void)
static int DecodePPPtest03(void)
{
uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00, 0x2c, 0x4d,
0xed, 0x00, 0x00, 0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01,
0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00,
0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1, 0x00, 0x00 };
uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00, 0x2c, 0x4d, 0xed, 0x00, 0x00,
0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01, 0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1,
0x00, 0x00 };
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
@ -317,22 +314,22 @@ static int DecodePPPtest03 (void)
FlowShutdown();
if(ENGINE_ISSET_EVENT(p,PPP_PKT_TOO_SMALL)) {
if (ENGINE_ISSET_EVENT(p, PPP_PKT_TOO_SMALL)) {
SCFree(p);
return 0;
}
if(ENGINE_ISSET_EVENT(p,PPPIPV4_PKT_TOO_SMALL)) {
if (ENGINE_ISSET_EVENT(p, PPPIPV4_PKT_TOO_SMALL)) {
SCFree(p);
return 0;
}
if(ENGINE_ISSET_EVENT(p,PPP_WRONG_TYPE)) {
if (ENGINE_ISSET_EVENT(p, PPP_WRONG_TYPE)) {
SCFree(p);
return 0;
}
if (!(ENGINE_ISSET_EVENT(p,IPV4_TRUNC_PKT))) {
if (!(ENGINE_ISSET_EVENT(p, IPV4_TRUNC_PKT))) {
SCFree(p);
return 0;
}
@ -342,19 +339,17 @@ static int DecodePPPtest03 (void)
return 1;
}
/* DecodePPPtest04
* Check if ppp header is null
* Expected test value: 1
*/
static int DecodePPPtest04 (void)
static int DecodePPPtest04(void)
{
uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00, 0x2c, 0x4d,
0xed, 0x00, 0x00, 0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01,
0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00,
0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1, 0x00, 0x00 };
uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00, 0x2c, 0x4d, 0xed, 0x00, 0x00,
0xff, 0x06, 0xd5, 0x17, 0xbf, 0x01, 0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1,
0x00, 0x00 };
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
@ -370,7 +365,7 @@ static int DecodePPPtest04 (void)
FlowShutdown();
if (!(ENGINE_ISSET_EVENT(p,IPV4_TRUNC_PKT))) {
if (!(ENGINE_ISSET_EVENT(p, IPV4_TRUNC_PKT))) {
SCFree(p);
return 0;
}

@ -25,43 +25,43 @@
#define SURICATA_DECODE_PPP_H
/** Point to Point Protocol RFC1331 - Supported tyes */
#define PPP_IP 0x0021 /* Internet Protocol */
#define PPP_IPV6 0x0057 /* Internet Protocol version 6 */
#define PPP_VJ_UCOMP 0x002f /* VJ uncompressed TCP/IP */
#define PPP_IP 0x0021 /* Internet Protocol */
#define PPP_IPV6 0x0057 /* Internet Protocol version 6 */
#define PPP_VJ_UCOMP 0x002f /* VJ uncompressed TCP/IP */
/** Unsupported PPP types (libpcap source reference) */
#define PPP_IPX 0x002b /* Novell IPX Protocol */
#define PPP_VJ_COMP 0x002d /* VJ compressed TCP/IP */
#define PPP_IPX 0x002b /* Novell IPX Protocol */
#define PPP_OSI 0x0023 /* OSI Network Layer */
#define PPP_NS 0x0025 /* Xerox NS IDP */
#define PPP_DECNET 0x0027 /* DECnet Phase IV */
#define PPP_APPLE 0x0029 /* Appletalk */
#define PPP_BRPDU 0x0031 /* Bridging PDU */
#define PPP_STII 0x0033 /* Stream Protocol (ST-II) */
#define PPP_VINES 0x0035 /* Banyan Vines */
#define PPP_HELLO 0x0201 /* 802.1d Hello Packets */
#define PPP_LUXCOM 0x0231 /* Luxcom */
#define PPP_SNS 0x0233 /* Sigma Network Systems */
#define PPP_MPLS_UCAST 0x0281 /* rfc 3032 */
#define PPP_MPLS_MCAST 0x0283 /* rfc 3022 */
#define PPP_IPCP 0x8021 /* IP Control Protocol */
#define PPP_OSICP 0x8023 /* OSI Network Layer Control Protocol */
#define PPP_NSCP 0x8025 /* Xerox NS IDP Control Protocol */
#define PPP_DECNETCP 0x8027 /* DECnet Control Protocol */
#define PPP_APPLECP 0x8029 /* Appletalk Control Protocol */
#define PPP_IPXCP 0x802b /* Novell IPX Control Protocol */
#define PPP_STIICP 0x8033 /* Stream Protocol Control Protocol */
#define PPP_VINESCP 0x8035 /* Banyan Vines Control Protocol */
#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
#define PPP_MPLSCP 0x8281 /* rfc 3022 */
#define PPP_LCP 0xc021 /* Link Control Protocol */
#define PPP_PAP 0xc023 /* Password Authentication Protocol */
#define PPP_LQM 0xc025 /* Link Quality Monitoring */
#define PPP_CHAP 0xc223 /* Challenge Handshake Authentication Protocol */
#define PPP_CCP 0x80fd /* Compression Control Protocol */
#define PPP_CBCP 0xc029 /* Callback Control Protocol CBCP */
#define PPP_COMP_DGRAM 0x00fd /* Compressed datagram */
#define PPP_IPX 0x002b /* Novell IPX Protocol */
#define PPP_VJ_COMP 0x002d /* VJ compressed TCP/IP */
#define PPP_IPX 0x002b /* Novell IPX Protocol */
#define PPP_OSI 0x0023 /* OSI Network Layer */
#define PPP_NS 0x0025 /* Xerox NS IDP */
#define PPP_DECNET 0x0027 /* DECnet Phase IV */
#define PPP_APPLE 0x0029 /* Appletalk */
#define PPP_BRPDU 0x0031 /* Bridging PDU */
#define PPP_STII 0x0033 /* Stream Protocol (ST-II) */
#define PPP_VINES 0x0035 /* Banyan Vines */
#define PPP_HELLO 0x0201 /* 802.1d Hello Packets */
#define PPP_LUXCOM 0x0231 /* Luxcom */
#define PPP_SNS 0x0233 /* Sigma Network Systems */
#define PPP_MPLS_UCAST 0x0281 /* rfc 3032 */
#define PPP_MPLS_MCAST 0x0283 /* rfc 3022 */
#define PPP_IPCP 0x8021 /* IP Control Protocol */
#define PPP_OSICP 0x8023 /* OSI Network Layer Control Protocol */
#define PPP_NSCP 0x8025 /* Xerox NS IDP Control Protocol */
#define PPP_DECNETCP 0x8027 /* DECnet Control Protocol */
#define PPP_APPLECP 0x8029 /* Appletalk Control Protocol */
#define PPP_IPXCP 0x802b /* Novell IPX Control Protocol */
#define PPP_STIICP 0x8033 /* Stream Protocol Control Protocol */
#define PPP_VINESCP 0x8035 /* Banyan Vines Control Protocol */
#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
#define PPP_MPLSCP 0x8281 /* rfc 3022 */
#define PPP_LCP 0xc021 /* Link Control Protocol */
#define PPP_PAP 0xc023 /* Password Authentication Protocol */
#define PPP_LQM 0xc025 /* Link Quality Monitoring */
#define PPP_CHAP 0xc223 /* Challenge Handshake Authentication Protocol */
#define PPP_CCP 0x80fd /* Compression Control Protocol */
#define PPP_CBCP 0xc029 /* Callback Control Protocol CBCP */
#define PPP_COMP_DGRAM 0x00fd /* Compressed datagram */
/** PPP Packet header */
typedef struct PPPHdr_ {

@ -21,7 +21,6 @@
* @{
*/
/**
* \file
*
@ -47,8 +46,8 @@
/**
* \brief Main decoding function for PPPOE Discovery packets
*/
int DecodePPPOEDiscovery(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
const uint8_t *pkt, uint32_t len)
int DecodePPPOEDiscovery(
ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
{
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
@ -80,10 +79,9 @@ int DecodePPPOEDiscovery(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
}
uint32_t pppoe_length = SCNtohs(pppoedh->pppoe_length);
uint32_t packet_length = len - PPPOE_DISCOVERY_HEADER_MIN_LEN ;
uint32_t packet_length = len - PPPOE_DISCOVERY_HEADER_MIN_LEN;
SCLogDebug("pppoe_length %"PRIu32", packet_length %"PRIu32"",
pppoe_length, packet_length);
SCLogDebug("pppoe_length %" PRIu32 ", packet_length %" PRIu32 "", pppoe_length, packet_length);
if (pppoe_length > packet_length) {
SCLogDebug("malformed PPPOE tags");
@ -104,7 +102,7 @@ int DecodePPPOEDiscovery(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
// upgrade to u32 to avoid u16 overflow
tag_length = SCNtohs(pppoedt->pppoe_tag_length);
SCLogDebug ("PPPoE Tag type %x, length %"PRIu32, tag_type, tag_length);
SCLogDebug("PPPoE Tag type %x, length %" PRIu32, tag_type, tag_length);
if (pppoe_length >= (4 + tag_length)) {
pppoe_length -= (4 + tag_length);
@ -121,8 +119,8 @@ int DecodePPPOEDiscovery(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
/**
* \brief Main decoding function for PPPOE Session packets
*/
int DecodePPPOESession(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
const uint8_t *pkt, uint32_t len)
int DecodePPPOESession(
ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
{
DEBUG_VALIDATE_BUG_ON(pkt == NULL);
@ -140,7 +138,8 @@ int DecodePPPOESession(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
PPPOE_SESSION_GET_VERSION(pppoesh), PPPOE_SESSION_GET_TYPE(pppoesh),
pppoesh->pppoe_code, SCNtohs(pppoesh->session_id), SCNtohs(pppoesh->pppoe_length));
/* can't use DecodePPP() here because we only get a single 2-byte word to indicate protocol instead of the full PPP header */
/* can't use DecodePPP() here because we only get a single 2-byte word to indicate protocol
* instead of the full PPP header */
if (SCNtohs(pppoesh->pppoe_length) > 0) {
/* decode contained PPP packet */
@ -194,7 +193,7 @@ int DecodePPPOESession(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
case PPP_PAP:
case PPP_LQM:
case PPP_CHAP:
ENGINE_SET_EVENT(p,PPP_UNSUP_PROTO);
ENGINE_SET_EVENT(p, PPP_UNSUP_PROTO);
break;
case PPP_VJ_UCOMP:
@ -250,7 +249,7 @@ int DecodePPPOESession(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
* \brief Decode malformed PPPOE packet (too short)
* \retval 1 Expected test value
*/
static int DecodePPPOEtest01 (void)
static int DecodePPPOEtest01(void)
{
uint8_t raw_pppoe[] = { 0x11, 0x00, 0x00, 0x00, 0x00 };
@ -274,19 +273,14 @@ static int DecodePPPOEtest01 (void)
* \brief Valid PPPOE packet - check the invalid ICMP type encapsulated is flagged
* \retval 0 Expected test value
*/
static int DecodePPPOEtest02 (void)
static int DecodePPPOEtest02(void)
{
uint8_t raw_pppoe[] = {
0x11, 0x00, 0x00, 0x01, 0x00, 0x40, 0x00, 0x21,
0x45, 0x00, 0x00, 0x3c, 0x05, 0x5c, 0x00, 0x00,
0x20, 0x01, 0xff, 0x30, 0xc0, 0xa8, 0x0a, 0x7f,
0xc0, 0xa8, 0x0a, 0x65, 0xab, 0xcd, 0x16, 0x5e,
0x02, 0x00, 0x37, 0x00, 0x41, 0x42, 0x43, 0x44,
0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c,
0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54,
0x55, 0x56, 0x57, 0x41, 0x42, 0x43, 0x44, 0x45,
0x46, 0x47, 0x48, 0x49 };
uint8_t raw_pppoe[] = { 0x11, 0x00, 0x00, 0x01, 0x00, 0x40, 0x00, 0x21, 0x45, 0x00, 0x00, 0x3c,
0x05, 0x5c, 0x00, 0x00, 0x20, 0x01, 0xff, 0x30, 0xc0, 0xa8, 0x0a, 0x7f, 0xc0, 0xa8, 0x0a,
0x65, 0xab, 0xcd, 0x16, 0x5e, 0x02, 0x00, 0x37, 0x00, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46,
0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55,
0x56, 0x57, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49 };
Packet *p = PacketGetFromAlloc();
FAIL_IF_NULL(p);
@ -310,21 +304,16 @@ static int DecodePPPOEtest02 (void)
PASS;
}
/** DecodePPPOEtest03
* \brief Valid example PADO packet PPPOE packet taken from RFC2516
* \retval 0 Expected test value
*/
static int DecodePPPOEtest03 (void)
static int DecodePPPOEtest03(void)
{
/* example PADO packet taken from RFC2516 */
uint8_t raw_pppoe[] = {
0x11, 0x07, 0x00, 0x00, 0x00, 0x20, 0x01, 0x01,
0x00, 0x00, 0x01, 0x02, 0x00, 0x18, 0x47, 0x6f,
0x20, 0x52, 0x65, 0x64, 0x42, 0x61, 0x63, 0x6b,
0x20, 0x2d, 0x20, 0x65, 0x73, 0x68, 0x73, 0x68,
0x65, 0x73, 0x68, 0x6f, 0x6f, 0x74
};
uint8_t raw_pppoe[] = { 0x11, 0x07, 0x00, 0x00, 0x00, 0x20, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02,
0x00, 0x18, 0x47, 0x6f, 0x20, 0x52, 0x65, 0x64, 0x42, 0x61, 0x63, 0x6b, 0x20, 0x2d, 0x20,
0x65, 0x73, 0x68, 0x73, 0x68, 0x65, 0x73, 0x68, 0x6f, 0x6f, 0x74 };
Packet *p = PacketGetFromAlloc();
FAIL_IF_NULL(p);
@ -345,14 +334,11 @@ static int DecodePPPOEtest03 (void)
* \brief Valid example PPPOE packet taken from RFC2516 - but with wrong PPPOE code
* \retval 1 Expected test value
*/
static int DecodePPPOEtest04 (void)
static int DecodePPPOEtest04(void)
{
/* example PADI packet taken from RFC2516, but with wrong code */
uint8_t raw_pppoe[] = {
0x11, 0xbb, 0x00, 0x00, 0x00, 0x04, 0x01, 0x01,
0x00, 0x00
};
uint8_t raw_pppoe[] = { 0x11, 0xbb, 0x00, 0x00, 0x00, 0x04, 0x01, 0x01, 0x00, 0x00 };
Packet *p = PacketGetFromAlloc();
FAIL_IF_NULL(p);
@ -374,16 +360,13 @@ static int DecodePPPOEtest04 (void)
* \brief Valid example PADO PPPOE packet taken from RFC2516, but too short for given length
* \retval 0 Expected test value
*/
static int DecodePPPOEtest05 (void)
static int DecodePPPOEtest05(void)
{
/* example PADI packet taken from RFC2516 */
uint8_t raw_pppoe[] = {
0x11, 0x07, 0x00, 0x00, 0x00, 0x20, 0x01, 0x01,
0x00, 0x00, 0x01, 0x02, 0x00, 0x18, 0x47, 0x6f,
0x20, 0x52, 0x65, 0x64, 0x42, 0x61, 0x63, 0x6b,
0x20, 0x2d, 0x20, 0x65, 0x73, 0x68, 0x73, 0x68
};
uint8_t raw_pppoe[] = { 0x11, 0x07, 0x00, 0x00, 0x00, 0x20, 0x01, 0x01, 0x00, 0x00, 0x01, 0x02,
0x00, 0x18, 0x47, 0x6f, 0x20, 0x52, 0x65, 0x64, 0x42, 0x61, 0x63, 0x6b, 0x20, 0x2d, 0x20,
0x65, 0x73, 0x68, 0x73, 0x68 };
Packet *p = PacketGetFromAlloc();
FAIL_IF_NULL(p);
@ -407,7 +390,7 @@ static int DecodePPPOEtest05 (void)
* should extract the first 4 bits for version and the second 4 bits for type
* \retval 1 Expected test value
*/
static int DecodePPPOEtest06 (void)
static int DecodePPPOEtest06(void)
{
PPPOESessionHdr pppoesh;

@ -26,14 +26,13 @@
// Session header length minus the protocol field
#define PPPOE_SESSION_HEADER_MIN_LEN 7
#define PPPOE_DISCOVERY_HEADER_MIN_LEN 6
#define PPPOE_SESSION_GET_VERSION(hdr) ((hdr)->pppoe_version_type & 0xF0) >> 4
#define PPPOE_SESSION_GET_TYPE(hdr) ((hdr)->pppoe_version_type & 0x0F)
#define PPPOE_DISCOVERY_HEADER_MIN_LEN 6
#define PPPOE_SESSION_GET_VERSION(hdr) ((hdr)->pppoe_version_type & 0xF0) >> 4
#define PPPOE_SESSION_GET_TYPE(hdr) ((hdr)->pppoe_version_type & 0x0F)
#define PPPOE_DISCOVERY_GET_VERSION(hdr) ((hdr)->pppoe_version_type & 0xF0) >> 4
#define PPPOE_DISCOVERY_GET_TYPE(hdr) ((hdr)->pppoe_version_type & 0x0F)
#define PPPOE_DISCOVERY_GET_TYPE(hdr) ((hdr)->pppoe_version_type & 0x0F)
typedef struct PPPOESessionHdr_
{
typedef struct PPPOESessionHdr_ {
uint8_t pppoe_version_type;
uint8_t pppoe_code;
uint16_t session_id;
@ -41,14 +40,12 @@ typedef struct PPPOESessionHdr_
uint16_t protocol;
} PPPOESessionHdr;
typedef struct PPPOEDiscoveryTag_
{
typedef struct PPPOEDiscoveryTag_ {
uint16_t pppoe_tag_type;
uint16_t pppoe_tag_length;
} __attribute__((__packed__)) PPPOEDiscoveryTag;
typedef struct PPPOEDiscoveryHdr_
{
typedef struct PPPOEDiscoveryHdr_ {
uint8_t pppoe_version_type;
uint8_t pppoe_code;
uint16_t discovery_id;
@ -63,16 +60,16 @@ typedef struct PPPOEDiscoveryHdr_
#define PPPOE_CODE_PADT 0xa7
/* see RFC 2516 Appendix A */
#define PPPOE_TAG_END_OF_LIST 0x0000 /* End-Of-List */
#define PPPOE_TAG_SERVICE_NAME 0x0101 /* Service-Name */
#define PPPOE_TAG_AC_NAME 0x0102 /* AC-Name */
#define PPPOE_TAG_HOST_UNIQ 0x0103 /* Host-Uniq */
#define PPPOE_TAG_AC_COOKIE 0x0104 /* AC-Cookie */
#define PPPOE_TAG_VENDOR_SPECIFIC 0x0105 /* Vendor-Specific */
#define PPPOE_TAG_RELAY_SESSION_ID 0x0110 /* Relay-Session-Id */
#define PPPOE_TAG_SERVICE_NAME_ERROR 0x0201 /* Service-Name-Error */
#define PPPOE_TAG_AC_SYS_ERROR 0x0202 /* AC-System Error */
#define PPPOE_TAG_GEN_ERROR 0x0203 /* Generic-Error */
#define PPPOE_TAG_END_OF_LIST 0x0000 /* End-Of-List */
#define PPPOE_TAG_SERVICE_NAME 0x0101 /* Service-Name */
#define PPPOE_TAG_AC_NAME 0x0102 /* AC-Name */
#define PPPOE_TAG_HOST_UNIQ 0x0103 /* Host-Uniq */
#define PPPOE_TAG_AC_COOKIE 0x0104 /* AC-Cookie */
#define PPPOE_TAG_VENDOR_SPECIFIC 0x0105 /* Vendor-Specific */
#define PPPOE_TAG_RELAY_SESSION_ID 0x0110 /* Relay-Session-Id */
#define PPPOE_TAG_SERVICE_NAME_ERROR 0x0201 /* Service-Name-Error */
#define PPPOE_TAG_AC_SYS_ERROR 0x0202 /* AC-System Error */
#define PPPOE_TAG_GEN_ERROR 0x0203 /* Generic-Error */
void DecodePPPOERegisterTests(void);

Loading…
Cancel
Save