Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 05 Oct 2019 00:04:51 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 241068] dns/dnsmasq: IPv4 TFTP broken on dnsmasq after FreeBSD 11.2
Message-ID:  <bug-241068-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D241068

            Bug ID: 241068
           Summary: dns/dnsmasq: IPv4 TFTP broken on dnsmasq after FreeBSD
                    11.2
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: mandree@FreeBSD.org
          Reporter: phil.chadwick@claremont.farm
             Flags: maintainer-feedback?(mandree@FreeBSD.org)
                CC:
          Assignee: mandree@FreeBSD.org

See:
https://forums.freebsd.org/threads/dnsmasq-tftp-service-not-working-any-lon=
ger.72457/#post-440976

To reproduce the problem:

cd /usr/ports/dns/dnsmasq
make install

cat - >/usr/local/etc/dnsmasq.conf <<EOF
enable-tftp
tftp-root=3D/tmp
log-facility=3D/var/log/dnsmasq.log
EOF

echo "something" >/tmp/test.file

# Start in debug mode
/usr/local/sbin/dnsmasq -d -C /usr/local/etc/dnsmasq.conf

# Start a client transfer from another session on the same host:
tftp localhost
get test.file

It fails, repeatedly, on FreeBSD 11.3 and FreeBSD 12.0.  Works on FreeBSD 1=
1.2.

The problem arises in tftp.c at line 195, when the return is taken because
if_index is zero, and can not be translated to a name.  This results in dns=
masq
refusing to service a client tftp request:

if (!indextoname(listen->tftpfd, if_index, namebuff))
    return;

The failure to set if_index correctly for BSD hosts occurs just prior to th=
is=20
in the block of code commencing at line 159:

 #elif defined(IP_RECVDSTADDR) && defined(IP_RECVIF)
      if (listen->family =3D=3D AF_INET)
        for (cmptr =3D CMSG_FIRSTHDR(&msg); cmptr; cmptr =3D CMSG_NXTHDR(&m=
sg,
cmptr))
          {
            union {
              unsigned char *c;
              struct in_addr *a;
              struct sockaddr_dl *s;
            } p;
            p.c =3D CMSG_DATA(cmptr);
            if (cmptr->cmsg_level =3D=3D IPPROTO_IP && cmptr->cmsg_type =3D=
=3D
IP_RECVDSTADDR)
              addr.in.sin_addr =3D *(p.a);
            else if (cmptr->cmsg_level =3D=3D IPPROTO_IP && cmptr->cmsg_typ=
e =3D=3D
IP_RECVIF)
              if_index =3D p.s->sdl_index;
          }

#endif

The value of if_index should be set by the above code, and it is not.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



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