Skip to content
  • Antonio's avatar
    tcp-server: ensure AF family is propagated to child context · 682e7fea
    Antonio authored and David Sommerseth's avatar David Sommerseth committed
    Commit 23d61c56 introduced the AF_UNSPEC socket family
    to be used when we don't know the actual one until the local
    socket binding is performed.
    
    In such case AF_UNSPEC is stored in the `ce.af` member of
    the `c->options` object, indicating that the family has to be
    determined at runtime.
    
    However, the determined value is never propagated back to the
    `options` object, which remains AF_UNSPEC and that is
    later used to initialize the TCP children contexts (UDP
    children contexts are unaffected).
    
    This unexpected setting can trigger weird behaviours, like
    the one reported in ticket #933.
    In this case the value AF_UNSPEC in combination with the
    changes implemented in 2bed089d
    
     are leading to a TCP
    server quitting with M_FATAL upon client connection.
    
    Note that the misbehaviour described in #933 can only be
    triggered when running a TCP server with mtu-disc set
    in the config (no matter the value).
    
    Fix this inconsistency by always propagating the AF
    family from the top to the child context when running
    in TCP server mode.
    
    As a direct consequence, this patch fixes Trac #933.
    
    Trac: 933
    Signed-off-by: default avatarAntonio Quartulli <antonio@openvpn.net>
    Acked-by: default avatarArne Schwabe <arne@rfc2549.org>
    Message-Id: <20170907095530.15972-1-a@unstable.cc>
    URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15380.html
    
    
    Signed-off-by: default avatarDavid Sommerseth <davids@openvpn.net>
    682e7fea