Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Feb 2013 19:19:02 GMT
From:      Alex Gingerich <alexg@g4.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/176358: /net/freebsd-tftp Incorrect TFTP Behavior with Secondary IP Address
Message-ID:  <201302221919.r1MJJ21o069713@red.freebsd.org>
Resent-Message-ID: <201302221920.r1MJK0Ih084637@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         176358
>Category:       ports
>Synopsis:       /net/freebsd-tftp Incorrect TFTP Behavior with Secondary IP Address
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 22 19:20:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Alex Gingerich
>Release:        FreeBSD 9.0-RELEASE
>Organization:
G4 Communications
>Environment:
FreeBSD ns1.fibercast.net 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:15:25 UTC 2012     root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
Initially, I noticed a quirk when using the default TFTP server. This is on a machine that has two IP addresses. They are configured as follows:

ifconfig_rl0=" inet 192.168.20.19 netmask 255.255.255.240"
ifconfig_rl0_alias0="192.168.20.18 netmask 255.255.255.240"


The first quirk I noticed, was that when a TFTP request comes in to 192.168.20.18, the tftp server sends the response out 192.168.20.19. This causes an inability to fetch from TFTP via the 192.168.20.18 address in NAT environments.

That in itself seems to be a bit of a problem... However, the behavior gets a little stranger when specifying RFC2348 blocksizes.

When I specify a blocksize of 1448, and request a file from 192.168.20.18, the TFTP server responds from 192.168.20.19, and immediatly starts sending the file in the first response packet.

However, when I specify a blocksize of 1448, but request from 192.168.20.19, the tftp server sends back an OACK in the first packet, waits for an acknowledgement from the client, and then begins sending a file. 
>How-To-Repeat:
1) Set up a machine with two IP addresses, in the same subnet, on the same interfaces, and TFTP configured.
2) Get a TFTP file from both the primary and alias IP, both with and without the blocksize option.
3) Compare the resulting packet captures. 
>Fix:


Patch attached with submission follows:

No.     Time        Source                Destination           Protocol Info
    268 222.919651  10.100.1.34          192.168.20.18         TFTP     Read Request, File: 7by2.cfg\000, Transfer type: octet\000, blksize\000=1448\000

Frame 268: 72 bytes on wire (576 bits), 72 bytes captured (576 bits)
Ethernet II, Src: Cabletro_0c:92:1a (00:e0:63:0c:92:1a), Dst: RealtekS_bb:a3:a1 (00:e0:4c:bb:a3:a1)
Internet Protocol, Src: 10.100.1.34 (10.100.1.34), Dst: 192.168.20.18 (192.168.20.18)
User Datagram Protocol, Src Port: 57202 (57202), Dst Port: tftp (69)
Trivial File Transfer Protocol

No.     Time        Source                Destination           Protocol Info
    269 222.942042  192.168.20.19         10.100.1.34          UDP      Source port: 58753  Destination port: 57202

Frame 269: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
Ethernet II, Src: RealtekS_bb:a3:a1 (00:e0:4c:bb:a3:a1), Dst: Cabletro_0c:92:1a (00:e0:63:0c:92:1a)
Internet Protocol, Src: 192.168.20.19 (192.168.20.19), Dst: 10.100.1.34 (10.100.1.34)
User Datagram Protocol, Src Port: 58753 (58753), Dst Port: 57202 (57202)
Data (15 bytes)

0000  00 06 62 6c 6b 73 69 7a 65 00 31 34 34 38 00      ..blksize.1448.

No.     Time        Source                Destination           Protocol Info
    270 222.948184  10.100.1.34          192.168.20.19         UDP      Source port: 57202  Destination port: 58753

Frame 270: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
Ethernet II, Src: Cabletro_0c:92:1a (00:e0:63:0c:92:1a), Dst: RealtekS_bb:a3:a1 (00:e0:4c:bb:a3:a1)
Internet Protocol, Src: 10.100.1.34 (10.100.1.34), Dst: 192.168.20.19 (192.168.20.19)
User Datagram Protocol, Src Port: 57202 (57202), Dst Port: 58753 (58753)
Data (4 bytes)

0000  00 04 00 00                                       ....

No.     Time        Source                Destination           Protocol Info
    271 222.965259  192.168.20.19         10.100.1.34          UDP      Source port: 58753  Destination port: 57202

Frame 271: 122 bytes on wire (976 bits), 122 bytes captured (976 bits)
Ethernet II, Src: RealtekS_bb:a3:a1 (00:e0:4c:bb:a3:a1), Dst: Cabletro_0c:92:1a (00:e0:63:0c:92:1a)
Internet Protocol, Src: 192.168.20.19 (192.168.20.19), Dst: 10.100.1.34 (10.100.1.34)
User Datagram Protocol, Src Port: 58753 (58753), Dst Port: 57202 (57202)
Data (80 bytes)

