Lines Matching refs:p
141 struct sock_fprog p = { in attach_cbpf() local
146 if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_REUSEPORT_CBPF, &p, sizeof(p))) in attach_cbpf()
150 static void build_recv_group(const struct test_params p, int fd[], uint16_t mod, in build_recv_group() argument
154 new_any_sockaddr(p.recv_family, p.recv_port); in build_recv_group()
157 for (i = 0; i < p.recv_socks; ++i) { in build_recv_group()
158 fd[i] = socket(p.recv_family, p.protocol, 0); in build_recv_group()
173 if (p.protocol == SOCK_STREAM) { in build_recv_group()
179 if (listen(fd[i], p.recv_socks * 10)) in build_recv_group()
186 static void send_from(struct test_params p, uint16_t sport, char *buf, in send_from() argument
189 struct sockaddr * const saddr = new_any_sockaddr(p.send_family, sport); in send_from()
191 new_loopback_sockaddr(p.send_family, p.recv_port); in send_from()
192 const int fd = socket(p.send_family, p.protocol, 0), one = 1; in send_from()
211 static void test_recv_order(const struct test_params p, int fd[], int mod) in test_recv_order() argument
223 for (i = 0; i < p.recv_socks; ++i) { in test_recv_order()
234 for (data = 0; data < p.recv_socks * 2; ++data) { in test_recv_order()
235 sport = p.send_port_min + data; in test_recv_order()
238 send_from(p, sport, send_buf, sizeof(ndata)); in test_recv_order()
244 if (p.protocol == SOCK_STREAM) { in test_recv_order()
259 for (i = 0; i < p.recv_socks; ++i) in test_recv_order()
271 static void test_reuseport_ebpf(struct test_params p) in test_reuseport_ebpf() argument
273 int i, fd[p.recv_socks]; in test_reuseport_ebpf()
275 fprintf(stderr, "Testing EBPF mod %zd...\n", p.recv_socks); in test_reuseport_ebpf()
276 build_recv_group(p, fd, p.recv_socks, attach_ebpf); in test_reuseport_ebpf()
277 test_recv_order(p, fd, p.recv_socks); in test_reuseport_ebpf()
279 p.send_port_min += p.recv_socks * 2; in test_reuseport_ebpf()
280 fprintf(stderr, "Reprograming, testing mod %zd...\n", p.recv_socks / 2); in test_reuseport_ebpf()
281 attach_ebpf(fd[0], p.recv_socks / 2); in test_reuseport_ebpf()
282 test_recv_order(p, fd, p.recv_socks / 2); in test_reuseport_ebpf()
284 for (i = 0; i < p.recv_socks; ++i) in test_reuseport_ebpf()
288 static void test_reuseport_cbpf(struct test_params p) in test_reuseport_cbpf() argument
290 int i, fd[p.recv_socks]; in test_reuseport_cbpf()
292 fprintf(stderr, "Testing CBPF mod %zd...\n", p.recv_socks); in test_reuseport_cbpf()
293 build_recv_group(p, fd, p.recv_socks, attach_cbpf); in test_reuseport_cbpf()
294 test_recv_order(p, fd, p.recv_socks); in test_reuseport_cbpf()
296 p.send_port_min += p.recv_socks * 2; in test_reuseport_cbpf()
297 fprintf(stderr, "Reprograming, testing mod %zd...\n", p.recv_socks / 2); in test_reuseport_cbpf()
298 attach_cbpf(fd[0], p.recv_socks / 2); in test_reuseport_cbpf()
299 test_recv_order(p, fd, p.recv_socks / 2); in test_reuseport_cbpf()
301 for (i = 0; i < p.recv_socks; ++i) in test_reuseport_cbpf()
305 static void test_extra_filter(const struct test_params p) in test_extra_filter() argument
308 new_any_sockaddr(p.recv_family, p.recv_port); in test_extra_filter()
312 fd1 = socket(p.recv_family, p.protocol, 0); in test_extra_filter()
315 fd2 = socket(p.recv_family, p.protocol, 0); in test_extra_filter()
337 static void test_filter_no_reuseport(const struct test_params p) in test_filter_no_reuseport() argument
340 new_any_sockaddr(p.recv_family, p.recv_port); in test_filter_no_reuseport()
368 fd = socket(p.recv_family, p.protocol, 0); in test_filter_no_reuseport()