Просмотр исходного кода

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 <[email protected]>
Andrei Pelinescu-Onciul 17 лет назад
Родитель
Сommit
878f9ca6e9
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      forward.c

+ 6 - 0
forward.c

@@ -175,6 +175,12 @@ struct socket_info* get_send_socket(struct sip_msg *msg,
 				goto not_forced;
 			}
 		}
+		if (unlikely(msg->force_send_socket->address.af!=to->s.sa_family)){
+			DBG("get_send_socket: force_send_socket of different af (dst %d,"
+					" forced %d)\n",
+					to->s.sa_family, msg->force_send_socket->address.af);
+			goto not_forced;
+		}
 		if (likely((msg->force_send_socket->socket!=-1) &&
 					!(msg->force_send_socket->flags & SI_IS_MCAST)))
 				return msg->force_send_socket;