Skip to content

Instantly share code, notes, and snippets.

@dsturnbull
Created October 10, 2013 23:38
Show Gist options
  • Save dsturnbull/6927359 to your computer and use it in GitHub Desktop.
Save dsturnbull/6927359 to your computer and use it in GitHub Desktop.
Fix y2k bug and show IPv6 addresses in RFC-blah format.
diff --git a/src/log_text.c b/src/log_text.c
index 7771bb0..7412016 100644
--- a/src/log_text.c
+++ b/src/log_text.c
@@ -557,7 +557,12 @@ void LogIpAddrs(TextLog *log, Packet *p)
}
else
{
- char *ip_fmt = "%s:%d -> %s:%d";
+ char *ip_fmt;
+
+ if (IS_IP6(p))
+ ip_fmt = "[%s]:%d -> [%s]:%d";
+ else
+ ip_fmt = "%s:%d -> %s:%d";
if (ScObfuscate())
{
diff --git a/src/util.c b/src/util.c
index 372814c..ef76bd5 100644
--- a/src/util.c
+++ b/src/util.c
@@ -255,8 +255,8 @@ void ts_print(register const struct timeval *tvp, char *timebuf)
if (ScOutputIncludeYear())
{
(void) SnortSnprintf(timebuf, TIMEBUF_SIZE,
- "%02d/%02d/%02d-%02d:%02d:%02d.%06u ",
- lt->tm_mon + 1, lt->tm_mday, lt->tm_year - 100,
+ "%02d/%02d/%04d-%02d:%02d:%02d.%06u ",
+ lt->tm_mon + 1, lt->tm_mday, lt->tm_year + 1900,
s / 3600, (s % 3600) / 60, s % 60,
(u_int) tvp->tv_usec);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment