Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Aug 2018 09:35:56 -0700
From:      Conrad Meyer <cem@freebsd.org>
To:        Michael Tuexen <tuexen@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r338053 - head/sys/netinet
Message-ID:  <CAG6CVpW6GyS-xV1xBnMsiFiKPvTX9Xe4EXkyhfXXGdBUvfko8w@mail.gmail.com>
In-Reply-To: <201808191456.w7JEuAZE069780@repo.freebsd.org>
References:  <201808191456.w7JEuAZE069780@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Aug 19, 2018 at 7:56 AM, Michael Tuexen <tuexen@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:
>   =E2=80=A6 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
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpW6GyS-xV1xBnMsiFiKPvTX9Xe4EXkyhfXXGdBUvfko8w>