Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
f2ea631f
Commit
f2ea631f
authored
Jul 02, 2015
by
Brenden Blanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update missing monitor.c to use cursor_advance
Signed-off-by:
Brenden Blanco
<
bblanco@plumgrid.com
>
parent
6ec65e49
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
examples/tunnel_monitor/monitor.c
examples/tunnel_monitor/monitor.c
+8
-8
No files found.
examples/tunnel_monitor/monitor.c
View file @
f2ea631f
...
...
@@ -57,9 +57,9 @@ int handle_egress(struct __sk_buff *skb) {
// parse the outer vxlan frame
int
handle_outer
(
struct
__sk_buff
*
skb
)
{
u8
*
skb_
cursor
=
0
;
u8
*
cursor
=
0
;
struct
ethernet_t
*
ethernet
=
bpf_consume_skb
(
skb_
cursor
,
sizeof
(
*
ethernet
));
struct
ethernet_t
*
ethernet
=
cursor_advance
(
cursor
,
sizeof
(
*
ethernet
));
// filter bcast/mcast from the stats
if
(
ethernet
->
dst
&
(
1ull
<<
40
))
...
...
@@ -71,7 +71,7 @@ int handle_outer(struct __sk_buff *skb) {
}
ip:
;
struct
ip_t
*
ip
=
bpf_consume_skb
(
skb_
cursor
,
sizeof
(
*
ip
));
struct
ip_t
*
ip
=
cursor_advance
(
cursor
,
sizeof
(
*
ip
));
skb
->
cb
[
CB_SIP
]
=
ip
->
src
;
skb
->
cb
[
CB_DIP
]
=
ip
->
dst
;
...
...
@@ -81,14 +81,14 @@ ip: ;
}
udp:
;
struct
udp_t
*
udp
=
bpf_consume_skb
(
skb_
cursor
,
sizeof
(
*
udp
));
struct
udp_t
*
udp
=
cursor_advance
(
cursor
,
sizeof
(
*
udp
));
switch
(
udp
->
dport
)
{
case
4789
:
goto
vxlan
;
default:
goto
finish
;
}
vxlan:
;
struct
vxlan_t
*
vxlan
=
bpf_consume_skb
(
skb_
cursor
,
sizeof
(
*
vxlan
));
struct
vxlan_t
*
vxlan
=
cursor_advance
(
cursor
,
sizeof
(
*
vxlan
));
skb
->
cb
[
CB_VNI
]
=
vxlan
->
key
;
skb
->
cb
[
CB_OFFSET
]
=
(
u64
)
vxlan
+
sizeof
(
*
vxlan
);
parser
.
call
(
skb
,
2
);
...
...
@@ -106,15 +106,15 @@ int handle_inner(struct __sk_buff *skb) {
.
outer_sip
=
skb
->
cb
[
CB_SIP
],
.
outer_dip
=
skb
->
cb
[
CB_DIP
]
};
u8
*
skb_
cursor
=
(
u8
*
)(
u64
)
skb
->
cb
[
CB_OFFSET
];
u8
*
cursor
=
(
u8
*
)(
u64
)
skb
->
cb
[
CB_OFFSET
];
struct
ethernet_t
*
ethernet
=
bpf_consume_skb
(
skb_
cursor
,
sizeof
(
*
ethernet
));
struct
ethernet_t
*
ethernet
=
cursor_advance
(
cursor
,
sizeof
(
*
ethernet
));
switch
(
ethernet
->
type
)
{
case
0x0800
:
goto
ip
;
default:
goto
finish
;
}
ip:
;
struct
ip_t
*
ip
=
bpf_consume_skb
(
skb_
cursor
,
sizeof
(
*
ip
));
struct
ip_t
*
ip
=
cursor_advance
(
cursor
,
sizeof
(
*
ip
));
key
.
inner_sip
=
ip
->
src
;
key
.
inner_dip
=
ip
->
dst
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment