Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hn70ap
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
hn70ap
Commits
5e0e257b
Commit
5e0e257b
authored
6 years ago
by
f4grx
Browse files
Options
Downloads
Patches
Plain Diff
fix ip parsing
parent
1df5b798
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/config/config_set.c
+12
-5
12 additions, 5 deletions
apps/config/config_set.c
with
12 additions
and
5 deletions
apps/config/config_set.c
+
12
−
5
View file @
5e0e257b
...
...
@@ -41,6 +41,8 @@
#include
<stdio.h>
#include
<string.h>
#include
<arpa/inet.h>
#include
<hn70ap/eeprom.h>
#include
"config_internal.h"
...
...
@@ -60,7 +62,7 @@ int config_set(char *key, char *value)
if
(
ret
!=
OK
)
{
fprintf
(
stderr
,
"Config entry not found
\n
"
);
fprintf
(
stderr
,
"Config entry
'%s'
not found
\n
"
,
key
);
return
ERROR
;
}
...
...
@@ -81,7 +83,7 @@ int config_set(char *key, char *value)
{
val
=
true
;
}
else
if
(
!
strcmp
(
val
,
"false"
)
||
else
if
(
!
strcmp
(
val
ue
,
"false"
)
||
!
strcmp
(
value
,
"False"
)
||
!
strcmp
(
value
,
"FALSE"
)
||
!
strcmp
(
value
,
"no"
)
||
...
...
@@ -96,7 +98,7 @@ int config_set(char *key, char *value)
}
else
{
printf
(
"Unrecognized boolean value: %s
\n
"
,
val
);
printf
(
"Unrecognized boolean value: %s
\n
"
,
val
ue
);
return
ERROR
;
}
ret
=
hn70ap_eeconfig_setbool
(
name
,
val
);
...
...
@@ -105,7 +107,12 @@ int config_set(char *key, char *value)
{
in_addr_t
val
;
printf
(
"Entry type is IPv4
\n
"
);
val
=
inet_aton
(
value
);
ret
=
inet_pton
(
AF_INET
,
value
,
&
val
);
if
(
ret
!=
1
)
{
printf
(
"Invalid IPv4 address: %s
\n
"
,
value
);
return
ERROR
;
}
ret
=
hn70ap_eeconfig_setip
(
name
,
val
);
}
else
if
(
type
==
EECONFIG_TYPE_CALL
)
...
...
@@ -118,7 +125,7 @@ int config_set(char *key, char *value)
}
else
{
fprintf
(
stderr
,
"
Config entry not found
\n
"
);
fprintf
(
stderr
,
"
Unknown entry type!
\n
"
);
return
ERROR
;
}
...
...
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