[Pidgin] #12657: Bonjour plugin advertises wrong port number

Pidgin trac at pidgin.im
Mon Sep 20 10:56:02 EDT 2010


#12657: Bonjour plugin advertises wrong port number
---------------------+------------------------------------------------------
 Reporter:  jk       |     Owner:  datallah
     Type:  defect   |    Status:  new     
Component:  Bonjour  |   Version:  2.7.3   
 Keywords:           |  
---------------------+------------------------------------------------------
 It looks like the bonjour plugin advertises the wrong port number in its
 mDNS publication.

 In my settings, I have pidgin configured to use 5298 as the bonjour port.
 When pidgin starts, it creates an '''IPv6''' tcp socket listening on this
 port:

 {{{
 1204  bind(9, {sa_family=AF_INET6, sin6_port=htons(5298),
 inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0},
 28) = 0
 1204  listen(9, 10)                     = 0
 }}}

 this succeeds, which is good.

 Then, it (unnecessarily) tries to listen on '''IPv4''' tcp port 5298:

 {{{
 1204  socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 16
 1204  bind(16, {sa_family=AF_INET, sin_port=htons(5298),
 sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EADDRINUSE (Address already in
 use)
 }}}

 Unnecessary because the previous socket will also accept IPv4 tcp
 connections. The bind() fails, as the previous socket is using this port
 number.

 Because of this failure, pidgin now tries to listen on a different IPv4
 port (allowing the OS to allocate the port number):

 {{{
 1204  bind(16, {sa_family=AF_INET, sin_port=htons(0),
 sin_addr=inet_addr("0.0.0.0")}, 16) = 0
 }}}

 This bind succeeds, so avahi now has two sockets that will accept IPv4 tcp
 connections.

 Usually, this would be fine (if not a little redundant), except that the
 mDNS advertisement that pidgin announces the ''second'' (randomly-
 allocated) port number in the mDNS record for the Bonjour presence. This
 means that the configured port number is not published, and so never used.

 This makes configuring a firewall difficult - the port number will change
 on every invocation of pidgin.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/12657>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list