Skip to content

Commit eb6b544

Browse files
committed
attempt to tet BBR tcp stack which ought to be accessible with
current FreeBSD CI.
1 parent 32c2a9c commit eb6b544

File tree

5 files changed

+28
-19
lines changed

5 files changed

+28
-19
lines changed

.github/actions/freebsd/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ runs:
1313
cd $GITHUB_WORKSPACE
1414
1515
kldload accf_http
16+
kldload tcp_bbr
1617
pkg install -y \
1718
autoconf \
1819
bison \

ext/sockets/sockets.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,11 @@ PHP_FUNCTION(socket_get_option)
17051705
#endif
17061706

17071707
#ifdef TCP_FUNCTION_BLK
1708-
case TCP_FUNCTION_BLK: {
1708+
case TCP_FUNCTION_BLK:
1709+
#ifdef TCP_FUNCTION_ALIAS
1710+
case TCP_FUNCTION_ALIAS:
1711+
#endif
1712+
{
17091713

17101714
struct tcp_function_set tsf = {0};
17111715
optlen = sizeof(tsf);

ext/sockets/sockets.stub.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -654,22 +654,22 @@
654654
*/
655655
const TCP_FUNCTION_ALIAS = UNKNOWN;
656656
#endif
657-
#ifdef TCP_REUSEPORT_LB_NUMA
657+
#ifdef TCP_REUSPORT_LB_NUMA
658658
/**
659659
* @var int
660-
* @cvalue TCP_REUSEPORT_LB_NUMA
660+
* @cvalue TCP_REUSPORT_LB_NUMA
661661
*/
662-
const TCP_REUSEPORT_LB_NUMA = UNKNOWN;
662+
const TCP_REUSPORT_LB_NUMA = UNKNOWN;
663663
/**
664664
* @var int
665-
* @cvalue TCP_REUSEPORT_LB_NUMA_NODOM
665+
* @cvalue TCP_REUSPORT_LB_NUMA_NODOM
666666
*/
667-
const TCP_REUSEPORT_LB_NUMA_NODOM = UNKNOWN;
667+
const TCP_REUSPORT_LB_NUMA_NODOM = UNKNOWN;
668668
/**
669669
* @var int
670-
* @cvalue TCP_REUSEPORT_LB_NUMA_CURDOM
670+
* @cvalue TCP_REUSPORT_LB_NUMA_CURDOM
671671
*/
672-
const TCP_REUSEPORT_LB_NUMA_CURDOM = UNKNOWN;
672+
const TCP_REUSPORT_LB_NUMA_CURDOM = UNKNOWN;
673673
#endif
674674
#ifdef TCP_BBR_ALGORITHM
675675
/**

ext/sockets/sockets_arginfo.h

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/sockets/tests/socket_set_option_tsf.phpt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,21 @@ if (!$socket) {
1717
die('Unable to create AF_INET socket [socket]');
1818
}
1919
socket_set_option( $socket, SOL_TCP, TCP_FUNCTION_BLK, "nochancetoexist");
20-
// TCP/RACK and other alternate stacks are not present by default, at least `freebsd` is.
21-
var_dump(socket_set_option( $socket, SOL_TCP, TCP_FUNCTION_BLK, "freebsd"));
20+
// TCP/RACK and other alternate stacks are not present by default, BBR should be available.
21+
var_dump(socket_set_option( $socket, SOL_TCP, TCP_FUNCTION_BLK, "bbr"));
22+
var_dump(socket_set_option( $socket, SOL_TCP, TCP_BBR_ALGORITHM, 0));
2223
var_dump(socket_get_option( $socket, SOL_TCP, TCP_FUNCTION_BLK));
24+
var_dump(socket_get_option( $socket, SOL_TCP, TCP_BBR_ALGORITHM));
2325
socket_close($socket);
2426
?>
2527
--EXPECTF--
2628
Warning: socket_set_option(): Unable to set socket option [2]: No such file or directory in %s on line %d
2729
bool(true)
30+
bool(true)
2831
array(2) {
2932
["function_set_name"]=>
30-
string(7) "freebsd"
33+
string(3) "bbr"
3134
["pcbcnt"]=>
32-
int(%d)
35+
int(1)
3336
}
37+
int(0)

0 commit comments

Comments
 (0)