Skip to content

Commit 0c79406

Browse files
D-Trivenicarlescufi
authored andcommitted
modules: wfa-qt: Fix command handling
Fix command handing in P2P handlers and fix return value checks. Signed-off-by: Triveni Danda <[email protected]>
1 parent 7ff3838 commit 0c79406

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

modules/wfa-qt/src/indigo_api_callback_dut.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ static int get_mac_addr_handler(struct packet_wrapper *req, struct packet_wrappe
14251425
} else if (atoi(role) == DUT_TYPE_P2PUT) {
14261426
#ifdef CONFIG_P2P
14271427
/* Get P2P GO/Client or Device MAC */
1428-
if (get_p2p_mac_addr(mac_addr, sizeof(mac_addr))) {
1428+
if (!get_p2p_mac_addr(mac_addr, sizeof(mac_addr))) {
14291429
indigo_logger(LOG_LEVEL_INFO,
14301430
"Can't find P2P Device MAC. Use wireless IF MAC");
14311431
get_mac_address(mac_addr, sizeof(mac_addr), get_wireless_interface());
@@ -2302,7 +2302,7 @@ static int p2p_start_wps_handler(struct packet_wrapper *req, struct packet_wrapp
23022302
CHECK_RET();
23032303

23042304
/* Open wpa_supplicant UDS socket */
2305-
if (get_p2p_group_if(if_name, sizeof(if_name))) {
2305+
if (!get_p2p_group_if(if_name, sizeof(if_name))) {
23062306
indigo_logger(LOG_LEVEL_ERROR, "Failed to get P2P group interface");
23072307
goto done;
23082308
}
@@ -2473,8 +2473,8 @@ static int p2p_connect_handler(struct packet_wrapper *req, struct packet_wrapper
24732473
indigo_logger(LOG_LEVEL_ERROR, "Missed TLV PIN_METHOD???");
24742474
}
24752475
CHECK_SNPRINTF(buffer, sizeof(buffer), ret,
2476-
"P2P_CONNECT %s %s %s%s%s%s%s", mac, pin_code,
2477-
method, type, go_intent, he, persist);
2476+
"P2P_CONNECT %s %s %s %s %s", mac, pin_code,
2477+
method, type, go_intent);
24782478
} else {
24792479
tlv = find_wrapper_tlv_by_id(req, TLV_WSC_METHOD);
24802480
if (tlv) {
@@ -2483,8 +2483,7 @@ static int p2p_connect_handler(struct packet_wrapper *req, struct packet_wrapper
24832483
indigo_logger(LOG_LEVEL_ERROR, "Missed TLV WSC_METHOD");
24842484
}
24852485
CHECK_SNPRINTF(buffer, sizeof(buffer), ret,
2486-
"P2P_CONNECT %s %s%s%s%s%s", mac, method,
2487-
type, go_intent, he, persist);
2486+
"P2P_CONNECT %s %s %s %s", mac, method, type, go_intent);
24882487
}
24892488
indigo_logger(LOG_LEVEL_DEBUG, "Command: %s", buffer);
24902489

@@ -2750,8 +2749,9 @@ static int start_dhcp_handler(struct packet_wrapper *req, struct packet_wrapper
27502749
if (!strcmp("0.0.0.0", ip_addr)) {
27512750
CHECK_SNPRINTF(ip_addr, sizeof(ip_addr), ret, DHCP_SERVER_IP);
27522751
}
2753-
CHECK_SNPRINTF(buffer, sizeof(buffer), ret, "%s/24", ip_addr);
2752+
CHECK_SNPRINTF(buffer, sizeof(buffer), ret, "%s", ip_addr);
27542753
set_interface_ip(if_name, buffer);
2754+
set_netmask(if_name);
27552755
start_dhcp_server(if_name, ip_addr);
27562756
} else { /* DHCP Client */
27572757
start_dhcp_client(if_name);

0 commit comments

Comments
 (0)