Browse code

core: don't force a socket if the dst af is different

- get_send_socket() will now ignore a forced send socket if the destination
address family is different from the forced socket (e.g. force ipv6 but
attempt to send to ipv4). A non-obvious example of a scenario triggering
this bug is registering over ipv4 an ipv6 contact.
Reported by: Nils Ohlmeier <nils@iptel.org>

Andrei Pelinescu-Onciul authored on 15/10/2008 14:13:56
Showing 1 changed files
... ...
@@ -175,6 +175,12 @@ struct socket_info* get_send_socket(struct sip_msg *msg,
175 175
 				goto not_forced;
176 176
 			}
177 177
 		}
178
+		if (unlikely(msg->force_send_socket->address.af!=to->s.sa_family)){
179
+			DBG("get_send_socket: force_send_socket of different af (dst %d,"
180
+					" forced %d)\n",
181
+					to->s.sa_family, msg->force_send_socket->address.af);
182
+			goto not_forced;
183
+		}
178 184
 		if (likely((msg->force_send_socket->socket!=-1) &&
179 185
 					!(msg->force_send_socket->flags & SI_IS_MCAST)))
180 186
 				return msg->force_send_socket;