Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
29
Issues
29
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
f451742e
Commit
f451742e
authored
Mar 04, 2016
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Kconfig: add SNMP_VERBOSE
Move SNMP just after syslog. Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
3f6bbea0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
11 deletions
+26
-11
Kconfig
Kconfig
+11
-5
trace.h
include/trace.h
+9
-0
snmp.c
lib/snmp.c
+6
-6
No files found.
Kconfig
View file @
f451742e
...
...
@@ -136,6 +136,11 @@ config SYSLOG
The user (or init script) must use "syslog <ipaddr> <macaddr>"
to enable it. The special "off" ipaddr disables syslog.
config SNMP
depends on IP
default y
boolean "Mini SNMP responder"
config BUILD_INIT
depends on WR_NODE
default n
...
...
@@ -360,6 +365,12 @@ config WRC_VERBOSE
help
This enables some more diagnostic messages. Normally off.
config SNMP_VERBOSE
depends on DEVELOPER && SNMP
boolean "More verbose messages in SNMP"
help
This enables some more diagnostic messages. Normally off.
config FAKE_TEMPERATURES
depends on DEVELOPER
boolean "Offer an array of 3 fake temperatures, for testing"
...
...
@@ -367,11 +378,6 @@ config FAKE_TEMPERATURES
The option adds also a "faketemp" command, used to set
the fake temperatures: e.g. "faketemp 120 -10 50"
config SNMP
depends on IP
default y
boolean "Mini SNMP responder"
config VLAN
depends on DEVELOPER
boolean "Filter and rx/tx frames in a VLAN (as opposed to untagged)"
...
...
include/trace.h
View file @
f451742e
...
...
@@ -25,6 +25,12 @@
#define WRC_IS_VERBOSE 0
#endif
#ifdef CONFIG_SNMP_VERBOSE
#define SNMP_IS_VERBOSE 1
#else
#define SNMP_IS_VERBOSE 0
#endif
#define pll_verbose(...) \
({if (PLL_IS_VERBOSE) __debug_printf(__VA_ARGS__);})
...
...
@@ -37,6 +43,9 @@
#define net_verbose(...) \
({if (NET_IS_VERBOSE) __debug_printf(__VA_ARGS__);})
#define snmp_verbose(...) \
({if (SNMP_IS_VERBOSE) __debug_printf(__VA_ARGS__);})
#ifdef CONFIG_HOST_PROCESS
#define IS_HOST_PROCESS 1
...
...
lib/snmp.c
View file @
f451742e
...
...
@@ -100,8 +100,8 @@ static int fill_struct_asn(uint8_t *buf, struct snmp_oid *obj)
tmp
=
htonl
(
*
(
uint32_t
*
)(
*
(
obj
->
p
)
+
obj
->
offset
));
memcpy
(
buf
+
2
,
&
tmp
,
sizeof
(
tmp
));
buf
[
1
]
=
sizeof
(
tmp
);
pp_printf
(
"fill_struct_asn 0x%x
\n
"
,
*
(
uint32_t
*
)(
*
(
obj
->
p
)
+
obj
->
offset
));
snmp_verbose
(
"fill_struct_asn 0x%x
\n
"
,
*
(
uint32_t
*
)(
*
(
obj
->
p
)
+
obj
->
offset
));
break
;
default:
break
;
...
...
@@ -225,7 +225,7 @@ static int snmp_respond(uint8_t *buf)
return
-
1
;
}
}
net
_verbose
(
"%s: match ok
\n
"
,
__func__
);
snmp
_verbose
(
"%s: match ok
\n
"
,
__func__
);
newbuf
=
buf
+
i
;
for
(
oid
=
oid_array
;
oid
->
oid_len
;
oid
++
)
...
...
@@ -233,7 +233,7 @@ static int snmp_respond(uint8_t *buf)
break
;
if
(
!
oid
->
oid_len
)
return
-
1
;
net
_verbose
(
"%s: oid found: calling %p
\n
"
,
__func__
,
oid
->
fill
);
snmp
_verbose
(
"%s: oid found: calling %p
\n
"
,
__func__
,
oid
->
fill
);
/* Phew.... we matched the OID, so let's call the filler */
newbuf
+=
oid
->
oid_len
;
...
...
@@ -246,11 +246,11 @@ static int snmp_respond(uint8_t *buf)
buf
[
i
]
=
0xA2
;
/* get response */
if
(
match_array
[
i
]
!=
BYTE_SIZE
)
continue
;
net
_verbose
(
"offset %i 0x%02x is len %i
\n
"
,
i
,
i
,
snmp
_verbose
(
"offset %i 0x%02x is len %i
\n
"
,
i
,
i
,
remain
+
oid
->
oid_len
+
len
);
buf
[
i
]
=
remain
+
oid
->
oid_len
+
len
;
}
net
_verbose
(
"%s: returning %i bytes
\n
"
,
__func__
,
len
+
(
newbuf
-
buf
));
snmp
_verbose
(
"%s: returning %i bytes
\n
"
,
__func__
,
len
+
(
newbuf
-
buf
));
return
len
+
(
newbuf
-
buf
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment