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
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
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
2e28582a
Commit
2e28582a
authored
Mar 14, 2017
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
syslog: add 'msg' subcommand
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
ae0d629c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
ipv4.h
lib/ipv4.h
+1
-1
syslog.c
lib/syslog.c
+14
-1
No files found.
lib/ipv4.h
View file @
2e28582a
...
@@ -65,6 +65,6 @@ int check_dest_ip(unsigned char *buf);
...
@@ -65,6 +65,6 @@ int check_dest_ip(unsigned char *buf);
void
syslog_init
(
void
);
void
syslog_init
(
void
);
int
syslog_poll
(
void
);
int
syslog_poll
(
void
);
void
syslog_report
(
char
*
buf
);
void
syslog_report
(
c
onst
c
har
*
buf
);
#endif
#endif
lib/syslog.c
View file @
2e28582a
...
@@ -32,6 +32,8 @@ void syslog_init(void)
...
@@ -32,6 +32,8 @@ void syslog_init(void)
static
int
cmd_syslog
(
const
char
*
args
[])
static
int
cmd_syslog
(
const
char
*
args
[])
{
{
char
b1
[
32
],
b2
[
32
];
char
b1
[
32
],
b2
[
32
];
char
*
p
;
int
i
;
if
(
args
[
0
]
&&
!
strcmp
(
args
[
0
],
"off"
))
{
if
(
args
[
0
]
&&
!
strcmp
(
args
[
0
],
"off"
))
{
syslog_addr
.
daddr
=
0
;
syslog_addr
.
daddr
=
0
;
...
@@ -39,8 +41,19 @@ static int cmd_syslog(const char *args[])
...
@@ -39,8 +41,19 @@ static int cmd_syslog(const char *args[])
}
}
if
(
!
args
[
1
])
{
if
(
!
args
[
1
])
{
pp_printf
(
"use: syslog <ipaddr> <macaddr> (or just
\"
off
\"\n
"
);
pp_printf
(
"use: syslog <ipaddr> <macaddr> (or just
\"
off
\"\n
"
);
pp_printf
(
" or syslog msg ....
\n
"
);
return
-
1
;
return
-
1
;
}
}
if
(
!
strcmp
(
args
[
0
],
"msg"
))
{
for
(
i
=
0
;
args
[
i
+
1
];
i
++
)
;
/* now, args[i] is the last argument; undo previous nulls */
for
(
p
=
(
void
*
)
args
[
i
];
p
>
args
[
1
];
p
--
)
/* not "const"! */
if
(
*
p
==
'\0'
)
*
p
=
' '
;
syslog_report
(
args
[
1
]);
return
0
;
}
decode_ip
(
args
[
0
],
(
void
*
)
&
syslog_addr
.
daddr
);
decode_ip
(
args
[
0
],
(
void
*
)
&
syslog_addr
.
daddr
);
decode_mac
(
args
[
1
],
syslog_mac
);
decode_mac
(
args
[
1
],
syslog_mac
);
pp_printf
(
"Syslog parameters: %s, %s
\n
"
,
pp_printf
(
"Syslog parameters: %s, %s
\n
"
,
...
@@ -207,7 +220,7 @@ send:
...
@@ -207,7 +220,7 @@ send:
}
}
/* A report tool for others to call (used by ltest at least) */
/* A report tool for others to call (used by ltest at least) */
void
syslog_report
(
char
*
msg
)
void
syslog_report
(
c
onst
c
har
*
msg
)
{
{
char
buf
[
256
];
char
buf
[
256
];
unsigned
char
ip
[
4
];
unsigned
char
ip
[
4
];
...
...
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