svn commit: r338053 - head/sys/netinet

Conrad Meyer cem at freebsd.org
Sun Aug 19 16:35:59 UTC 2018


On Sun, Aug 19, 2018 at 7:56 AM, Michael Tuexen <tuexen at freebsd.org> wrote:
> Author: tuexen
> Date: Sun Aug 19 14:56:10 2018
> New Revision: 338053
> URL: https://svnweb.freebsd.org/changeset/base/338053
>
> Log:
>   … a keyed hash function taking
>   the source and destination addresses and port numbers into account.
>   The keyed hash function is the same a used for the initial TSN.
> ...
> Modified: head/sys/netinet/tcp_subr.c
> ==============================================================================
> --- head/sys/netinet/tcp_subr.c Sun Aug 19 14:48:32 2018        (r338052)
> +++ head/sys/netinet/tcp_subr.c Sun Aug 19 14:56:10 2018        (r338053)
> @@ -233,6 +233,9 @@ VNET_DEFINE(uma_zone_t, sack_hole_zone);
> ...
>
> +static uint32_t
> +tcp_keyed_hash(struct in_conninfo *inc, u_char *key)
> +{
> +       MD5_CTX ctx;
> +       uint32_t hash[4];
>
> +       MD5Init(&ctx);
> +       MD5Update(&ctx, &inc->inc_fport, sizeof(uint16_t));
> +       MD5Update(&ctx, &inc->inc_lport, sizeof(uint16_t));
> +       switch (inc->inc_flags & INC_ISIPV6) {
> +#ifdef INET
> +       case 0:
> +               MD5Update(&ctx, &inc->inc_faddr, sizeof(struct in_addr));
> +               MD5Update(&ctx, &inc->inc_laddr, sizeof(struct in_addr));
> +               break;
> +#endif
> +#ifdef INET6
> +       case INC_ISIPV6:
> +               MD5Update(&ctx, &inc->inc6_faddr, sizeof(struct in6_addr));
> +               MD5Update(&ctx, &inc->inc6_laddr, sizeof(struct in6_addr));
> +               break;
> +#endif
> +       }
> +       MD5Update(&ctx, key, 32);
> +       MD5Final((unsigned char *)hash, &ctx);
> +
> +       return (hash[0]);

Hi Michael,

How was this particular keyed hash function construction chosen?
(Yes, I see it is the same initial TSN, but how was that selected?)

Thanks,
Conrad


More information about the svn-src-all mailing list