Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
map-controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Multi-AP
map-controller
Commits
f5709fd5
Commit
f5709fd5
authored
2 years ago
by
Jakob Olsson
Browse files
Options
Downloads
Patches
Plain Diff
dpp: misc cleanup
parent
e0323739
Branches
Branches containing commit
No related tags found
1 merge request
!240
Dpp cleanup
Pipeline
#99147
passed
2 years ago
Stage: static_code_analysis
Stage: compile_test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dpp.c
+10
-69
10 additions, 69 deletions
src/dpp.c
with
10 additions
and
69 deletions
src/dpp.c
+
10
−
69
View file @
f5709fd5
...
@@ -266,60 +266,6 @@ struct dpp_chirp *dpp_chirp_alloc(struct controller *c, uint8_t *hash)
...
@@ -266,60 +266,6 @@ struct dpp_chirp *dpp_chirp_alloc(struct controller *c, uint8_t *hash)
return
p
;
return
p
;
}
}
#if 0
int dpp_pa_frame_handler(struct controller *c, struct dpp_enrollee *e,
uint8_t *enrollee, uint8_t *frame,
uint16_t framelen)
{
uint8_t frametype;
uint8_t *ptr = frame;
ptr += 2 + 3 + 1 + 1; /* type + oui + oui type + crypto suite */
frametype = *ptr;
ptr++; /* frame type */
if (FRAME_DST_ENROLLEE(frametype)) {
struct netif_bk *bk;
/*
ubus send "wifi.sta" '{"ifname":"wl1","event":"action","data":{"macaddr":"44:d4:37:71:bb:2e","raw":"0409506f9a1a01010010010000021020000fb2ff2b44432fc5a014408ed8ac38c4fca15d77ac359c856b25a79f75a72b7b09104000cf5c29afee43bb7f9eea5fac7cd4b08b644167f4c973e909483df287a7033fdc16931e9076bc33cb902673115cfa1f05b846f6122906a79947bf9396432be7461910010002041075005378360b52540483e4c864b44fe21ecacdcd45c0f4804a65b0d39321c22bcf4457ffe92fdb529996c56fc3a2c247e560fdb7b2083ead75def40a5699fa55c07872d42db57965588532220eb7180bd93a958df344cd600d5582fd7d720de5a1bb23b1cc670ddb43542dcda78dce5ec2df3b602bf63f"}}'
*/
bk = find_bkhaul_by_bssid(a, enrollee);
if (!bk || !bk->dpp_cfg) {
dbg("|%s:%d| No bsta (or dpp cfg) "\
"found for "MACFMT"\n", __func__,
__LINE__, MAC2STR(enrollee));
return -1;
}
if (frametype == DPP_PA_AUTHENTICATION_REQ)
bk->dpp_state = DPP_AUTHENTICATING;
else if (frametype == DPP_PA_AUTHENTICATION_CONF)
bk->dpp_state = DPP_AUTHENTICATED;
} else { /* frame is for proxy agent */
if (frametype == DPP_PA_PRESENCE_ANNOUNCEMENT) {
uint16_t attrlen = 0;
uint8_t *pos;
pos = dpp_get_attr(ptr,
framelen - labs(ptr - frame),
DPP_ATTR_R_BOOTSTRAP_KEY_HASH,
&attrlen);
if (pos) {
dpp_enrollee_update_hash(a, e,
(uint8_t) attrlen,
pos);
}
} else {
/* todo? */
}
}
return frametype;
}
#endif
int
dpp_enrollee_update_hash
(
struct
controller
*
c
,
int
dpp_enrollee_update_hash
(
struct
controller
*
c
,
struct
dpp_enrollee
*
e
,
struct
dpp_enrollee
*
e
,
uint8_t
len
,
uint8_t
*
hash
)
uint8_t
len
,
uint8_t
*
hash
)
...
@@ -349,7 +295,6 @@ int dpp_enrollee_update_hash(struct controller *c,
...
@@ -349,7 +295,6 @@ int dpp_enrollee_update_hash(struct controller *c,
return
0
;
return
0
;
}
}
struct
dpp_frame
*
dpp_enrollee_get_frame
(
struct
controller
*
c
,
struct
dpp_frame
*
dpp_enrollee_get_frame
(
struct
controller
*
c
,
struct
dpp_enrollee
*
e
,
uint8_t
type
)
struct
dpp_enrollee
*
e
,
uint8_t
type
)
{
{
...
@@ -503,11 +448,11 @@ int dpp_parse_uri_chan_list(struct controller *c, struct dpp_enrollee *e, char *
...
@@ -503,11 +448,11 @@ int dpp_parse_uri_chan_list(struct controller *c, struct dpp_enrollee *e, char *
e
->
num_chan
=
0
;
e
->
num_chan
=
0
;
err
(
"%s
%d uri
=
%s
\n
"
,
__func__
,
__LINE__
,
uri
);
dbg
(
"
|
%s
:
%d
|
uri
:
%s
\n
"
,
__func__
,
__LINE__
,
uri
);
pos
=
strstr
(
uri
,
"C:"
);
pos
=
strstr
(
uri
,
"C:"
);
if
(
!
pos
)
{
if
(
!
pos
)
{
err
(
"DPP: Invalid URI channel-list"
);
warn
(
"DPP: Invalid URI channel-list"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -537,7 +482,7 @@ int dpp_parse_uri_chan_list(struct controller *c, struct dpp_enrollee *e, char *
...
@@ -537,7 +482,7 @@ int dpp_parse_uri_chan_list(struct controller *c, struct dpp_enrollee *e, char *
pos
++
;
pos
++
;
freq
=
ieee80211_chan_to_freq
(
opclass
,
channel
);
freq
=
ieee80211_chan_to_freq
(
opclass
,
channel
);
err
(
"DPP: URI channel-list: opclass=%d channel=%d ==> freq=%d"
,
dbg
(
"DPP: URI channel-list: opclass=%d channel=%d ==> freq=%d"
,
opclass
,
channel
,
freq
);
opclass
,
channel
,
freq
);
chan
->
opclass
=
opclass
;
chan
->
opclass
=
opclass
;
...
@@ -581,7 +526,7 @@ int dpp_append_uri_file(struct controller *c, char *uri)
...
@@ -581,7 +526,7 @@ int dpp_append_uri_file(struct controller *c, char *uri)
uri_json
=
json_object_from_file
(
DPP_URI_FILE
);
uri_json
=
json_object_from_file
(
DPP_URI_FILE
);
if
(
!
uri_json
)
{
if
(
!
uri_json
)
{
warn
(
"|%s:%d| failed to read json:%s error:%s. "
\
dbg
(
"|%s:%d| failed to read json:%s error:%s. "
\
"Try to generate new
\n
"
,
__func__
,
__LINE__
,
DPP_URI_FILE
,
"Try to generate new
\n
"
,
__func__
,
__LINE__
,
DPP_URI_FILE
,
json_util_get_last_err
());
json_util_get_last_err
());
...
@@ -811,12 +756,12 @@ void dpp_event_uloop_cb(struct uloop_fd *fd, unsigned int events)
...
@@ -811,12 +756,12 @@ void dpp_event_uloop_cb(struct uloop_fd *fd, unsigned int events)
uint8_t
*
test
;
uint8_t
*
test
;
int
len
;
int
len
;
warn
(
"|%s:%d| Receive event from fd:%d
\n
"
,
__func__
,
__LINE__
,
dbg
(
"|%s:%d| Receive event from fd:%d
\n
"
,
__func__
,
__LINE__
,
p
->
chirp_fd
.
fd
);
p
->
chirp_fd
.
fd
);
e
=
dpp_enrollee_get_hash
(
c
,
p
->
hash
);
e
=
dpp_enrollee_get_hash
(
c
,
p
->
hash
);
if
(
!
e
)
{
if
(
!
e
)
{
err
(
"|%s:%d| Get not find enrollee of chirp with an fd!
\n
"
,
warn
(
"|%s:%d| Get not find enrollee of chirp with an fd!
\n
"
,
__func__
,
__LINE__
);
__func__
,
__LINE__
);
/* This is not expected to happen but should probably clear fd here? Close it? */
/* This is not expected to happen but should probably clear fd here? Close it? */
return
;
return
;
...
@@ -824,14 +769,14 @@ void dpp_event_uloop_cb(struct uloop_fd *fd, unsigned int events)
...
@@ -824,14 +769,14 @@ void dpp_event_uloop_cb(struct uloop_fd *fd, unsigned int events)
len
=
dpp_recv_tcp_data
(
p
->
chirp_fd
.
fd
,
&
test
);
len
=
dpp_recv_tcp_data
(
p
->
chirp_fd
.
fd
,
&
test
);
if
(
len
==
-
1
)
{
if
(
len
==
-
1
)
{
err
(
"Socket read error, close chirp_fd:%d
\n
"
,
p
->
chirp_fd
.
fd
);
warn
(
"Socket read error, close chirp_fd:%d
\n
"
,
p
->
chirp_fd
.
fd
);
uloop_fd_delete
(
&
p
->
chirp_fd
);
uloop_fd_delete
(
&
p
->
chirp_fd
);
socket_close
(
&
p
->
chirp_fd
.
fd
);
socket_close
(
&
p
->
chirp_fd
.
fd
);
return
;
return
;
}
}
if
(
len
==
0
)
{
if
(
len
==
0
)
{
err
(
"No data was read!
\n
"
);
warn
(
"No data was read!
\n
"
);
goto
out
;
goto
out
;
}
}
...
@@ -850,7 +795,6 @@ void dpp_event_uloop_cb(struct uloop_fd *fd, unsigned int events)
...
@@ -850,7 +795,6 @@ void dpp_event_uloop_cb(struct uloop_fd *fd, unsigned int events)
case
DPP_PA_AUTHENTICATION_REQ
:
{
case
DPP_PA_AUTHENTICATION_REQ
:
{
struct
node
*
n
;
struct
node
*
n
;
err
(
"%s %d
\n
"
,
__func__
,
__LINE__
);
list_for_each_entry
(
n
,
&
c
->
nodelist
,
list
)
{
list_for_each_entry
(
n
,
&
c
->
nodelist
,
list
)
{
memcpy
(
cmdu
->
origin
,
n
->
alid
,
6
);
memcpy
(
cmdu
->
origin
,
n
->
alid
,
6
);
send_cmdu
(
c
,
cmdu
);
send_cmdu
(
c
,
cmdu
);
...
@@ -861,10 +805,9 @@ void dpp_event_uloop_cb(struct uloop_fd *fd, unsigned int events)
...
@@ -861,10 +805,9 @@ void dpp_event_uloop_cb(struct uloop_fd *fd, unsigned int events)
case
DPP_PA_AUTHENTICATION_CONF
:
{
case
DPP_PA_AUTHENTICATION_CONF
:
{
struct
dpp_frame
*
f
;
struct
dpp_frame
*
f
;
err
(
"%s %d
\n
"
,
__func__
,
__LINE__
);
f
=
dpp_enrollee_get_frame
(
c
,
e
,
DPP_PA_AUTHENTICATION_RESP
);
f
=
dpp_enrollee_get_frame
(
c
,
e
,
DPP_PA_AUTHENTICATION_RESP
);
if
(
!
f
)
{
if
(
!
f
)
{
err
(
"|%s:%d| Auth resp frame missing! Dropping tcp response
\n
"
,
__func__
,
__LINE__
);
warn
(
"|%s:%d| Auth resp frame missing! Dropping tcp response
\n
"
,
__func__
,
__LINE__
);
break
;
break
;
}
}
...
@@ -876,10 +819,9 @@ void dpp_event_uloop_cb(struct uloop_fd *fd, unsigned int events)
...
@@ -876,10 +819,9 @@ void dpp_event_uloop_cb(struct uloop_fd *fd, unsigned int events)
case
DPP_PUB_AF_GAS_INITIAL_RESP
:
{
case
DPP_PUB_AF_GAS_INITIAL_RESP
:
{
struct
dpp_frame
*
f
;
struct
dpp_frame
*
f
;
err
(
"%s %d
\n
"
,
__func__
,
__LINE__
);
f
=
dpp_enrollee_get_frame
(
c
,
e
,
DPP_PUB_AF_GAS_INITIAL_REQ
);
f
=
dpp_enrollee_get_frame
(
c
,
e
,
DPP_PUB_AF_GAS_INITIAL_REQ
);
if
(
!
f
)
{
if
(
!
f
)
{
err
(
"|%s:%d| Auth resp frame missing! Dropping tcp response
\n
"
,
__func__
,
__LINE__
);
warn
(
"|%s:%d| Auth resp frame missing! Dropping tcp response
\n
"
,
__func__
,
__LINE__
);
break
;
break
;
}
}
...
@@ -889,7 +831,6 @@ void dpp_event_uloop_cb(struct uloop_fd *fd, unsigned int events)
...
@@ -889,7 +831,6 @@ void dpp_event_uloop_cb(struct uloop_fd *fd, unsigned int events)
break
;
break
;
}
}
default:
default:
err
(
"%s %d
\n
"
,
__func__
,
__LINE__
);
break
;
break
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment