Stanislav Fomichev
8086fbaf49
bpf: Allow any port in bpf_bind helper
...
We want to have a tighter control on what ports we bind to in
the BPF_CGROUP_INET{4,6}_CONNECT hooks even if it means
connect() becomes slightly more expensive. The expensive part
comes from the fact that we now need to call inet_csk_get_port()
that verifies that the port is not used and allocates an entry
in the hash table for it.
Since we can't rely on "snum || !bind_address_no_port" to prevent
us from calling POST_BIND hook anymore, let's add another bind flag
to indicate that the call site is BPF program.
v5:
* fix wrong AF_INET (should be AF_INET6) in the bpf program for v6
v3:
* More bpf_bind documentation refinements (Martin KaFai Lau)
* Add UDP tests as well (Martin KaFai Lau)
* Don't start the thread, just do socket+bind+listen (Martin KaFai Lau)
v2:
* Update documentation (Andrey Ignatov)
* Pass BIND_FORCE_ADDRESS_NO_PORT conditionally (Andrey Ignatov)
Signed-off-by: Stanislav Fomichev <sdf@google.com >
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net >
Acked-by: Andrey Ignatov <rdna@fb.com >
Acked-by: Martin KaFai Lau <kafai@fb.com >
Link: https://lore.kernel.org/bpf/20200508174611.228805-5-sdf@google.com
2020-05-09 00:48:20 +02:00
..
2019-11-05 12:44:34 +01:00
2019-06-05 10:55:30 -04:00
2020-01-21 11:41:36 +01:00
2019-09-07 17:44:25 +02:00
2020-03-24 14:39:45 +01:00
2020-04-28 00:53:54 +02:00
2019-10-04 14:25:17 -07:00
2020-03-15 15:20:16 +01:00
2019-10-04 14:25:17 -07:00
2019-10-04 14:25:17 -07:00
2019-09-10 09:26:33 -04:00
2019-09-13 13:10:06 -07:00
2019-06-24 19:23:46 +02:00
2019-03-18 12:18:28 +00:00
2020-05-01 16:08:19 -07:00
2020-03-17 16:04:49 +01:00
2019-12-18 18:07:31 +01:00
2019-06-26 20:14:13 -04:00
2019-04-25 19:33:34 +02:00
2019-12-11 17:41:09 +01:00
2020-01-01 00:00:33 +01:00
2020-01-01 00:00:33 +01:00
2020-01-23 11:40:01 -07:00
2019-11-07 06:31:50 -07:00
2020-05-09 00:48:20 +02:00
2019-07-25 11:05:10 +02:00
2020-01-10 17:20:07 +01:00
2019-11-18 17:51:49 +01:00
2020-04-10 18:48:27 +02:00
2019-11-05 12:44:34 +01:00
2020-04-16 12:19:06 -03:00
2019-10-07 07:55:17 -03:00
2019-10-01 17:19:41 -03:00
2019-10-09 22:31:14 -04:00
2019-07-16 19:23:23 -07:00
2019-09-25 17:51:39 -07:00
2020-03-26 15:10:44 +01:00
2019-08-02 14:44:02 +10:00
2019-11-15 14:38:29 +01:00
2019-10-28 13:41:01 -07:00
2020-03-30 17:54:58 -07:00
2020-04-18 15:44:56 -05:00
2020-03-03 11:10:21 -05:00
2019-06-14 15:00:51 +05:30
2019-12-17 21:37:40 +05:30
2019-03-20 21:11:22 -04:00
2019-11-15 14:38:29 +01:00
2020-04-30 12:56:38 -07:00
2020-03-29 22:32:37 -07:00
2020-03-29 22:32:36 -07:00
2020-03-25 23:17:16 +01:00
2020-01-18 09:19:18 -05:00
2020-03-16 08:26:58 -06:00
2020-04-18 15:44:56 -05:00
2019-03-27 13:30:07 -07:00
2019-08-05 17:56:46 +02:00
2019-09-21 14:26:33 -07:00
2020-03-19 21:56:54 -07:00
2019-08-12 19:33:50 -07:00
2019-10-23 14:26:37 +02:00
2019-11-05 18:20:55 -08:00
2020-04-30 17:51:42 -07:00
2020-03-25 09:50:44 +01:00
2019-09-04 12:43:54 +02:00
2019-12-11 15:31:52 +01:00
2019-04-18 16:58:37 -07:00
2020-03-11 15:08:52 +05:30
2020-02-29 21:52:20 -08:00
2019-12-26 13:09:37 -08:00
2020-04-27 11:40:25 -07:00
2020-04-27 11:40:25 -07:00
2020-04-27 11:40:25 -07:00
2020-03-16 01:42:31 -07:00
2019-06-29 11:06:17 -07:00
2019-03-21 13:19:15 -07:00
2019-04-19 13:58:17 -07:00
2020-05-01 12:24:40 -07:00
2019-08-31 01:08:26 +02:00
2020-04-20 12:43:24 -07:00
2020-03-11 23:49:30 -07:00
2020-04-30 12:54:02 -07:00
2020-04-06 20:56:50 -07:00
2019-12-13 15:00:36 -08:00
2020-03-21 14:03:46 -06:00
2019-10-15 13:34:43 +02:00
2019-07-04 02:29:49 +02:00
2019-07-25 11:05:10 +02:00
2020-03-29 22:30:57 -07:00
2019-07-25 11:05:10 +02:00
2019-08-22 17:24:51 +02:00
2020-01-04 13:55:09 -08:00
2019-09-08 15:37:04 +02:00
2019-07-10 18:43:43 -07:00
2019-08-07 10:21:38 -05:00
2019-07-02 18:56:01 +02:00
2020-03-26 11:09:04 +11:00
2019-04-22 13:02:53 -04:00
2020-03-29 22:30:57 -07:00
2020-02-07 14:39:38 +09:00
2019-08-19 13:04:45 -07:00
2020-03-20 09:01:16 +01:00
2019-06-21 16:45:38 -04:00
2019-03-28 02:07:54 +09:00
2020-03-17 22:51:16 -07:00
2020-04-02 09:35:30 -07:00
2019-03-20 18:49:06 -04:00
2020-03-29 22:14:49 -07:00
2020-04-27 11:40:25 -07:00
2019-11-15 14:38:29 +01:00
2020-03-02 11:16:28 -08:00
2020-03-29 22:32:36 -07:00
2020-03-18 16:35:48 -07:00
2020-04-30 17:51:42 -07:00
2019-05-28 21:37:30 -07:00
2019-04-25 14:18:14 -04:00
2019-07-12 11:05:40 -07:00
2020-03-20 14:42:20 +01:00
2019-11-06 06:17:38 +09:00
2020-01-18 09:19:18 -05:00
2020-02-16 19:34:44 -08:00
2020-02-20 22:44:30 -06:00
2020-04-02 17:57:10 +01:00
2020-03-27 10:41:44 -03:00
2019-10-02 20:32:27 -06:00
2020-05-01 16:08:19 -07:00
2020-03-26 20:08:45 -07:00
2019-07-30 20:34:34 +02:00
2019-12-01 14:00:59 -08:00
2019-10-23 17:23:47 +02:00
2020-01-28 10:09:51 +01:00
2019-04-16 23:05:21 +02:00
2019-10-26 02:09:58 +11:00
2020-05-02 16:31:45 -07:00
2019-07-16 19:23:24 -07:00
2020-01-07 16:07:01 -05:00
2019-08-24 16:55:25 -07:00
2019-11-15 14:38:29 +01:00
2020-03-29 22:30:57 -07:00
2020-03-29 22:30:57 -07:00
2020-03-26 21:38:40 +01:00
2020-01-15 13:48:18 +01:00
2019-07-25 11:05:10 +02:00
2019-12-04 19:44:12 -08:00
2020-02-12 17:57:51 -05:00
2019-11-08 14:18:32 -08:00
2020-03-04 14:48:54 -08:00
2019-11-04 07:11:31 -07:00
2019-11-15 14:38:29 +01:00
2019-10-16 06:11:24 -07:00
2020-03-24 15:59:34 -07:00
2019-11-15 14:38:29 +01:00
2020-01-26 15:28:47 +01:00
2020-02-27 18:50:19 -08:00
2019-08-03 11:02:46 -07:00
2019-04-19 14:07:40 -07:00
2019-11-13 12:15:34 -08:00
2020-02-21 11:22:15 -08:00
2020-01-15 11:00:39 -06:00
2020-01-31 10:30:39 -08:00
2019-12-18 18:07:31 +01:00
2020-03-09 17:56:33 -07:00
2020-01-04 13:49:51 +08:00
2019-12-18 18:07:33 +01:00
2020-02-21 11:22:15 -08:00
2019-12-18 18:07:33 +01:00
2019-10-04 14:25:17 -07:00
2019-12-20 21:18:42 -08:00
2019-11-08 14:01:59 -08:00
2019-08-31 23:44:28 -07:00
2019-12-09 09:59:07 +01:00
2020-03-29 23:29:08 +02:00
2019-05-22 10:36:35 -07:00
2019-08-14 16:52:13 +02:00
2020-04-07 10:43:39 -07:00
2019-11-15 14:38:29 +01:00
2020-02-24 16:12:28 +01:00
2019-07-25 11:05:10 +02:00
2019-07-25 11:05:10 +02:00
2019-04-24 14:18:51 +02:00
2020-03-24 09:28:27 -06:00
2020-04-02 10:41:40 -04:00
2020-04-02 10:41:40 -04:00
2020-03-20 09:00:56 +01:00
2020-04-17 06:05:30 -04:00
2019-09-18 20:17:50 +02:00
2019-04-11 17:00:10 +02:00
2020-03-20 14:42:19 +01:00
2020-03-27 11:09:18 +01:00
2020-03-23 09:50:02 -04:00
2019-07-25 11:05:10 +02:00
2019-10-04 14:25:17 -07:00
2019-12-11 15:01:23 -08:00
2019-07-25 11:05:10 +02:00
2019-08-01 21:49:46 +02:00
2019-12-16 19:22:22 -08:00
2019-12-13 10:45:35 +01:00
2019-07-25 11:05:10 +02:00