+ if ((__connman_inet_modify_address(RTM_NEWADDR,
+ NLM_F_REPLACE | NLM_F_ACK, pn->index, AF_INET,
+ server_ip, peer_ip, prefixlen, NULL)) < 0) {
+ DBG("address setting failed");
+ return;
+ }
+
+ connman_inet_ifup(pn->index);
+
+ err = __connman_nat_enable(BRIDGE_NAME, server_ip, prefixlen);
+ if (err < 0) {
+ connman_error("failed to enable NAT");
+ goto error;
+ }
+
+ dbus_message_iter_init_append(pn->reply, &array);
+
+ dbus_message_iter_append_basic(&array, DBUS_TYPE_OBJECT_PATH,
+ &pn->path);
+
+ connman_dbus_dict_open(&array, &dict);
+
+ connman_dbus_dict_append_basic(&dict, "ServerIPv4",
+ DBUS_TYPE_STRING, &server_ip);
+ connman_dbus_dict_append_basic(&dict, "PeerIPv4",
+ DBUS_TYPE_STRING, &peer_ip);
+ if (pn->primary_dns)
+ connman_dbus_dict_append_basic(&dict, "PrimaryDNS",
+ DBUS_TYPE_STRING, &pn->primary_dns);
+
+ if (pn->secondary_dns)
+ connman_dbus_dict_append_basic(&dict, "SecondaryDNS",
+ DBUS_TYPE_STRING, &pn->secondary_dns);
+
+ connman_dbus_dict_close(&array, &dict);
+
+ dbus_message_iter_append_basic(&array, DBUS_TYPE_UNIX_FD, &pn->fd);
+
+ g_dbus_send_message(connection, pn->reply);
+
+ return;
+
+error:
+ pn->reply = __connman_error_failed(pn->msg, -err);
+ g_dbus_send_message(connection, pn->reply);
+
+ g_hash_table_remove(pn_hash, pn->path);