Skip to content

Commit bba6a34

Browse files
committed
Address agentzh's comments.
1 parent 3eb5acd commit bba6a34

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

README.markdown

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,8 +1465,11 @@ ngx-ssl-session-ticket-keys
14651465
Dumping ssl session ticket keys of a nginx worker.
14661466

14671467
```bash
1468+
# making the ./stap++ tool visible in PATH:
1469+
$ export PATH=$PWD:$PATH
1470+
14681471
# assuming one nginx worker process has the pid 3781.
1469-
$ ./samples/ngx-ssl-session-ticket-keys.sxx -I ./tapset -x 3781
1472+
$ ./samples/ngx-ssl-session-ticket-keys.sxx -x 3781
14701473
```
14711474

14721475
[Back to TOC](#table-of-contents)
@@ -1477,6 +1480,9 @@ ngx-ssl-session-resumption-stats
14771480
Analyzing the statistics of nginx SSL/TLS session ticket resumption.
14781481

14791482
```bash
1483+
# making the ./stap++ tool visible in PATH:
1484+
$ export PATH=$PWD:$PATH
1485+
14801486
# assuming one nginx worker process has the pid 3781.
14811487
$ ./samples/ngx-ssl-session-resumption-stats.sxx -x 3781
14821488
```

samples/ngx-ssl-session-resumption-stats.sxx

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env stap++
22

3-
# Capture ssl session resumption statistics.
3+
# Capture ssl session resumption statistics.
44

55
global total
66
global tickets
@@ -39,7 +39,7 @@ probe end {
3939
ratio2 = (resumed * 100) / tickets;
4040

4141
} else {
42-
ratio2 = 0;
42+
ratio2 = 0;
4343
}
4444
printf("Session resumption attempts ratio: %d percent\n", ratio1)
4545
printf("Session resumption success ratio: %d percent\n", ratio2)

samples/ngx-ssl-session-ticket-keys.sxx

100644100755
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Capture ssl session tickets.
44

55
@use nginx.array
6-
@use nginx.openssl
6+
@use openssl
77

88
probe begin {
99
printf("Start tracing NGX OPENSSL ticket key callback\n")
@@ -14,7 +14,7 @@ function print_key_name(name) {
1414
printf("key name: ");
1515
$*n := @cast(name, "unsigned char", "$^exec_path")
1616
for (i=0; i<16; i++) {
17-
printf("%02x", $*n[i])
17+
printf("%02x", $*n[i])
1818
}
1919
printf("\n")
2020
}
@@ -24,7 +24,7 @@ function print_key_aes(state) {
2424
printf("key aes state: ");
2525
$*s := @cast(state, "unsigned char", "$^exec_path")
2626
for (i=0; i<16; i++) {
27-
printf("%02x", $*s[i])
27+
printf("%02x", $*s[i])
2828
}
2929
printf("\n")
3030
}
@@ -34,7 +34,7 @@ function print_key_hmac(state) {
3434
printf("key hmac state: ");
3535
$*s := @cast(state, "unsigned char", "$^exec_path")
3636
for (i=0; i<16; i++) {
37-
printf("%02x", $*s[i])
37+
printf("%02x", $*s[i])
3838
}
3939
printf("\n")
4040
}
@@ -63,7 +63,7 @@ probe @pfunc(ngx_ssl_session_ticket_key_callback).return {
6363
} else {
6464
key_ptr = get_ngx_array_elts(keys)
6565
enc_key = key_ptr
66-
last_key = &@cast(key_ptr, "ngx_ssl_session_ticket_key_t", "$^exec_path")[keys_len-1]
66+
last_key = &@cast(key_ptr, "ngx_ssl_session_ticket_key_t", "$^exec_path")[keys_len-1]
6767
printf("keys len %d\n", keys_len)
6868
printf("enc key:\n")
6969
print_session_ticket_key(enc_key)

tapset/nginx/array.sxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
function get_ngx_array_len(ngx_arr) {
44
$*arr := @cast(ngx_arr, "ngx_array_t", "$^exec_path")
55
return $*arr->nelts
6-
6+
77
}
88

99
function get_ngx_array_elts(ngx_arr) {
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// module nginx.openssl
1+
// module openssl.ssl_ctx
22

33
// extract ex_data pointer from openssl SSL_CTX
44
function get_ssl_ex_data(ssl_ctx) {
@@ -9,11 +9,13 @@ function get_ssl_ex_data(ssl_ctx) {
99
// extract number of items in SSL_CTX ex_data
1010
function get_ssl_ex_data_len(ssl_ctx) {
1111
ex_data = get_ssl_ex_data(ssl_ctx)
12-
return ex_data->sk->stack->num
12+
$*data := @cast(ex_data, "CRYPTO_EX_DATA", "$^exec_path")
13+
return $*data->sk->stack->num
1314
}
1415

1516
// extract the item specified by idx in SSL_CTX ex_data
1617
function get_ssl_ex_data_item(ssl_ctx, idx) {
1718
ex_data = get_ssl_ex_data(ssl_ctx)
18-
return ex_data->sk->stack->data[idx]
19+
$*data := @cast(ex_data, "CRYPTO_EX_DATA", "$^exec_path")
20+
return $*data->sk->stack->data[idx]
1921
}

0 commit comments

Comments
 (0)