Skip to content

Commit

Permalink
Merge pull request iovisor#1734 from pchaigno/fix-old-tools
Browse files Browse the repository at this point in the history
old/tools: Diverse fixes
  • Loading branch information
yonghong-song committed May 6, 2018
2 parents 3fef513 + a114016 commit 033dcae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tools/old/bashreadline.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
return 0;
char str[80] = {};
bpf_probe_read(&str, sizeof(str), (void *)ctx->ax);
bpf_probe_read(&str, sizeof(str), (void *)PT_REGS_RC(ctx));
bpf_trace_printk("%s\\n", &str);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion tools/old/tcpaccept.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
int kretprobe__inet_csk_accept(struct pt_regs *ctx)
{
struct sock *newsk = (struct sock *)ctx->ax;
struct sock *newsk = (struct sock *)PT_REGS_RC(ctx);
u32 pid = bpf_get_current_pid_tgid();
if (newsk == NULL)
Expand Down
10 changes: 4 additions & 6 deletions tools/old/tcpconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
static int trace_connect_return(struct pt_regs *ctx, short ipver)
{
int ret = ctx->ax;
int ret = PT_REGS_RC(ctx);
u32 pid = bpf_get_current_pid_tgid();
struct sock **skpp;
Expand All @@ -75,12 +75,10 @@
struct sock *skp = *skpp;
u32 saddr = 0, daddr = 0;
u16 dport = 0;
bpf_probe_read(&dport, sizeof(dport), &skp->__sk_common.skc_dport);
dport = skp->__sk_common.skc_dport;
if (ipver == 4) {
bpf_probe_read(&saddr, sizeof(saddr),
&skp->__sk_common.skc_rcv_saddr);
bpf_probe_read(&daddr, sizeof(daddr),
&skp->__sk_common.skc_daddr);
saddr = skp->__sk_common.skc_rcv_saddr;
daddr = skp->__sk_common.skc_daddr;
// output
bpf_trace_printk("4 %x %x %d\\n", saddr, daddr, ntohs(dport));
Expand Down

0 comments on commit 033dcae

Please sign in to comment.