Skip to content

Commit

Permalink
fix: if gateway ifname cant get ipv6 address, don't exit
Browse files Browse the repository at this point in the history
Signed-off-by: Dengfeng Liu <[email protected]>
  • Loading branch information
liudf0716 committed Sep 20, 2024
1 parent c250de3 commit 4db3c14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/gateway.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@ gateway_setting_init()

if (!gateway_settings->gw_address_v6) {
if ((gateway_settings->gw_address_v6 = get_iface_ip6(gateway_settings->gw_interface)) == NULL) {
debug(LOG_ERR, "Could not get IPv6 address information of %s, exiting...", gateway_settings->gw_interface);
exit(EXIT_FAILURE);
debug(LOG_ERR, "Could not get IPv6 address information of");
}
}

Expand All @@ -311,7 +310,8 @@ gateway_setting_init()
}

debug(LOG_DEBUG, "gw_id [%s] %s = %s ",
gateway_settings->gw_id, gateway_settings->gw_address_v4, gateway_settings->gw_address_v6);
gateway_settings->gw_id, gateway_settings->gw_address_v4,
gateway_settings->gw_address_v6?gateway_settings->gw_address_v6:"");
gateway_settings = gateway_settings->next;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/ws_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ send_msg(struct evbuffer *out, const char *type)
json_object_object_add(jobj_gw, "gw_id", json_object_new_string(gw_settings->gw_id));
json_object_object_add(jobj_gw, "gw_channel", json_object_new_string(gw_settings->gw_channel));
json_object_object_add(jobj_gw, "gw_address_v4", json_object_new_string(gw_settings->gw_address_v4));
json_object_object_add(jobj_gw, "gw_address_v6", json_object_new_string(gw_settings->gw_address_v6));
if (gw_settings->gw_address_v6)
json_object_object_add(jobj_gw, "gw_address_v6", json_object_new_string(gw_settings->gw_address_v6));
json_object_object_add(jobj_gw, "auth_mode", json_object_new_int(gw_settings->auth_mode));
json_object_object_add(jobj_gw, "gw_interface", json_object_new_string(gw_settings->gw_interface));
json_object_array_add(jarray, jobj_gw);
Expand Down

0 comments on commit 4db3c14

Please sign in to comment.