Browse Source

suppress segfault when AF is unsupported

pull/163/head
Richard Fuchs 11 years ago
parent
commit
6086c652bf
2 changed files with 19 additions and 3 deletions
  1. +6
    -1
      daemon/call.c
  2. +13
    -2
      daemon/media_socket.c

+ 6
- 1
daemon/call.c View File

@ -1319,7 +1319,7 @@ static void __init_interface(struct call_media *media, const str *ifname) {
return;
get:
media->logical_intf = get_logical_interface(ifname, media->desired_family);
if (!media->logical_intf) {
if (G_UNLIKELY(!media->logical_intf)) {
/* legacy support */
if (!str_cmp(ifname, "internal"))
media->desired_family = __get_socket_family_enum(SF_IP4);
@ -1328,6 +1328,11 @@ get:
else
ilog(LOG_WARNING, "Interface '"STR_FORMAT"' not found, using default", STR_FMT(ifname));
media->logical_intf = get_logical_interface(NULL, media->desired_family);
if (!media->logical_intf) {
ilog(LOG_WARNING, "Requested address family (%s) not supported",
media->desired_family->name);
media->logical_intf = get_logical_interface(NULL, NULL);
}
}
// media->local_intf = ifa = get_interface_address(media->logical_intf, media->desired_family);
// if (!ifa) {


+ 13
- 2
daemon/media_socket.c View File

@ -233,9 +233,20 @@ static GQueue __preferred_lists_for_family[__SF_LAST];
struct logical_intf *get_logical_interface(const str *name, sockfamily_t *fam) {
struct logical_intf d, *lif;
if (!name || !name->s) {
if (G_UNLIKELY(!name || !name->s)) {
GQueue *q;
q = __interface_list_for_family(fam);
if (fam)
q = __interface_list_for_family(fam);
else {
for (int i = 0; i < __SF_LAST; i++) {
q = &__preferred_lists_for_family[i];
if (q->length)
goto got_some;
}
abort();
got_some:
;
}
return q->head ? q->head->data : NULL;
}


Loading…
Cancel
Save