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
8c659d8c
Commit
8c659d8c
authored
Jul 30, 2015
by
Brenden Blanco
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #97 from iovisor/ast_dev
update tunnel_key prototypes
parents
b13771a0
b37f8a03
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
8 deletions
+9
-8
examples/distributed_bridge/tunnel.c
examples/distributed_bridge/tunnel.c
+3
-3
examples/distributed_bridge/tunnel_mesh.c
examples/distributed_bridge/tunnel_mesh.c
+2
-2
src/cc/compat/linux/bpf.h
src/cc/compat/linux/bpf.h
+2
-1
src/cc/export/helpers.h
src/cc/export/helpers.h
+2
-2
No files found.
examples/distributed_bridge/tunnel.c
View file @
8c659d8c
...
...
@@ -29,7 +29,7 @@ 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
));
bpf_skb_get_tunnel_key
(
skb
,
&
tkey
,
sizeof
(
tkey
)
,
0
);
int
*
ifindex
=
vni2if
.
lookup
(
&
tkey
.
tunnel_id
);
if
(
ifindex
)
{
...
...
@@ -63,7 +63,7 @@ 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
));
bpf_skb_set_tunnel_key
(
skb
,
&
tkey
,
sizeof
(
tkey
)
,
0
);
lock_xadd
(
&
dst_host
->
tx_pkts
,
1
);
}
else
{
struct
bpf_tunnel_key
tkey
=
{};
...
...
@@ -73,7 +73,7 @@ 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
));
bpf_skb_set_tunnel_key
(
skb
,
&
tkey
,
sizeof
(
tkey
)
,
0
);
}
bpf_clone_redirect
(
skb
,
cfg
->
tunnel_ifindex
,
0
/*egress*/
);
return
1
;
...
...
examples/distributed_bridge/tunnel_mesh.c
View file @
8c659d8c
...
...
@@ -14,7 +14,7 @@ BPF_TABLE("hash", int, struct bpf_tunnel_key, if2tunkey, 1024);
// Handle packets from the encap device, demux into the dest tenant
int
handle_ingress
(
struct
__sk_buff
*
skb
)
{
struct
bpf_tunnel_key
tkey
=
{};
bpf_skb_get_tunnel_key
(
skb
,
&
tkey
,
sizeof
(
tkey
));
bpf_skb_get_tunnel_key
(
skb
,
&
tkey
,
sizeof
(
tkey
)
,
0
);
int
*
ifindex
=
tunkey2if
.
lookup
(
&
tkey
);
if
(
ifindex
)
{
...
...
@@ -49,7 +49,7 @@ int handle_egress(struct __sk_buff *skb) {
if
(
tkey_p
)
{
tkey
.
tunnel_id
=
tkey_p
->
tunnel_id
;
tkey
.
remote_ipv4
=
tkey_p
->
remote_ipv4
;
bpf_skb_set_tunnel_key
(
skb
,
&
tkey
,
sizeof
(
tkey
));
bpf_skb_set_tunnel_key
(
skb
,
&
tkey
,
sizeof
(
tkey
)
,
0
);
bpf_clone_redirect
(
skb
,
cfg
->
tunnel_ifindex
,
0
/*egress*/
);
}
return
1
;
...
...
src/cc/compat/linux/bpf.h
View file @
8c659d8c
...
...
@@ -260,11 +260,12 @@ enum bpf_func_id {
BPF_FUNC_skb_vlan_pop
,
/* bpf_skb_vlan_pop(skb) */
/**
* bpf_skb_[gs]et_tunnel_key(skb,
struct bpf_tunnel_key *key, int size
)
* bpf_skb_[gs]et_tunnel_key(skb,
key, size, flags
)
* retrieve or populate tunnel metadata
* @skb: pointer to skb
* @key: pointer to 'struct bpf_tunnel_key'
* @size: size of 'struct bpf_tunnel_key'
* @flags: room for future extensions
* Retrun: 0 on success
*/
BPF_FUNC_skb_get_tunnel_key
,
...
...
src/cc/export/helpers.h
View file @
8c659d8c
...
...
@@ -83,9 +83,9 @@ static u64 (*bpf_skb_vlan_pop)(void *ctx) =
static
void
bpf_tail_call_
(
u64
map_fd
,
void
*
ctx
,
int
index
)
{
((
void
(
*
)(
void
*
,
u64
,
int
))
BPF_FUNC_tail_call
)(
ctx
,
map_fd
,
index
);
}
static
int
(
*
bpf_skb_get_tunnel_key
)(
void
*
ctx
,
void
*
to
,
u32
size
)
=
static
int
(
*
bpf_skb_get_tunnel_key
)(
void
*
ctx
,
void
*
to
,
u32
size
,
u64
flags
)
=
(
void
*
)
BPF_FUNC_skb_get_tunnel_key
;
static
int
(
*
bpf_skb_set_tunnel_key
)(
void
*
ctx
,
void
*
from
,
u32
size
)
=
static
int
(
*
bpf_skb_set_tunnel_key
)(
void
*
ctx
,
void
*
from
,
u32
size
,
u64
flags
)
=
(
void
*
)
BPF_FUNC_skb_set_tunnel_key
;
#endif
...
...
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