-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlogalert.c
69 lines (61 loc) · 1.56 KB
/
logalert.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* Copyright (c) 2005-2010 Thierry FOURNIER
* $Id: logalert.c 690 2008-03-31 18:36:43Z $
*
*/
#include "config.h"
#include "log.h"
#include "loadconfig.h"
#include "alertes.h"
void alerte_log(int num_seq,
char *mac_sender,
char *ip_sender,
int type,
char *ref,
char *interface,
char *vendor){
// log with mac vendor
if(config[CF_LOG_VENDOR].valeur.integer == TRUE){
switch(type){
case AL_IP_CHANGE:
case AL_UNAUTHRQ:
case AL_MAC_ERROR:
case AL_MAC_CHANGE:
logmsg(LOG_NOTICE,
"seq=%d, mac=%s, ip=%s, reference=%s, "
"type=%s, dev=%s, vendor=\"%s\"",
num_seq, mac_sender, ip_sender, ref,
alert_type[type], interface, vendor);
break;
default:
logmsg(LOG_NOTICE,
"seq=%d, mac=%s, ip=%s, type=%s, "
"dev=%s, vendor=\"%s\"",
num_seq, mac_sender, ip_sender,
alert_type[type], interface, vendor);
break;
}
}
// log whitout mac vendor
else {
switch(type){
case AL_IP_CHANGE:
case AL_UNAUTHRQ:
case AL_MAC_ERROR:
case AL_MAC_CHANGE:
logmsg(LOG_NOTICE,
"seq=%d, mac=%s, ip=%s, reference=%s, "
"type=%s, dev=%s",
num_seq, mac_sender, ip_sender,
ref, alert_type[type], interface);
break;
default:
logmsg(LOG_NOTICE,
"seq=%d, mac=%s, ip=%s, type=%s, "
"dev=%s",
num_seq, mac_sender, ip_sender,
alert_type[type], interface);
break;
}
}
}