Replace first padding in the tcp_md5sig structure with a new flag field and address prefix length so it can be specified when configuring a new key for TCP MD5 signature. The tcpm_flags field will only be used if the socket option is TCP_MD5SIG_EXT to avoid breaking existing programs, and tcpm_prefixlen only when the TCP_MD5SIG_FLAG_PREFIX flag is set.
Showing the changes to include/uapi/linux (1 of 5 files). Show all
Unified · Split
| @@ -117,7 +117,8 @@ enum { · 116 unmodified lines | |||
| 117 | #define TCP_SAVED_SYN 28 /* Get SYN headers recorded for connection */ | 117 | #define TCP_SAVED_SYN 28 /* Get SYN headers recorded for connection */ |
| 118 | #define TCP_REPAIR_WINDOW 29 /* Get/set window parameters */ | 118 | #define TCP_REPAIR_WINDOW 29 /* Get/set window parameters */ |
| 119 | #define TCP_FASTOPEN_CONNECT 30 /* Attempt FastOpen with connect */ | 119 | #define TCP_FASTOPEN_CONNECT 30 /* Attempt FastOpen with connect */ |
| 120 | #define TCP_ULP 31 /* Attach a ULP to a TCP connection */ | 120 | #define TCP_ULP 31 /* Attach a ULP to a TCP connection */ |
| 121 | #define TCP_MD5SIG_EXT 32 /* TCP MD5 Signature with extensions */ | ||
| 121 | 122 | ||
| 122 | struct tcp_repair_opt { | 123 | struct tcp_repair_opt { |
| 123 | __u32 opt_code; | 124 | __u32 opt_code; |
| @@ -235,11 +236,15 @@ enum { · 111 unmodified lines | |||
| 235 | /* for TCP_MD5SIG socket option */ | 236 | /* for TCP_MD5SIG socket option */ |
| 236 | #define TCP_MD5SIG_MAXKEYLEN 80 | 237 | #define TCP_MD5SIG_MAXKEYLEN 80 |
| 237 | 238 | ||
| 239 | /* tcp_md5sig extension flags for TCP_MD5SIG_EXT */ | ||
| 240 | #define TCP_MD5SIG_FLAG_PREFIX 1 /* address prefix length */ | ||
| 241 | |||
| 238 | struct tcp_md5sig { | 242 | struct tcp_md5sig { |
| 239 | struct __kernel_sockaddr_storage tcpm_addr; /* address associated */ | 243 | struct __kernel_sockaddr_storage tcpm_addr; /* address associated */ |
| 240 | __u16 __tcpm_pad1; /* zero */ | 244 | __u8 tcpm_flags; /* extension flags */ |
| 245 | __u8 tcpm_prefixlen; /* address prefix */ | ||
| 241 | __u16 tcpm_keylen; /* key length */ | 246 | __u16 tcpm_keylen; /* key length */ |
| 242 | __u32 __tcpm_pad2; /* zero */ | 247 | __u32 __tcpm_pad; /* zero */ |
| 243 | __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */ | 248 | __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */ |
| 244 | }; | 249 | }; |
| 245 | 250 | ||