SO_ATTACH_REUSEPORT_CBPF filter update. SDK_AD_QUEUE support to attach to a queue.

Closes #9690
This commit is contained in:
David Carlier 2022-10-08 02:48:24 +01:00
parent 69eb38b460
commit 35b5aceff3
2 changed files with 12 additions and 10 deletions

1
NEWS
View file

@ -33,6 +33,7 @@ PHP NEWS
- Sockets:
. Added SO_ATTACH_REUSEPORT_CBPF socket option, to give tighter control
over socket binding for a cpu core. (David Carlier)
. Added SKF_AD_QUEUE for cbpf filters. (David Carlier)
- Reflection:
. Fix GH-9470 (ReflectionMethod constructor should not find private parent

View file

@ -1978,16 +1978,17 @@ PHP_FUNCTION(socket_set_option)
static struct sock_fprog bpfprog;
switch (k) {
case SKF_AD_CPU:
cbpf[0].code = (BPF_LD|BPF_W|BPF_ABS);
cbpf[0].k = (uint32_t)(SKF_AD_OFF + k);
cbpf[1].code = (BPF_RET|BPF_A);
bpfprog.len = 2;
break;
default:
php_error_docref(NULL, E_WARNING, "Unsupported CBPF filter");
RETURN_FALSE;
}
case SKF_AD_CPU:
case SKF_AD_QUEUE:
cbpf[0].code = (BPF_LD|BPF_W|BPF_ABS);
cbpf[0].k = (uint32_t)(SKF_AD_OFF + k);
cbpf[1].code = (BPF_RET|BPF_A);
bpfprog.len = 2;
break;
default:
php_error_docref(NULL, E_WARNING, "Unsupported CBPF filter");
RETURN_FALSE;
}
bpfprog.filter = cbpf;
optlen = sizeof(bpfprog);