Hello community,

here is the log from the commit of package tftp.4032 for openSUSE:13.2:Update 
checked in at 2015-09-29 10:13:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.2:Update/tftp.4032 (Old)
 and      /work/SRC/openSUSE:13.2:Update/.tftp.4032.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "tftp.4032"

Changes:
--------
New Changes file:

--- /dev/null   2015-09-24 09:51:01.260026505 +0200
+++ /work/SRC/openSUSE:13.2:Update/.tftp.4032.new/tftp.changes  2015-09-29 
10:13:47.000000000 +0200
@@ -0,0 +1,428 @@
+-------------------------------------------------------------------
+Fri Sep 18 13:23:21 UTC 2015 - vci...@suse.com
+
+- respond from the destination address taken from the first udp
+  message's ancillary data (bnc#928283)
+  * added tftp-multi-addresses.patch
+
+-------------------------------------------------------------------
+Fri Sep 18 13:22:12 UTC 2015 - vci...@suse.com
+
+- tftp-hpa-0.48-macros-crash.patch:
+  prevent buffer overflow in handling of \x macro (bnc#793883)
+- tftp-hpa-0.48-macros-v6mapped.patch:
+  for \i and \x, expand v6-mapped addresses as native IPv4
+  (bnc#793883)
+- patches come from Michal Kubecek
+
+-------------------------------------------------------------------
+Tue Mar 25 23:35:16 UTC 2014 - crrodrig...@opensuse.org
+
+- drop tftp-hpa-0.43_old-autoconf.diff not needed for any
+  product still in active maintenance.
+- Use correct systemd macros in %pre, %post..
+- config.h must be included *everywhere* (tftp-config_h.patch)
+- tftp.service: 
+   * This service needs to be started after network.target
+   * Use PrivateDevices=yes
+
+-------------------------------------------------------------------
+Thu Apr 18 09:57:36 UTC 2013 - vci...@suse.com
+
+- change ownership of /srv/tftpboot to tftp:tftp, otherwise tftp
+  daemon can't write there (bnc#813226)
+
+-------------------------------------------------------------------
+Thu Feb  7 13:07:03 UTC 2013 - vci...@suse.com
+
+- create capabilites provided by both tftp and atftp
+  (bnc#801481 or bnc#725378)
+
+-------------------------------------------------------------------
+Wed Dec  5 19:54:20 UTC 2012 - dims...@opensuse.org
+
+- Add systemd socket activation units.
+- Change inet-daemon to be recommended only, as we can now also
+  activate by means of systemd sockets.
+
+-------------------------------------------------------------------
+Tue Sep  4 13:09:09 UTC 2012 - vci...@suse.com
+
+- update to 5.2
+  - fixes a breakage with recent Linux kernel versions when a
+    single interface has multiple IP addresses (bnc#774861)
+
+-------------------------------------------------------------------
+Tue Dec 20 20:30:25 UTC 2011 - co...@suse.com
+
+- add autoconf as buildrequire to avoid implicit dependency
+
+-------------------------------------------------------------------
+Fri Nov 11 14:51:55 UTC 2011 - vci...@suse.com
+
+- added rules for SuSEfirewall2 (bnc#729793)
+  thanks to Lukas Ocilka
+
+-------------------------------------------------------------------
+Tue Sep  6 13:01:31 UTC 2011 - vci...@suse.com
+
+- added missing PreReq: pwdutils
+
+-------------------------------------------------------------------
+Fri Jun 24 07:09:50 UTC 2011 - pu...@novell.com
+
+- unbreak tftp by changing to user to run as in tftpd itself,
+  not via xinetd (bnc#682340)
+
+-------------------------------------------------------------------
+Thu Jun 23 12:17:37 UTC 2011 - pu...@novell.com
+
+- update to version-5.1
+  - Add -P option to write a PID file.  Patch by Ferenc Wagner.
+  - Bounce the syslog socket in standalone mode, in case the
+    syslog daemon has been restarted.  Patch by Ferenc Wagner.
+  - Build fixes.
+  - Fix handling of block number wraparound after a successful
+    options negotiation.
+  - Fix a buffer overflow in option parsing.
+- fixes bnc#699714, CVE-2011-2199
+
+-------------------------------------------------------------------
+Sat Dec 11 00:00:00 UTC 2010 - ch...@computersalat.de
+
+- fix spec
+  o added missing path /srv/tftpboot in files section
+
+-------------------------------------------------------------------
+Fri Dec  3 13:51:50 UTC 2010 - pu...@novell.com
+
+- update to version 5.0
+  * Try to on platforms with getaddrinfo() without AI_ADDRCONFIG or
+    AI_CANONNAME.
+  * Implement the "rollover" option, for clients which want block
+    number to rollover to anything other than zero.
+  * Correctly disable PMTU in standalone mode.
+  * Add IPv6 support.  Patch by Karsten Keil.
+  * Support systems with editline instead of readline.
+  * Support long options in the server.
+- drop tftp-hpa-0.43_readline.diff (not needed)
+- drop tftp-hpa-0.46_libedit.patch (solved in upstream)
+- build with readline support
+- clean up specfile
+
+-------------------------------------------------------------------
+Fri Oct 29 23:33:18 UTC 2010 - ch...@computersalat.de
+
+- fix pre
+  o no check before addding group/user (darix)
+- fix files
+  o provide /srv/tftpboot
+
+-------------------------------------------------------------------
+Wed Oct 13 21:05:23 UTC 2010 - ch...@computersalat.de
+
+- add group/user tftp (bnc#472283)
+- set TFTP default DIR to /srv/tftpboot (bnc#248008,507011)
+- added Conflicts atftp, cause of overlapping binaries
+
+-------------------------------------------------------------------
+Fri Oct  1 12:07:50 UTC 2010 - pu...@novell.com
+
+- add tftp-hpa-0.48-tzfix.patch (bnc#630297) 
+
+-------------------------------------------------------------------
+Tue Jun 29 08:57:01 UTC 2010 - pu...@novell.com
+
+- add tftp-hpa-0.49-fortify-strcpy-crash.patch (bnc#617675)
+
+-------------------------------------------------------------------
+Mon Sep  1 14:45:15 CEST 2008 - mrueck...@suse.de
+
+- drop lineedit support again
+- fix build to include %{optflags} with using configure
+
+-------------------------------------------------------------------
+Wed Aug 27 16:20:32 CEST 2008 - o...@suse.de
+
+- do not require autoconf 2.61
+  binutils-devel is not available in 11.0 or earlier
+
+-------------------------------------------------------------------
+Wed Aug  6 16:04:07 CEST 2008 - kk...@suse.de
+
+- Update to current git version with enhanced IPv6 support included
+
+-------------------------------------------------------------------
+Fri Jul 18 17:56:28 CEST 2008 - kk...@suse.de
+
+- Update to git version 0.48 for mainline compatibility; code is
+  still the same but formatting was cleaned up
+- Implement IPv6 (fate #304343)
+
+-------------------------------------------------------------------
+Thu Feb  1 21:05:23 CET 2007 - mrueck...@suse.de
+
+- update to version 0.48:
+  - Unbreak -l -s in the server, which was broken in 0.47.
+- additional changes from 0.47:
+  - Add -L option to the server to run standalone without
+    detaching from the shell.
+  - Parallel make fix.
+
+-------------------------------------------------------------------
+Tue Jan  9 11:37:58 CET 2007 - mrueck...@suse.de
+
+- update to version 0.46:
+  - Minor portability improvements.
+- additional change from 0.45:
+  Add -l (literal) option to the client, to override the special
+  treatment of the colon (:) character as a hostname separator.
+- replaced tftp-hpa-0.43_syntax.diff with tftp-hpa-0.46_colon_check.patch:
+  restore a behavior which was broken with 0.35
+- merged tftp-hpa-0.43_signdness.patch with
+  tftp-hpa-0.43_bcopy_secfix.patch. new patch:
+  tftp-hpa-0.46_bcopy_secfix.patch.
+- added tftp-hpa-0.46_libedit.patch:
+  Build against libedit to enable lineediting support.
+
+-------------------------------------------------------------------
+Thu Dec  7 04:09:55 CET 2006 - mrueck...@suse.de
+
+- update to version 0.44:
+  - Allow the client to specify a range of local port numbers, just
+    like the server can.
+  - Fix sending SIGHUP to update the regular expression table.
+
+-------------------------------------------------------------------
+Fri Oct 20 19:04:32 CEST 2006 - mrueck...@suse.de
++++ 231 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:13.2:Update/.tftp.4032.new/tftp.changes

New:
----
  tftp-config_h.patch
  tftp-hpa-0.43_include_sys_params.patch
  tftp-hpa-0.46_colon_check.patch
  tftp-hpa-0.48-macros-crash.patch
  tftp-hpa-0.48-macros-v6mapped.patch
  tftp-hpa-0.48-tzfix.patch
  tftp-hpa-0.49-fortify-strcpy-crash.patch
  tftp-hpa-5.2.tar.bz2
  tftp-multi-addresses.patch
  tftp.changes
  tftp.fw
  tftp.service
  tftp.socket
  tftp.spec
  tftp.xinetd

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ tftp.spec ++++++
#
# spec file for package tftp
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services

Name:           tftp
Version:        5.2
Release:        0
Summary:        Trivial File Transfer Protocol (TFTP)
License:        BSD-3-Clause
Group:          Productivity/Networking/Ftp/Clients
Url:            http://www.kernel.org/pub/software/network/tftp/
Source:         
http://www.kernel.org/pub/software/network/tftp/tftp-hpa-%{version}.tar.bz2
Source1:        tftp.xinetd
Source2:        tftp.fw
Source3:        tftp.service
Source4:        tftp.socket
Patch0:         tftp-hpa-0.43_include_sys_params.patch
Patch1:         tftp-hpa-0.46_colon_check.patch
Patch4:         tftp-hpa-0.49-fortify-strcpy-crash.patch
Patch5:         tftp-hpa-0.48-tzfix.patch
Patch43:        tftp-config_h.patch
Patch6:         tftp-multi-addresses.patch
Patch7:         tftp-hpa-0.48-macros-crash.patch
Patch8:         tftp-hpa-0.48-macros-v6mapped.patch
Provides:       tftp(client)
Provides:       tftp(server)
PreReq:         pwdutils
BuildRequires:  autoconf
BuildRequires:  pwdutils
BuildRequires:  tcpd-devel
BuildRequires:  pkgconfig(systemd)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1110
BuildRequires:  binutils-devel
%endif
Recommends:     inet-daemon
Requires:       netcfg
Conflicts:      atftp
%{?systemd_requires}

%description
The Trivial File Transfer Protocol (TFTP) is normally used only for
booting diskless workstations and for getting or saving network
component configuration files.

%prep
%setup -n %{name}-hpa-%{version}
%patch0
%patch1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7
%patch8
%if 0%{?suse_version} < 1030
%patch42
%endif
%patch43 -p1
%build
autoreconf -fi
%configure \
  --enable-largefile \
  --with-tcpwrappers \
  --with-remap \
  --with-ipv6
make

%install
%makeinstall INSTALLROOT=%{buildroot} MANDIR="%{_mandir}"
install -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/xinetd.d/tftp
mkdir -p $RPM_BUILD_ROOT/%{_fwdefdir}
install -m 644 %SOURCE2 $RPM_BUILD_ROOT/%{_fwdefdir}/tftp
install -d -m 0750 %{buildroot}/srv/tftpboot

# Install systemd unit / socket (As an alternativ to xinetd activation)
install -d %{buildroot}%{_unitdir}
install -m 0644 %{S:3} %{S:4} %{buildroot}%{_unitdir}

%pre
# This group/user is shared with atftp, so please
# keep this in sync with atftp.spec
# add group
%{_sbindir}/groupadd -r tftp 2>/dev/null || :
# add user
%{_sbindir}/useradd -c "TFTP account" -d /srv/tftpboot -G tftp -g tftp \
  -r -s /bin/false tftp 2>/dev/null || :

%service_add_pre %{name}.service %{name}.socket

%post
%service_add_post %{name}.service %{name}.socket

%preun
%service_del_preun %{name}.service %{name}.socket

%postun
%service_del_postun %{name}.service %{name}.socket

%clean
rm -rf %{buildroot};

%files
%defattr(-,root,root)
%doc README README.security tftpd/sample.rules
%{_bindir}/tftp
%{_sbindir}/in.tftpd
%{_mandir}/man1/tftp.1.gz
%{_mandir}/man8/in.tftpd.8.gz
%{_mandir}/man8/tftpd.8.gz
%{_unitdir}/tftp.service
%{_unitdir}/tftp.socket
%config(noreplace) %{_sysconfdir}/xinetd.d/tftp
%config %{_fwdefdir}/tftp
%dir %attr(0750,tftp,tftp) /srv/tftpboot

%changelog
++++++ tftp-config_h.patch ++++++
--- tftp-hpa-5.2.orig/MCONFIG.in
+++ tftp-hpa-5.2/MCONFIG.in
@@ -51,7 +51,7 @@ INSTALL_DATA    = @INSTALL_DATA@
 
 # Compiler and compiler flags
 CC      = @CC@
-CFLAGS  = @CFLAGS@ -I$(SRCROOT)
+CFLAGS  = @CFLAGS@ -I$(SRCROOT) -include config.h
 
 # Link flags
 LDFLAGS = @LDFLAGS@
--- tftp-hpa-5.2.orig/tftp/Makefile
+++ tftp-hpa-5.2/tftp/Makefile
@@ -9,7 +9,7 @@ OBJS = tftp.$(O) main.$(O)
 all: tftp$(X) tftp.1
 
 tftp$(X): $(OBJS)
-       $(CC) $(LDFLAGS) $^ $(TFTP_LIBS) -o $@
+       $(CC) $(CFLAGS) $(LDFLAGS) $^ $(TFTP_LIBS) -o $@
 
 $(OBJS): ../common/tftpsubs.h
 
--- tftp-hpa-5.2.orig/tftpd/Makefile
+++ tftp-hpa-5.2/tftpd/Makefile
@@ -9,7 +9,7 @@ OBJS = tftpd.$(O) recvfrom.$(O) misc.$(O
 all: tftpd$(X) tftpd.8
 
 tftpd$(X): $(OBJS)
-       $(CC) $(LDFLAGS) $^ $(TFTPD_LIBS) -o $@
+       $(CC) $(CFLAGS) $(LDFLAGS) $^ $(TFTPD_LIBS) -o $@
 
 $(OBJS): ../common/tftpsubs.h
 
++++++ tftp-hpa-0.43_include_sys_params.patch ++++++
Index: tftp/main.c
===================================================================
--- tftp/main.c.orig
+++ tftp/main.c
@@ -39,6 +39,7 @@
  * TFTP User Program -- Command Interface.
  */
 #include <sys/file.h>
+#include <sys/param.h>
 #include <ctype.h>
 #ifdef WITH_READLINE
 #include <readline/readline.h>
++++++ tftp-hpa-0.46_colon_check.patch ++++++
Index: tftp/main.c
===================================================================
--- tftp/main.c.orig
+++ tftp/main.c
@@ -308,7 +308,7 @@ int main(int argc, char *argv[])
 
     bsd_signal(SIGINT, intr);
 
-    if (peerargc) {
+    if (peerargc > 1) {
         /* Set peer */
         if (sigsetjmp(toplevel, 1) != 0)
             exit(EX_NOHOST);
@@ -634,11 +634,14 @@ void get(int argc, char *argv[])
         return;
     }
     if (!connected) {
-        for (n = 1; n < argc; n++)
+        for (n = 1; n < argc; n++) {
             if (literal || strchr(argv[n], ':') == 0) {
                 getusage(argv[0]);
                 return;
             }
+            if (argc == 3)
+                break;
+        }
     }
     for (n = 1; n < argc; n++) {
         src = strchr(argv[n], ':');
++++++ tftp-hpa-0.48-macros-crash.patch ++++++
diff -up tftpd/tftpd.c.orig-len tftpd/tftpd.c
--- tftpd/tftpd.c.orig-len      2012-12-11 16:31:29.658043427 +0100
+++ tftpd/tftpd.c       2012-12-11 16:32:22.234018253 +0100
@@ -1287,24 +1287,24 @@ static int rewrite_macros(char macro, ch
             return strlen(p);
 
     case 'x':
-        if (output) {
-            if (from.sa.sa_family == AF_INET) {
+        if (from.sa.sa_family == AF_INET) {
+            if (output)
                 sprintf(output, "%08lX",
                     (unsigned long)ntohl(from.si.sin_addr.s_addr));
-                l = 8;
+            l = 8;
 #ifdef HAVE_IPV6
-            } else {
-                unsigned char *c = (unsigned char *)SOCKADDR_P(&from);
-                p = tb;
-                for (l = 0; l < 16; l++) {
-                    sprintf(p, "%02X", *c);
-                    c++;
-                    p += 2;
-                }
+        } else {
+            unsigned char *c = (unsigned char *)SOCKADDR_P(&from);
+            p = tb;
+            for (l = 0; l < 16; l++) {
+                sprintf(p, "%02X", *c);
+                c++;
+                p += 2;
+            }
+            if (output)
                 strcpy(output, tb);
-                l = strlen(tb);
+            l = strlen(tb);
 #endif
-            }
         }
         return l;
 
++++++ tftp-hpa-0.48-macros-v6mapped.patch ++++++
diff -up tftpd/tftpd.c.orig-v6map tftpd/tftpd.c
--- tftpd/tftpd.c.orig-v6map    2012-12-11 17:06:53.156624476 +0100
+++ tftpd/tftpd.c       2012-12-11 17:13:08.705298341 +0100
@@ -1263,6 +1263,21 @@ static void do_opt(const char *opt, cons
 
 #ifdef WITH_REGEX
 
+#ifdef HAVE_IPV6
+static inline int is_v6_mapped(const union sock_addr* pa)
+{
+    const char v6_mapped[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0xFF, 0xFF };
+
+    if (from.sa.sa_family != AF_INET6)
+        return 0;
+    if (memcmp(&pa->s6.sin6_addr.s6_addr, v6_mapped, sizeof(v6_mapped)))
+        return 0;
+
+    return 1;
+}
+#endif
+
 /*
  * This is called by the remap engine when it encounters macros such
  * as \i.  It should write the output in "output" if non-NULL, and
@@ -1274,10 +1289,20 @@ static int rewrite_macros(char macro, ch
 {
     char *p, tb[INET6_ADDRSTRLEN];
     int l=0;
+    const union sock_addr *pfrom = &from;
+
+#ifdef HAVE_IPV6
+    union sock_addr ipv4_from;
+    if (is_v6_mapped(&from)) {
+        ipv4_from.si.sin_family = AF_INET;
+        memcpy(&ipv4_from.si.sin_addr, from.s6.sin6_addr.s6_addr + 12, 4);
+        pfrom = &ipv4_from;
+    }
+#endif
 
     switch (macro) {
     case 'i':
-        p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from),
+        p = (char *)inet_ntop(pfrom->sa.sa_family, SOCKADDR_P(pfrom),
                               tb, INET6_ADDRSTRLEN);
         if (output && p)
             strcpy(output, p);
@@ -1287,14 +1312,14 @@ static int rewrite_macros(char macro, ch
             return strlen(p);
 
     case 'x':
-        if (from.sa.sa_family == AF_INET) {
+        if (pfrom->sa.sa_family == AF_INET) {
             if (output)
                 sprintf(output, "%08lX",
-                    (unsigned long)ntohl(from.si.sin_addr.s_addr));
+                    (unsigned long)ntohl(pfrom->si.sin_addr.s_addr));
             l = 8;
 #ifdef HAVE_IPV6
         } else {
-            unsigned char *c = (unsigned char *)SOCKADDR_P(&from);
+            unsigned char *c = (unsigned char *)SOCKADDR_P(pfrom);
             p = tb;
             for (l = 0; l < 16; l++) {
                 sprintf(p, "%02X", *c);
++++++ tftp-hpa-0.48-tzfix.patch ++++++
Index: tftp-hpa-5.1/tftpd/tftpd.c
===================================================================
--- tftp-hpa-5.1.orig/tftpd/tftpd.c
+++ tftp-hpa-5.1/tftpd/tftpd.c
@@ -384,6 +384,14 @@ int main(int argc, char **argv)
     const char *pidfile = NULL;
     u_short tp_opcode;
 
+    time_t my_time = 0;
+    struct tm* p_tm;
+    char envtz[10];
+    my_time = time(NULL);
+    p_tm = localtime(&my_time);
+    snprintf(envtz, sizeof(envtz) - 1, "UTC%+d", (p_tm->tm_gmtoff * -1)/3600);
+    setenv("TZ", envtz, 0);
+
     /* basename() is way too much of a pain from a portability standpoint */
 
     p = strrchr(argv[0], '/');
++++++ tftp-hpa-0.49-fortify-strcpy-crash.patch ++++++
Index: tftp-hpa-git-0.48/tftp/tftp.c
===================================================================
--- tftp-hpa-git-0.48.orig/tftp/tftp.c  2008-07-31 12:46:57.000000000 +0200
+++ tftp-hpa-git-0.48/tftp/tftp.c       2010-06-29 12:14:48.000000000 +0200
@@ -279,15 +279,16 @@ makerequest(int request, const char *nam
             struct tftphdr *tp, const char *mode)
 {
     char *cp;
+    size_t len;
 
     tp->th_opcode = htons((u_short) request);
     cp = (char *)&(tp->th_stuff);
-    strcpy(cp, name);
-    cp += strlen(name);
-    *cp++ = '\0';
-    strcpy(cp, mode);
-    cp += strlen(mode);
-    *cp++ = '\0';
+    len = strlen(name) + 1;
+    memcpy(cp, name, len);
+    cp += len;
+    len = strlen(mode) + 1;
+    memcpy(cp, mode, len);
+    cp += len;
     return (cp - (char *)tp);
 }
 
++++++ tftp-multi-addresses.patch ++++++
Index: tftp-hpa-5.2/tftpd/recvfrom.c
===================================================================
--- tftp-hpa-5.2.orig/tftpd/recvfrom.c  2015-04-30 11:04:45.994568260 +0200
+++ tftp-hpa-5.2/tftpd/recvfrom.c       2015-05-14 16:02:28.104576816 +0200
@@ -148,17 +148,17 @@ myrecvfrom(int s, void *buf, int len, un
 #endif
 
     /* Try to enable getting the return address */
+    /* Before the first packet we don't know the address family of the
+     * connection, so we set both ipv4 and ipv6 socket options
+     */
 #ifdef IP_RECVDSTADDR
-    if (from->sa_family == AF_INET)
         setsockopt(s, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on));
 #endif
 #ifdef IP_PKTINFO
-    if (from->sa_family == AF_INET)
         setsockopt(s, IPPROTO_IP, IP_PKTINFO, &on, sizeof(on));
 #endif
 #ifdef HAVE_IPV6
 #ifdef IPV6_RECVPKTINFO
-    if (from->sa_family == AF_INET6)
         setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on));
 #endif
 #endif
@@ -190,7 +190,7 @@ myrecvfrom(int s, void *buf, int len, un
         for (cmptr = CMSG_FIRSTHDR(&msg); cmptr != NULL;
              cmptr = CMSG_NXTHDR(&msg, cmptr)) {
 
-            if (from->sa_family == AF_INET) {
+            if (cmptr->cmsg_level == IPPROTO_IP) {
                 myaddr->sa.sa_family = AF_INET;
 #ifdef IP_RECVDSTADDR
                 if (cmptr->cmsg_level == IPPROTO_IP &&
@@ -209,15 +209,26 @@ myrecvfrom(int s, void *buf, int len, un
                            sizeof(struct in_addr));
                 }
 #endif
+                if (from->sa_family == AF_INET6) {
+                    from->sa_family = AF_INET;
+                    /* Unmap the ipv4 address from ipv6.
+                     * The ipv6 mapped address is in format:
+                     * 10 0x0 bytes, 2 0xff bytes, 4 bytes of the ipv4 address
+                     * so we cut out the first 12 bytes of the ipv6 and
+                     * interpret the rest as the ipv4
+                     */
+                    ((struct sockaddr_in *)from)->sin_addr = *((struct in_addr 
*)(((struct sockaddr_in6 *)from)->sin6_addr.s6_addr+12));
+                }
             }
 #ifdef HAVE_IPV6
-            else if (from->sa_family == AF_INET6) {
+            else if (cmptr->cmsg_level == IPPROTO_IPV6) {
                 myaddr->sa.sa_family = AF_INET6;
 #ifdef IP6_RECVDSTADDR
                 if (cmptr->cmsg_level == IPPROTO_IPV6 &&
-                    cmptr->cmsg_type == IPV6_RECVDSTADDR )
+                    cmptr->cmsg_type == IPV6_RECVDSTADDR ) {
                     memcpy(&myaddr->s6.sin6_addr, CMSG_DATA(cmptr),
                            sizeof(struct in6_addr));
+                }
 #endif
 
 #ifdef HAVE_STRUCT_IN6_PKTINFO
++++++ tftp.fw ++++++
## Name: TFTP Server
## Description: Opens ports for tftp service.

# space separated list of allowed UDP ports
UDP="tftp"
++++++ tftp.service ++++++
[Unit]
Description=Tftp Server
Wants=network.target
After=network.target

[Service]
ExecStart=/usr/sbin/in.tftpd -u tftp -s /srv/tftpboot
StandardInput=socket
PrivateDevices=yes
++++++ tftp.socket ++++++
[Unit]
Description=Tftp Server Activation Socket

[Socket]
ListenDatagram=69

[Install]
WantedBy=sockets.target

++++++ tftp.xinetd ++++++
# default: off
# description: tftp service is provided primarily for booting or when a \
#       router need an upgrade. Most sites run this only on machines acting as \
#       "boot servers".
#       The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        flags                   = IPv6 IPv4
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -u tftp -s /srv/tftpboot
#       per_source              = 11
#       cps                     = 100 2
        disable                 = yes
}

Reply via email to