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
81f7fb32
Commit
81f7fb32
authored
Nov 23, 2016
by
4ast
Committed by
GitHub
Nov 23, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #817 from iovisor/clang_c_fixes
Fixup test errors in clang, c api
parents
0d5d25ea
35c7225f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
27 deletions
+27
-27
tests/cc/test_c_api.cc
tests/cc/test_c_api.cc
+2
-4
tests/lua/test_clang.lua
tests/lua/test_clang.lua
+2
-2
tests/python/test_clang.py
tests/python/test_clang.py
+2
-2
tests/python/test_xlate1.c
tests/python/test_xlate1.c
+21
-19
No files found.
tests/cc/test_c_api.cc
View file @
81f7fb32
...
...
@@ -44,10 +44,8 @@ TEST_CASE("binary resolution with `which`", "[c_api]") {
}
static
void
_test_ksym
(
const
char
*
sym
,
uint64_t
addr
,
void
*
_
)
{
if
(
!
strcmp
(
sym
,
"startup_64"
))
{
REQUIRE
(
addr
==
0xffffffff81000000ull
);
}
else
if
(
!
strcmp
(
sym
,
"system_reset_pSeries"
))
REQUIRE
(
addr
==
0xc000000000000100ull
);
if
(
!
strcmp
(
sym
,
"startup_64"
))
REQUIRE
(
addr
!=
0x0ull
);
}
TEST_CASE
(
"list all kernel symbols"
,
"[c_api]"
)
{
...
...
tests/lua/test_clang.lua
View file @
81f7fb32
...
...
@@ -269,9 +269,9 @@ function TestClang:test_unop_probe_read()
local
text
=
[[
#include <linux/blkdev.h>
int trace_entry(struct pt_regs *ctx, struct request *req) {
if (!(req->bio->bi_
rw
& 1))
if (!(req->bio->bi_
flags
& 1))
return 1;
if (((req->bio->bi_
rw
)))
if (((req->bio->bi_
flags
)))
return 1;
return 0;
}
...
...
tests/python/test_clang.py
View file @
81f7fb32
...
...
@@ -284,9 +284,9 @@ int kprobe____kmalloc(struct pt_regs *ctx, size_t size) {
text
=
"""
#include <linux/blkdev.h>
int trace_entry(struct pt_regs *ctx, struct request *req) {
if (!(req->bio->bi_
rw
& 1))
if (!(req->bio->bi_
flags
& 1))
return 1;
if (((req->bio->bi_
rw
)))
if (((req->bio->bi_
flags
)))
return 1;
return 0;
}
...
...
tests/python/test_xlate1.c
View file @
81f7fb32
...
...
@@ -18,7 +18,7 @@ int on_packet(struct __sk_buff *skb) {
u32
orig_dip
=
0
;
u32
orig_sip
=
0
;
struct
IPLeaf
*
xleaf
;
struct
IPLeaf
xleaf
=
{}
;
ethernet:
{
struct
ethernet_t
*
ethernet
=
cursor_advance
(
cursor
,
sizeof
(
*
ethernet
));
...
...
@@ -44,11 +44,12 @@ int on_packet(struct __sk_buff *skb) {
orig_dip
=
arp
->
tpa
;
orig_sip
=
arp
->
spa
;
struct
IPKey
key
=
{.
dip
=
orig_dip
,
.
sip
=
orig_sip
};
xleaf
=
xlate
.
lookup
(
&
key
);
if
(
xleaf
)
{
arp
->
tpa
=
xleaf
->
xdip
;
arp
->
spa
=
xleaf
->
xsip
;
lock_xadd
(
&
xleaf
->
arp_xlated_pkts
,
1
);
struct
IPLeaf
*
xleafp
=
xlate
.
lookup
(
&
key
);
if
(
xleafp
)
{
xleaf
=
*
xleafp
;
arp
->
tpa
=
xleaf
.
xdip
;
arp
->
spa
=
xleaf
.
xsip
;
lock_xadd
(
&
xleafp
->
arp_xlated_pkts
,
1
);
}
goto
EOP
;
}
...
...
@@ -58,13 +59,14 @@ int on_packet(struct __sk_buff *skb) {
orig_dip
=
ip
->
dst
;
orig_sip
=
ip
->
src
;
struct
IPKey
key
=
{.
dip
=
orig_dip
,
.
sip
=
orig_sip
};
xleaf
=
xlate
.
lookup
(
&
key
);
if
(
xleaf
)
{
ip
->
dst
=
xleaf
->
xdip
;
incr_cksum_l3
(
&
ip
->
hchecksum
,
orig_dip
,
xleaf
->
xdip
);
ip
->
src
=
xleaf
->
xsip
;
incr_cksum_l3
(
&
ip
->
hchecksum
,
orig_sip
,
xleaf
->
xsip
);
lock_xadd
(
&
xleaf
->
ip_xlated_pkts
,
1
);
struct
IPLeaf
*
xleafp
=
xlate
.
lookup
(
&
key
);
if
(
xleafp
)
{
xleaf
=
*
xleafp
;
ip
->
dst
=
xleaf
.
xdip
;
incr_cksum_l3
(
&
ip
->
hchecksum
,
orig_dip
,
xleaf
.
xdip
);
ip
->
src
=
xleaf
.
xsip
;
incr_cksum_l3
(
&
ip
->
hchecksum
,
orig_sip
,
xleaf
.
xsip
);
lock_xadd
(
&
xleafp
->
ip_xlated_pkts
,
1
);
}
switch
(
ip
->
nextp
)
{
case
6
:
goto
tcp
;
...
...
@@ -75,18 +77,18 @@ int on_packet(struct __sk_buff *skb) {
udp:
{
struct
udp_t
*
udp
=
cursor_advance
(
cursor
,
sizeof
(
*
udp
));
if
(
xleaf
)
{
incr_cksum_l4
(
&
udp
->
crc
,
orig_dip
,
xleaf
->
xdip
,
1
);
incr_cksum_l4
(
&
udp
->
crc
,
orig_sip
,
xleaf
->
xsip
,
1
);
if
(
xleaf
.
xdip
)
{
incr_cksum_l4
(
&
udp
->
crc
,
orig_dip
,
xleaf
.
xdip
,
1
);
incr_cksum_l4
(
&
udp
->
crc
,
orig_sip
,
xleaf
.
xsip
,
1
);
}
goto
EOP
;
}
tcp:
{
struct
tcp_t
*
tcp
=
cursor_advance
(
cursor
,
sizeof
(
*
tcp
));
if
(
xleaf
)
{
incr_cksum_l4
(
&
tcp
->
cksum
,
orig_dip
,
xleaf
->
xdip
,
1
);
incr_cksum_l4
(
&
tcp
->
cksum
,
orig_sip
,
xleaf
->
xsip
,
1
);
if
(
xleaf
.
xdip
)
{
incr_cksum_l4
(
&
tcp
->
cksum
,
orig_dip
,
xleaf
.
xdip
,
1
);
incr_cksum_l4
(
&
tcp
->
cksum
,
orig_sip
,
xleaf
.
xsip
,
1
);
}
goto
EOP
;
}
...
...
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