Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
map-agent
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-agent
Commits
25356bbf
Commit
25356bbf
authored
3 years ago
by
Jakob Olsson
Browse files
Options
Downloads
Patches
Plain Diff
dyn-cntlr-sync: persist enabled variable between writes
parent
25d90046
No related branches found
No related tags found
1 merge request
!136
Dyn cntlr sync enabled
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/agent_map.c
+6
-0
6 additions, 0 deletions
src/agent_map.c
src/config.c
+33
-0
33 additions, 0 deletions
src/config.c
src/config.h
+1
-0
1 addition, 0 deletions
src/config.h
with
40 additions
and
0 deletions
src/agent_map.c
+
6
−
0
View file @
25356bbf
...
...
@@ -4653,6 +4653,7 @@ int handle_hld_message(void *agent, struct cmdu_buff *rx_cmdu)
cmdu_free
(
cmdu
);
}
else
if
(
proto
==
0xac
&&
cntlr_sync
)
{
struct
sync_config
out
=
{
0
};
char
enabled
[
2
]
=
{
0
};
dbg
(
"*** Process dyn-controller-config-sync response ***
\n
"
);
/*
...
...
@@ -4677,9 +4678,14 @@ int handle_hld_message(void *agent, struct cmdu_buff *rx_cmdu)
return
ret
;
}
agent_get_controller_enabled
(
a
,
enabled
);
ret
=
writeto_configfile
(
"/etc/config/mapcontroller"
,
out
.
data
,
out
.
len
);
if
(
ret
)
fprintf
(
stderr
,
"failed to write file
\n
"
);
set_value_by_string
(
"mapcontroller"
,
"controller"
,
"enabled"
,
enabled
,
UCI_TYPE_STRING
);
}
#endif
/* AGENT_SYNC_DYNAMIC_CNTLR_CONFIG */
...
...
This diff is collapsed.
Click to expand it.
src/config.c
+
33
−
0
View file @
25356bbf
...
...
@@ -249,6 +249,39 @@ out_pkg:
}
#endif
/* expects buf to len 2 */
char
*
agent_get_controller_enabled
(
struct
agent
*
a
,
char
*
buf
)
{
struct
uci_context
*
ctx
;
struct
uci_ptr
ptr
=
{
0
};
int
ret
=
-
1
;
ctx
=
uci_alloc_context
();
if
(
!
ctx
)
return
-
1
;
ptr
.
package
=
"mapcontroller"
;
ptr
.
section
=
"controller"
;
ptr
.
option
=
"enabled"
;
ptr
.
target
=
UCI_TYPE_OPTION
;
ret
=
uci_lookup_ptr
(
ctx
,
&
ptr
,
NULL
,
false
);
if
(
ret
!=
UCI_OK
||!
(
ptr
.
flags
&
UCI_LOOKUP_DONE
))
{
goto
error
;
}
if
(
ptr
.
flags
&
UCI_LOOKUP_COMPLETE
)
{
/* option found */
strncpy
(
buf
,
ptr
.
o
->
v
.
string
,
1
);
}
uci_unload
(
ctx
,
ptr
.
p
);
error:
uci_free_context
(
ctx
);
return
ret
;
}
int
wifi_get_iface_bssid
(
char
*
ifname
,
uint8_t
*
bssid
)
{
struct
uci_context
*
ctx
=
NULL
;
...
...
This diff is collapsed.
Click to expand it.
src/config.h
+
1
−
0
View file @
25356bbf
...
...
@@ -222,6 +222,7 @@ int set_value(struct uci_context *ctx, struct uci_package *pkg,
const
char
*
value
,
enum
uci_option_type
type
);
int
set_value_by_string
(
const
char
*
package
,
const
char
*
section
,
const
char
*
key
,
const
char
*
value
,
enum
uci_option_type
type
);
char
*
agent_get_controller_enabled
(
struct
agent
*
a
,
char
*
buf
);
struct
uci_section
*
config_get_iface_section
(
struct
uci_context
*
ctx
,
struct
uci_package
*
pkg
,
const
char
*
type
,
const
char
*
ifname
);
bool
uci_reload_services
(
char
*
services
);
...
...
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