mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/bit-1950'
BIT-1950 #merged * origin/topic/jsiwek/bit-1950: BIT-1950: support PPPoE over QinQ
This commit is contained in:
commit
8ac17d99a1
7 changed files with 61 additions and 55 deletions
4
CHANGES
4
CHANGES
|
@ -1,4 +1,8 @@
|
||||||
|
|
||||||
|
2.5-773 | 2018-07-24 15:04:41 +0000
|
||||||
|
|
||||||
|
* BIT-1950: Support PPPoE over QinQ (Jon Siwek, Corelight)
|
||||||
|
|
||||||
2.5-771 | 2018-07-24 02:26:17 +0000
|
2.5-771 | 2018-07-24 02:26:17 +0000
|
||||||
|
|
||||||
* Support building plugins from Bro installation prefix so that it
|
* Support building plugins from Bro installation prefix so that it
|
||||||
|
|
2
NEWS
2
NEWS
|
@ -275,6 +275,8 @@ New Functionality
|
||||||
creating "bro-devel" packages providing all files necessary to build
|
creating "bro-devel" packages providing all files necessary to build
|
||||||
plugins.
|
plugins.
|
||||||
|
|
||||||
|
- Bro now supports PPPoE over QinQ.
|
||||||
|
|
||||||
Changed Functionality
|
Changed Functionality
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.5-771
|
2.5-773
|
||||||
|
|
|
@ -149,36 +149,17 @@ void Packet::ProcessLayer2()
|
||||||
|
|
||||||
pdata += GetLinkHeaderSize(link_type);
|
pdata += GetLinkHeaderSize(link_type);
|
||||||
|
|
||||||
switch ( protocol )
|
bool saw_vlan = false;
|
||||||
|
|
||||||
|
while ( protocol == 0x8100 || protocol == 0x9100 ||
|
||||||
|
protocol == 0x8864 )
|
||||||
{
|
{
|
||||||
// MPLS carried over the ethernet frame.
|
switch ( protocol )
|
||||||
case 0x8847:
|
{
|
||||||
have_mpls = true;
|
// VLAN carried over the ethernet frame.
|
||||||
break;
|
// 802.1q / 802.1ad
|
||||||
|
case 0x8100:
|
||||||
// VLAN carried over the ethernet frame.
|
case 0x9100:
|
||||||
// 802.1q / 802.1ad
|
|
||||||
case 0x8100:
|
|
||||||
case 0x9100:
|
|
||||||
if ( pdata + 4 >= end_of_data )
|
|
||||||
{
|
|
||||||
Weird("truncated_link_header");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
vlan = ((pdata[0] << 8) + pdata[1]) & 0xfff;
|
|
||||||
protocol = ((pdata[2] << 8) + pdata[3]);
|
|
||||||
pdata += 4; // Skip the vlan header
|
|
||||||
|
|
||||||
// Check for MPLS in VLAN.
|
|
||||||
if ( protocol == 0x8847 )
|
|
||||||
{
|
|
||||||
have_mpls = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for double-tagged (802.1ad)
|
|
||||||
if ( protocol == 0x8100 || protocol == 0x9100 )
|
|
||||||
{
|
{
|
||||||
if ( pdata + 4 >= end_of_data )
|
if ( pdata + 4 >= end_of_data )
|
||||||
{
|
{
|
||||||
|
@ -186,39 +167,46 @@ void Packet::ProcessLayer2()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
inner_vlan = ((pdata[0] << 8) + pdata[1]) & 0xfff;
|
auto& vlan_ref = saw_vlan ? inner_vlan : vlan;
|
||||||
|
vlan_ref = ((pdata[0] << 8) + pdata[1]) & 0xfff;
|
||||||
protocol = ((pdata[2] << 8) + pdata[3]);
|
protocol = ((pdata[2] << 8) + pdata[3]);
|
||||||
pdata += 4; // Skip the vlan header
|
pdata += 4; // Skip the vlan header
|
||||||
|
saw_vlan = true;
|
||||||
|
eth_type = protocol;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
eth_type = protocol;
|
// PPPoE carried over the ethernet frame.
|
||||||
break;
|
case 0x8864:
|
||||||
|
|
||||||
// PPPoE carried over the ethernet frame.
|
|
||||||
case 0x8864:
|
|
||||||
if ( pdata + 8 >= end_of_data )
|
|
||||||
{
|
{
|
||||||
Weird("truncated_link_header");
|
if ( pdata + 8 >= end_of_data )
|
||||||
return;
|
{
|
||||||
|
Weird("truncated_link_header");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
protocol = (pdata[6] << 8) + pdata[7];
|
||||||
|
pdata += 8; // Skip the PPPoE session and PPP header
|
||||||
|
|
||||||
|
if ( protocol == 0x0021 )
|
||||||
|
l3_proto = L3_IPV4;
|
||||||
|
else if ( protocol == 0x0057 )
|
||||||
|
l3_proto = L3_IPV6;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Neither IPv4 nor IPv6.
|
||||||
|
Weird("non_ip_packet_in_pppoe_encapsulation");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
protocol = (pdata[6] << 8) + pdata[7];
|
}
|
||||||
pdata += 8; // Skip the PPPoE session and PPP header
|
|
||||||
|
|
||||||
if ( protocol == 0x0021 )
|
|
||||||
l3_proto = L3_IPV4;
|
|
||||||
else if ( protocol == 0x0057 )
|
|
||||||
l3_proto = L3_IPV6;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Neither IPv4 nor IPv6.
|
|
||||||
Weird("non_ip_packet_in_pppoe_encapsulation");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for MPLS in VLAN.
|
||||||
|
if ( protocol == 0x8847 )
|
||||||
|
have_mpls = true;
|
||||||
|
|
||||||
// Normal path to determine Layer 3 protocol.
|
// Normal path to determine Layer 3 protocol.
|
||||||
if ( ! have_mpls && l3_proto == L3_UNKNOWN )
|
if ( ! have_mpls && l3_proto == L3_UNKNOWN )
|
||||||
{
|
{
|
||||||
|
|
10
testing/btest/Baseline/core.pppoe-over-qinq/conn.log
Normal file
10
testing/btest/Baseline/core.pppoe-over-qinq/conn.log
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#separator \x09
|
||||||
|
#set_separator ,
|
||||||
|
#empty_field (empty)
|
||||||
|
#unset_field -
|
||||||
|
#path conn
|
||||||
|
#open 2018-07-06-12-25-54
|
||||||
|
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto service duration orig_bytes resp_bytes conn_state local_orig local_resp missed_bytes history orig_pkts orig_ip_bytes resp_pkts resp_ip_bytes tunnel_parents
|
||||||
|
#types time string addr port addr port enum string interval count count string bool bool count string count count count count set[string]
|
||||||
|
1523351398.449222 CHhAvVGS1DHFjwGM9 1.1.1.1 20394 2.2.2.2 443 tcp - 273.626833 11352 4984 SF - - 0 ShADdtaTFf 44 25283 42 13001 -
|
||||||
|
#close 2018-07-06-12-25-54
|
BIN
testing/btest/Traces/pppoe-over-qinq.pcap
Normal file
BIN
testing/btest/Traces/pppoe-over-qinq.pcap
Normal file
Binary file not shown.
2
testing/btest/core/pppoe-over-qinq.bro
Normal file
2
testing/btest/core/pppoe-over-qinq.bro
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# @TEST-EXEC: bro -C -r $TRACES/pppoe-over-qinq.pcap
|
||||||
|
# @TEST-EXEC: btest-diff conn.log
|
Loading…
Add table
Add a link
Reference in a new issue