0000  00 03 00 01 03 01 01 04 1f 01 01 01 02 04 00 6a   ...............j
0010  cf c0 03 04 00 1f 40 00 04 01 02 05 04 00 00 00   ......@.........
0020  00 06 02 00 00 07 01 00 12 01 01 06 10 7d 52 14   .............}R.
0030  b8 27 c7 58 a6 90 4a 62 55 70 4a fb 8d 07 10 7c   .'.X..JbUpJ....|
0040  13 52 63 04 7d ce 11 37 84 01 e1 62 41 8f 85 ff   .Rc.}..7...bA...

No.     Time        Source                Destination           Protocol Info
    272 222.970211  10.100.1.34          192.168.20.19         UDP      Source port: 57202  Destination port: 58753

Frame 272: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
Ethernet II, Src: Cabletro_0c:92:1a (00:e0:63:0c:92:1a), Dst: RealtekS_bb:a3:a1 (00:e0:4c:bb:a3:a1)
Internet Protocol, Src: 10.100.1.34 (10.100.1.34), Dst: 192.168.20.19 (192.168.20.19)
User Datagram Protocol, Src Port: 57202 (57202), Dst Port: 58753 (58753)
Data (4 bytes)

0000  00 04 00 01                                       ....

No.     Time        Source                Destination           Protocol Info
    274 235.567120  10.100.1.34          192.168.20.19         TFTP     Read Request, File: 7by2.cfg\000, Transfer type: octet\000, blksize\000=1448\000

Frame 274: 72 bytes on wire (576 bits), 72 bytes captured (576 bits)
Ethernet II, Src: Cabletro_0c:92:1a (00:e0:63:0c:92:1a), Dst: RealtekS_bb:a3:a1 (00:e0:4c:bb:a3:a1)
Internet Protocol, Src: 10.100.1.34 (10.100.1.34), Dst: 192.168.20.19 (192.168.20.19)
User Datagram Protocol, Src Port: 56802 (56802), Dst Port: tftp (69)
Trivial File Transfer Protocol

No.     Time        Source                Destination           Protocol Info
    275 235.589588  192.168.20.19         10.100.1.34          TFTP     Option Acknowledgement, blksize\000=1448\000

Frame 275: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
Ethernet II, Src: RealtekS_bb:a3:a1 (00:e0:4c:bb:a3:a1), Dst: Cabletro_0c:92:1a (00:e0:63:0c:92:1a)
Internet Protocol, Src: 192.168.20.19 (192.168.20.19), Dst: 10.100.1.34 (10.100.1.34)
User Datagram Protocol, Src Port: 30673 (30673), Dst Port: 56802 (56802)
Trivial File Transfer Protocol

No.     Time        Source                Destination           Protocol Info
    276 235.595595  10.100.1.34          192.168.20.19         TFTP     Acknowledgement, Block: 0

Frame 276: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
Ethernet II, Src: Cabletro_0c:92:1a (00:e0:63:0c:92:1a), Dst: RealtekS_bb:a3:a1 (00:e0:4c:bb:a3:a1)
Internet Protocol, Src: 10.100.1.34 (10.100.1.34), Dst: 192.168.20.19 (192.168.20.19)
User Datagram Protocol, Src Port: 56802 (56802), Dst Port: 30673 (30673)
Trivial File Transfer Protocol

No.     Time        Source                Destination           Protocol Info
    277 235.596053  192.168.20.19         10.100.1.34          TFTP     Data Packet, Block: 1 (last)

Frame 277: 122 bytes on wire (976 bits), 122 bytes captured (976 bits)
Ethernet II, Src: RealtekS_bb:a3:a1 (00:e0:4c:bb:a3:a1), Dst: Cabletro_0c:92:1a (00:e0:63:0c:92:1a)
Internet Protocol, Src: 192.168.20.19 (192.168.20.19), Dst: 10.100.1.34 (10.100.1.34)
User Datagram Protocol, Src Port: 30673 (30673), Dst Port: 56802 (56802)
Trivial File Transfer Protocol

No.     Time        Source                Destination           Protocol Info
    278 235.601436  10.100.1.34          192.168.20.19         TFTP     Acknowledgement, Block: 1

Frame 278: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
Ethernet II, Src: Cabletro_0c:92:1a (00:e0:63:0c:92:1a), Dst: RealtekS_bb:a3:a1 (00:e0:4c:bb:a3:a1)
Internet Protocol, Src: 10.100.1.34 (10.100.1.34), Dst: 192.168.20.19 (192.168.20.19)
User Datagram Protocol, Src Port: 56802 (56802), Dst Port: 30673 (30673)
Trivial File Transfer Protocol


>Release-Note:
>Audit-Trail:
>Unformatted:



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