Skip to content

HP L7600/L7650 and Samba/FreeBSD

This all-in-one printer can scan to a Windows share. I have a Windows share hosted by Samba on FreeBSD.

Unfortunately, the printer/scanner intermittently (and pretty often) says it can’t find my FreeBSD machine when I–or more importantly my wife tries to scan a document.

I went pretty deep on this and took a packet capture:

No. Time Source Destination Protocol Length Info
1 0.000000 192.168.1.6 192.168.1.8 TCP 78 37397 > microsoft-ds [SYN] Seq=0 Win=8688 Len=0 MSS=1460 WS=1 SACK_PERM=1 TSval=172908768 TSecr=0
2 0.000051 192.168.1.8 192.168.1.6 TCP 74 microsoft-ds > 37397 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1460 WS=8 SACK_PERM=1 TSval=2914822213 TSecr=172908768
3 0.000311 192.168.1.6 192.168.1.8 TCP 66 37397 > microsoft-ds [ACK] Seq=1 Ack=1 Win=8688 Len=0 TSval=172908768 TSecr=2914822213
4 0.000371 192.168.1.8 192.168.1.6 TCP 66 [TCP Window Update] microsoft-ds > 37397 [ACK] Seq=1 Ack=1 Win=131768 Len=0 TSval=2914822214 TSecr=172908768
5 0.001279 192.168.1.6 192.168.1.8 TCP 66 37397 > microsoft-ds [FIN, PSH, ACK] Seq=1 Ack=1 Win=8688 Len=0 TSval=172908768 TSecr=2914822214
6 0.001299 192.168.1.8 192.168.1.6 TCP 66 microsoft-ds > 37397 [ACK] Seq=1 Ack=2 Win=131768 Len=0 TSval=2914822219 TSecr=172908768
7 0.002105 192.168.1.6 192.168.1.8 TCP 78 42026 > netbios-ssn [SYN] Seq=0 Win=8688 Len=0 MSS=1460 WS=1 SACK_PERM=1 TSval=172908768 TSecr=0
8 0.002119 192.168.1.8 192.168.1.6 TCP 54 netbios-ssn > 42026 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
9 0.003119 192.168.1.6 192.168.1.255 NBNS 92 Name query NB SERVER
10 0.003465 192.168.1.8 192.168.1.6 NBNS 104 Name query response NB 192.168.1.8
11 0.004313 192.168.1.6 192.168.1.8 TCP 78 37032 > microsoft-ds [SYN] Seq=0 Win=8688 Len=0 MSS=1460 WS=1 SACK_PERM=1 TSval=172908768 TSecr=0
12 0.004341 192.168.1.8 192.168.1.6 TCP 74 microsoft-ds > 37032 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1460 WS=8 SACK_PERM=1 TSval=2914321147 TSecr=172908768
13 0.005036 192.168.1.6 192.168.1.8 TCP 66 37032 > microsoft-ds [ACK] Seq=1 Ack=1 Win=8688 Len=0 TSval=172908768 TSecr=2914321147
14 0.005083 192.168.1.8 192.168.1.6 TCP 66 [TCP Window Update] microsoft-ds > 37032 [ACK] Seq=1 Ack=1 Win=131768 Len=0 TSval=2914321151 TSecr=172908768
15 0.005413 192.168.1.6 192.168.1.8 TCP 66 37032 > microsoft-ds [FIN, PSH, ACK] Seq=1 Ack=1 Win=8688 Len=0 TSval=172908768 TSecr=2914321151
16 0.005433 192.168.1.8 192.168.1.6 TCP 66 microsoft-ds > 37032 [ACK] Seq=1 Ack=2 Win=131768 Len=0 TSval=2914321153 TSecr=172908768
17 0.029184 192.168.1.8 192.168.1.6 TCP 66 microsoft-ds > 37397 [FIN, ACK] Seq=1 Ack=2 Win=131768 Len=0 TSval=2914822358 TSecr=172908768
18 0.029224 192.168.1.8 192.168.1.6 TCP 66 microsoft-ds > 37397 [FIN, ACK] Seq=1 Ack=2 Win=131768 Len=0 TSval=2914822358 TSecr=172908768
19 0.029246 192.168.1.8 192.168.1.6 TCP 66 microsoft-ds > 37032 [FIN, ACK] Seq=1 Ack=2 Win=131768 Len=0 TSval=2914321272 TSecr=172908768
20 0.029260 192.168.1.8 192.168.1.6 TCP 66 microsoft-ds > 37032 [FIN, ACK] Seq=1 Ack=2 Win=131768 Len=0 TSval=2914321272 TSecr=172908768
21 0.093285 192.168.1.6 192.168.1.8 TCP 66 37397 > microsoft-ds [ACK] Seq=2 Ack=2 Win=8687 Len=0 TSval=172908785 TSecr=2914822358
22 0.093670 192.168.1.6 192.168.1.8 TCP 66 [TCP Dup ACK 21#1] 37397 > microsoft-ds [ACK] Seq=2 Ack=2 Win=8687 Len=0 TSval=172908785 TSecr=2914822358
23 0.093700 192.168.1.8 192.168.1.6 TCP 54 microsoft-ds > 37397 [RST] Seq=2 Win=0 Len=0
24 0.094072 192.168.1.6 192.168.1.8 TCP 66 37032 > microsoft-ds [ACK] Seq=2 Ack=2 Win=8687 Len=0 TSval=172908785 TSecr=2914321272
25 0.094478 192.168.1.6 192.168.1.8 TCP 66 [TCP Dup ACK 24#1] 37032 > microsoft-ds [ACK] Seq=2 Ack=2 Win=8687 Len=0 TSval=172908785 TSecr=2914321272
26 0.094495 192.168.1.8 192.168.1.6 TCP 54 microsoft-ds > 37032 [RST] Seq=2 Win=0 Len=0
27 0.095211 192.168.1.6 192.168.1.8 TCP 78 41297 > netbios-ssn [SYN] Seq=0 Win=8688 Len=0 MSS=1460 WS=1 SACK_PERM=1 TSval=172908785 TSecr=0
28 0.095223 192.168.1.8 192.168.1.6 TCP 54 netbios-ssn > 41297 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
29 3.723899 192.168.1.6 192.168.1.8 TCP 78 41299 > microsoft-ds [SYN] Seq=0 Win=8688 Len=0 MSS=1460 WS=1 SACK_PERM=1 TSval=172911692 TSecr=0
30 3.723940 192.168.1.8 192.168.1.6 TCP 74 microsoft-ds > 41299 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1460 WS=8 SACK_PERM=1 TSval=748713777 TSecr=172911692
31 3.724734 192.168.1.6 192.168.1.8 TCP 66 41299 > microsoft-ds [ACK] Seq=1 Ack=1 Win=8688 Len=0 TSval=172911692 TSecr=748713777
32 3.724789 192.168.1.8 192.168.1.6 TCP 66 [TCP Window Update] microsoft-ds > 41299 [ACK] Seq=1 Ack=1 Win=131768 Len=0 TSval=748713781 TSecr=172911692
33 3.725582 192.168.1.6 192.168.1.8 TCP 66 41299 > microsoft-ds [FIN, PSH, ACK] Seq=1 Ack=1 Win=8688 Len=0 TSval=172911692 TSecr=748713781
34 3.725623 192.168.1.8 192.168.1.6 TCP 66 microsoft-ds > 41299 [ACK] Seq=1 Ack=2 Win=131768 Len=0 TSval=748713786 TSecr=172911692
35 3.726713 192.168.1.6 192.168.1.8 TCP 78 34127 > netbios-ssn [SYN] Seq=0 Win=8688 Len=0 MSS=1460 WS=1 SACK_PERM=1 TSval=172911692 TSecr=0
36 3.726749 192.168.1.8 192.168.1.6 TCP 54 netbios-ssn > 34127 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
37 3.727577 192.168.1.6 192.168.1.255 NBNS 92 Name query NB SERVER
38 3.728030 192.168.1.8 192.168.1.6 NBNS 104 Name query response NB 192.168.1.8
39 3.728393 192.168.1.8 192.168.1.6 NBNS 104 Name query response NB 192.168.1.8
40 3.728788 192.168.1.6 192.168.1.8 ICMP 70 Destination unreachable (Port unreachable)

The HP printer/scanner for some reason disconnects the TCP session right after it connects (right after the 3-way handshake) with a FIN/PSH/ACK. It starts out trying to connect on port 445 and then disconnects–as far as I can tell for no reason. My guess is that a stale thread exists that doesn’t get cleaned up, and that thread is handling the new connection (when it shouldn’t be). The thread doesn’t know what to do with it, so it closes the connection.

I’ve also seen that immediately after this happens, a new connection is attempted on port 139 (which is a legacy SMB port). This connection goes unanswered by FreeBSD because I had a line in smb.conf that says:


smb ports = 445

Which means it only listens on port 445, not the legacy 139. This was done supposedly to get rid of getpeername errors in the logs. I removed this line, and I can’t say that the HP all-in-one scans successfully 100% of the time, but it is certainly more often. My guess is that when the HP attempts both ports 445 and ports 139 (and Samba listens to both), it increases the probability that new thread is created to handle the connection and the error doesn’t occur as often.

Be the first to like.

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*