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
112491a1
Commit
112491a1
authored
Oct 01, 2016
by
zaafar
Committed by
4ast
Oct 01, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup the issue in which distributed_bridge example (#716)
wasn't working for kernel ver less than 4.5.
parent
cb40f09a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
examples/networking/distributed_bridge/tunnel.c
examples/networking/distributed_bridge/tunnel.c
+6
-3
examples/networking/distributed_bridge/tunnel_mesh.c
examples/networking/distributed_bridge/tunnel_mesh.c
+4
-2
No files found.
examples/networking/distributed_bridge/tunnel.c
View file @
112491a1
...
...
@@ -29,7 +29,8 @@ int handle_ingress(struct __sk_buff *skb) {
struct
ethernet_t
*
ethernet
=
cursor_advance
(
cursor
,
sizeof
(
*
ethernet
));
struct
bpf_tunnel_key
tkey
=
{};
bpf_skb_get_tunnel_key
(
skb
,
&
tkey
,
sizeof
(
tkey
),
0
);
bpf_skb_get_tunnel_key
(
skb
,
&
tkey
,
offsetof
(
struct
bpf_tunnel_key
,
remote_ipv6
[
1
]),
0
);
int
*
ifindex
=
vni2if
.
lookup
(
&
tkey
.
tunnel_id
);
if
(
ifindex
)
{
...
...
@@ -63,7 +64,8 @@ int handle_egress(struct __sk_buff *skb) {
u32
zero
=
0
;
tkey
.
tunnel_id
=
dst_host
->
tunnel_id
;
tkey
.
remote_ipv4
=
dst_host
->
remote_ipv4
;
bpf_skb_set_tunnel_key
(
skb
,
&
tkey
,
sizeof
(
tkey
),
0
);
bpf_skb_set_tunnel_key
(
skb
,
&
tkey
,
offsetof
(
struct
bpf_tunnel_key
,
remote_ipv6
[
1
]),
0
);
lock_xadd
(
&
dst_host
->
tx_pkts
,
1
);
}
else
{
struct
bpf_tunnel_key
tkey
=
{};
...
...
@@ -73,7 +75,8 @@ int handle_egress(struct __sk_buff *skb) {
return
1
;
tkey
.
tunnel_id
=
dst_host
->
tunnel_id
;
tkey
.
remote_ipv4
=
dst_host
->
remote_ipv4
;
bpf_skb_set_tunnel_key
(
skb
,
&
tkey
,
sizeof
(
tkey
),
0
);
bpf_skb_set_tunnel_key
(
skb
,
&
tkey
,
offsetof
(
struct
bpf_tunnel_key
,
remote_ipv6
[
1
]),
0
);
}
bpf_clone_redirect
(
skb
,
cfg
->
tunnel_ifindex
,
0
/*egress*/
);
return
1
;
...
...
examples/networking/distributed_bridge/tunnel_mesh.c
View file @
112491a1
...
...
@@ -19,7 +19,8 @@ BPF_TABLE("hash", int, struct tunnel_key, if2tunkey, 1024);
int
handle_ingress
(
struct
__sk_buff
*
skb
)
{
struct
bpf_tunnel_key
tkey
=
{};
struct
tunnel_key
key
;
bpf_skb_get_tunnel_key
(
skb
,
&
tkey
,
sizeof
(
tkey
),
0
);
bpf_skb_get_tunnel_key
(
skb
,
&
tkey
,
offsetof
(
struct
bpf_tunnel_key
,
remote_ipv6
[
1
]),
0
);
key
.
tunnel_id
=
tkey
.
tunnel_id
;
key
.
remote_ipv4
=
tkey
.
remote_ipv4
;
...
...
@@ -57,7 +58,8 @@ int handle_egress(struct __sk_buff *skb) {
if
(
key_p
)
{
tkey
.
tunnel_id
=
key_p
->
tunnel_id
;
tkey
.
remote_ipv4
=
key_p
->
remote_ipv4
;
bpf_skb_set_tunnel_key
(
skb
,
&
tkey
,
sizeof
(
tkey
),
0
);
bpf_skb_set_tunnel_key
(
skb
,
&
tkey
,
offsetof
(
struct
bpf_tunnel_key
,
remote_ipv6
[
1
]),
0
);
bpf_clone_redirect
(
skb
,
cfg
->
tunnel_ifindex
,
0
/*egress*/
);
}
return
1
;
...
...
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