-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support two representations for embedded IPv4 addresses
DTrace's inet_ntoa6() represents mapped and embedded IPv4 addresses using the regular IPv4 representation, whereas inet_ntop() uses a strict IPv6 representation (:: or ::ffff: prefix followed by a regular IPv4 address). The implementation uses a 2nd argument to inet_ntoa6() that must be an integer constant that indicates basic IPv4 representation (0), or strict IPv4-in-IPv6 representation (non-0). Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
- Loading branch information
Showing
15 changed files
with
189 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
test/unittest/funcs/inet_ntoa6/err.D_PROTO_ARG.inet_ntoa6.arg1_not_in6_addr.d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* http://oss.oracle.com/licenses/upl. | ||
*/ | ||
|
||
#pragma D option quiet | ||
|
||
int *p; | ||
|
||
BEGIN | ||
{ | ||
p = alloca(sizeof(int) * 4); | ||
p[3] = htonl(0x7f000001); | ||
trace(inet_ntoa6(p)); | ||
|
||
exit(0); | ||
} |
20 changes: 20 additions & 0 deletions
20
test/unittest/funcs/inet_ntoa6/err.D_PROTO_ARG.inet_ntoa6.arg2_not_const.d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* http://oss.oracle.com/licenses/upl. | ||
*/ | ||
|
||
#pragma D option quiet | ||
|
||
int *p; | ||
|
||
BEGIN | ||
{ | ||
p = alloca(sizeof(int) * 4); | ||
n = 0; | ||
p[3] = htonl(0x7f000001); | ||
trace(inet_ntoa6((struct in6_addr *)p, n)); | ||
|
||
exit(0); | ||
} |
19 changes: 19 additions & 0 deletions
19
test/unittest/funcs/inet_ntoa6/err.D_PROTO_ARG.inet_ntoa6.arg2_not_int.d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* http://oss.oracle.com/licenses/upl. | ||
*/ | ||
|
||
#pragma D option quiet | ||
|
||
int *p; | ||
|
||
BEGIN | ||
{ | ||
p = alloca(sizeof(int) * 4); | ||
p[3] = htonl(0x7f000001); | ||
trace(inet_ntoa6((struct in6_addr *)p, "")); | ||
|
||
exit(0); | ||
} |
15 changes: 15 additions & 0 deletions
15
test/unittest/funcs/inet_ntoa6/err.D_PROTO_LEN.inet_ntoa6.too_few_args.d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* http://oss.oracle.com/licenses/upl. | ||
*/ | ||
|
||
#pragma D option quiet | ||
|
||
BEGIN | ||
{ | ||
inet_ntoa6(); | ||
|
||
exit(0); | ||
} |
15 changes: 15 additions & 0 deletions
15
test/unittest/funcs/inet_ntoa6/err.D_PROTO_LEN.inet_ntoa6.too_many_args.d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* http://oss.oracle.com/licenses/upl. | ||
*/ | ||
|
||
#pragma D option quiet | ||
|
||
BEGIN | ||
{ | ||
inet_ntoa6(0, 0, 0); | ||
|
||
exit(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* http://oss.oracle.com/licenses/upl. | ||
*/ | ||
|
||
#pragma D option quiet | ||
|
||
int *p; | ||
|
||
BEGIN | ||
{ | ||
p = alloca(sizeof(int) * 4); | ||
p[3] = htonl(0x7f000001); | ||
trace(inet_ntoa6((struct in6_addr *)p, 0)); | ||
|
||
exit(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
127.0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* http://oss.oracle.com/licenses/upl. | ||
*/ | ||
|
||
#pragma D option quiet | ||
|
||
int *p; | ||
|
||
BEGIN | ||
{ | ||
p = alloca(sizeof(int) * 4); | ||
p[3] = htonl(0x7f000001); | ||
trace(inet_ntoa6((struct in6_addr *)p, 1)); | ||
|
||
exit(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
::127.0.0.1 |
19 changes: 19 additions & 0 deletions
19
test/unittest/funcs/inet_ntoa6/tst.inet_ntoa6.strict-not-0.d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* http://oss.oracle.com/licenses/upl. | ||
*/ | ||
|
||
#pragma D option quiet | ||
|
||
int *p; | ||
|
||
BEGIN | ||
{ | ||
p = alloca(sizeof(int) * 4); | ||
p[3] = htonl(0x7f000001); | ||
trace(inet_ntoa6((struct in6_addr *)p, 42)); | ||
|
||
exit(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
::127.0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ fe80::214:4fff:fe0b:76c8 | |
1080::808:c:417a | ||
::1 | ||
:: | ||
127.0.0.1 | ||
127.0.0.1 | ||
::127.0.0.1 | ||
::ffff:127.0.0.1 | ||
::fffe:7f00:1 | ||
|