Skip to content

Commit 35b5ace

Browse files
committed
SO_ATTACH_REUSEPORT_CBPF filter update. SDK_AD_QUEUE support to attach to a queue.
Closes #9690
1 parent 69eb38b commit 35b5ace

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ PHP NEWS
3333
- Sockets:
3434
. Added SO_ATTACH_REUSEPORT_CBPF socket option, to give tighter control
3535
over socket binding for a cpu core. (David Carlier)
36+
. Added SKF_AD_QUEUE for cbpf filters. (David Carlier)
3637

3738
- Reflection:
3839
. Fix GH-9470 (ReflectionMethod constructor should not find private parent

ext/sockets/sockets.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,16 +1978,17 @@ PHP_FUNCTION(socket_set_option)
19781978
static struct sock_fprog bpfprog;
19791979

19801980
switch (k) {
1981-
case SKF_AD_CPU:
1982-
cbpf[0].code = (BPF_LD|BPF_W|BPF_ABS);
1983-
cbpf[0].k = (uint32_t)(SKF_AD_OFF + k);
1984-
cbpf[1].code = (BPF_RET|BPF_A);
1985-
bpfprog.len = 2;
1986-
break;
1987-
default:
1988-
php_error_docref(NULL, E_WARNING, "Unsupported CBPF filter");
1989-
RETURN_FALSE;
1990-
}
1981+
case SKF_AD_CPU:
1982+
case SKF_AD_QUEUE:
1983+
cbpf[0].code = (BPF_LD|BPF_W|BPF_ABS);
1984+
cbpf[0].k = (uint32_t)(SKF_AD_OFF + k);
1985+
cbpf[1].code = (BPF_RET|BPF_A);
1986+
bpfprog.len = 2;
1987+
break;
1988+
default:
1989+
php_error_docref(NULL, E_WARNING, "Unsupported CBPF filter");
1990+
RETURN_FALSE;
1991+
}
19911992

19921993
bpfprog.filter = cbpf;
19931994
optlen = sizeof(bpfprog);

0 commit comments

Comments
 (0)