From owner-freebsd-net@freebsd.org Wed Oct 2 21:04:37 2019 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 896A1139471 for ; Wed, 2 Oct 2019 21:04:37 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46k7tX1WNZz41J9 for ; Wed, 2 Oct 2019 21:04:35 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: by mail-qk1-x735.google.com with SMTP id u22so127070qkk.11 for ; Wed, 02 Oct 2019 14:04:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=YQFrlT8EFN6b4xLxF8fQkZRpPqR7Nr+JIoR5Sy79NzM=; b=QOuvK4Eiu4k/qLWNwg2zVPH6paxN85INlTTeZNVpUVluMDTJkayDEZGtmZun3jbMKp D4QHF7d11G/VaCILCf9FjN+d2ytGHYfJpV4z1PpWa4Nu+VWQIvzJazNFwFOwkK+qCzK5 Ys47mvu2mW9c+VW7hnqQZEMlEQh0/bF8KaAOs9O2KzMzaP5ejhugTJlzsWdd2uICcx7D edehC8jIz5Dcgdf0MdK2R2+L9KxiA1muARLh6kHn1LGCCddh7YUsTHqQVfFwNkafDed1 AKc1J980VEA4gYW/UDrGzWB6hW/p80FppxM5v6NAJWqp8sBKD7NCLP6CpSTnhr1If82o Rcnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=YQFrlT8EFN6b4xLxF8fQkZRpPqR7Nr+JIoR5Sy79NzM=; b=BFrCgDZAIj2ZMpt3FmrGGka2uxYMvZeCRxViPzJpkJhEesVxatcG3ySk4R8PevzJxR vXZ95N1/bsz2d/GhjSdxtBZww5i1V4MNI0dOVFDBhJxZvysXE2LE704oBZ64rx5iFQT6 7FtoikxQaKiAIT3mgi+82VyDnnKQRn5JBXIraOmvgQHc5ruUYxyohSvH+vIVeyGYifnG PE08BgMB791bDEM0Hk4uFirS7KbqDtNHYwdeHvwwkTrIn2RcR+2YgdlDnpOSqN+LO1op unJfRoyI/at6//7XMpMImPLmG60M/qbbwPiPomiaN/mBDdm4Ra5iF5JAUtRJjtxVB56m owXQ== X-Gm-Message-State: APjAAAX4npUHnJniRjACYnHWXyGfAuzMbpl8BMnXkBQk9nliLCClRY1f Lzn8qi/mCCWuA35PGj+Uh7ze/bejz0Qddy04rPcOQJbe X-Google-Smtp-Source: APXvYqz98PXb2r5OSqVkyKpe3KtYcRdbRNQMSyPk03mramkQMFgtDuSgcQnY1+BBZUVYQLIZ2p5ZJsPF6Ht1j71P9UE= X-Received: by 2002:a37:a843:: with SMTP id r64mr803299qke.363.1570050274738; Wed, 02 Oct 2019 14:04:34 -0700 (PDT) MIME-Version: 1.0 From: Ryan Stone Date: Wed, 2 Oct 2019 17:04:23 -0400 Message-ID: Subject: IPv6: Invalid nd6 entry created for an RA without an lladdr To: freebsd-net Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46k7tX1WNZz41J9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=QOuvK4Ei; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of rysto32@gmail.com designates 2607:f8b0:4864:20::735 as permitted sender) smtp.mailfrom=rysto32@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE_FREEMAIL(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; IP_SCORE(0.00)[ip: (-9.39), ipnet: 2607:f8b0::/32(-2.57), asn: 15169(-2.16), country: US(-0.05)]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[5.3.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Oct 2019 21:04:37 -0000 At work, our product is putting through an IPv6 conformance test and it's found an issue in our handling of Routing Advertisements (RAs). If we receive an RA that does not specify an lladdr, then nd6_cache_lladdr() is called with lladdr NULL: https://svnweb.freebsd.org/base/head/sys/netinet6/nd6.c?revision=347984&view=markup#l1961 In this case, the linkhdr cache is never initialized, but we still put the entry in the STALE state at line 2032. Because the entry is in the STALE state, nd6_resolve_slow() will happily return the uninitialized data to callers, causing us to send packets with a garbage link-layer header: https://svnweb.freebsd.org/base/head/sys/netinet6/nd6.c?revision=347984&view=markup#l2410 I'm unsure what the standard says is the right behaviour in this situation and before I start digging through RFCs, I was wondering if anybody knew what the right thing to do is. I've played with not putting the nd6 entry into the STALE state if we don't have an lladdr, and while it seems to work I'm unsure if it's the right thing to do. If people are curious, the RA-handling code that calls into nd6_cache_lladdr can be found here: https://svnweb.freebsd.org/base/head/sys/netinet6/nd6_rtr.c?revision=348121&view=markup#l185