P2P: Fix channel forcing for p2p_connect auth

This commit is contained in:
Jouni Malinen 2010-07-02 08:27:00 -07:00 committed by Jouni Malinen
parent 18eff3a3a7
commit d5b20a73b2
3 changed files with 27 additions and 6 deletions

View file

@ -881,6 +881,12 @@ int p2p_connect(struct p2p_data *p2p, const u8 *peer_addr,
dev->wps_method = wps_method; dev->wps_method = wps_method;
dev->status = P2P_SC_SUCCESS; dev->status = P2P_SC_SUCCESS;
if (force_freq)
dev->flags |= P2P_DEV_FORCE_FREQ;
else
dev->flags &= ~P2P_DEV_FORCE_FREQ;
if (p2p->p2p_scan_running) { if (p2p->p2p_scan_running) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: p2p_scan running - delay connect send"); "P2P: p2p_scan running - delay connect send");
@ -955,6 +961,11 @@ int p2p_authorize(struct p2p_data *p2p, const u8 *peer_addr,
dev->wps_method = wps_method; dev->wps_method = wps_method;
dev->status = P2P_SC_SUCCESS; dev->status = P2P_SC_SUCCESS;
if (force_freq)
dev->flags |= P2P_DEV_FORCE_FREQ;
else
dev->flags &= ~P2P_DEV_FORCE_FREQ;
return 0; return 0;
} }
@ -2457,7 +2468,7 @@ int p2p_get_peer_info(struct p2p_data *p2p, const u8 *addr, int next,
"country=%c%c\n" "country=%c%c\n"
"oper_freq=%d\n" "oper_freq=%d\n"
"req_config_methods=0x%x\n" "req_config_methods=0x%x\n"
"flags=%s%s%s%s%s%s%s%s%s%s%s%s%s\n" "flags=%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n"
"status=%d\n" "status=%d\n"
"wait_count=%u\n" "wait_count=%u\n"
"invitation_reqs=%u\n", "invitation_reqs=%u\n",
@ -2506,6 +2517,8 @@ int p2p_get_peer_info(struct p2p_data *p2p, const u8 *addr, int next,
"[WAIT_GO_NEG_CONFIRM]" : "", "[WAIT_GO_NEG_CONFIRM]" : "",
dev->flags & P2P_DEV_GROUP_CLIENT_ONLY ? dev->flags & P2P_DEV_GROUP_CLIENT_ONLY ?
"[GROUP_CLIENT_ONLY]" : "", "[GROUP_CLIENT_ONLY]" : "",
dev->flags & P2P_DEV_FORCE_FREQ ?
"[FORCE_FREQ" : "",
dev->status, dev->status,
dev->wait_count, dev->wait_count,
dev->invitation_reqs); dev->invitation_reqs);

View file

@ -401,11 +401,18 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Starting " wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Starting "
"GO Negotiation with previously authorized " "GO Negotiation with previously authorized "
"peer"); "peer");
/* TODO: check if force_freq is needed */ if (!(dev->flags & P2P_DEV_FORCE_FREQ)) {
p2p->op_reg_class = p2p->cfg->op_reg_class; wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
p2p->op_channel = p2p->cfg->op_channel; "P2P: Use default channel settings");
os_memcpy(&p2p->channels, &p2p->cfg->channels, p2p->op_reg_class = p2p->cfg->op_reg_class;
sizeof(struct p2p_channels)); p2p->op_channel = p2p->cfg->op_channel;
os_memcpy(&p2p->channels, &p2p->cfg->channels,
sizeof(struct p2p_channels));
} else {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Use previously configured "
"forced channel settings");
}
} }
dev->flags &= ~P2P_DEV_NOT_YET_READY; dev->flags &= ~P2P_DEV_NOT_YET_READY;

View file

@ -92,6 +92,7 @@ struct p2p_device {
#define P2P_DEV_WAIT_GO_NEG_RESPONSE BIT(10) #define P2P_DEV_WAIT_GO_NEG_RESPONSE BIT(10)
#define P2P_DEV_WAIT_GO_NEG_CONFIRM BIT(11) #define P2P_DEV_WAIT_GO_NEG_CONFIRM BIT(11)
#define P2P_DEV_GROUP_CLIENT_ONLY BIT(12) #define P2P_DEV_GROUP_CLIENT_ONLY BIT(12)
#define P2P_DEV_FORCE_FREQ BIT(13)
unsigned int flags; unsigned int flags;
int status; /* enum p2p_status_code */ int status; /* enum p2p_status_code */