Author: adrian.chadd
Date: Tue Feb 24 08:49:44 2009
New Revision: 13866

Modified:
    playpen/LUSCA_HEAD_bgp/src/access_log.c

Log:
Implement "%cas" in the custom logging format, to log the client AS number.

The AS is logged as "AS<x>", or "-" if it wasn't available.



Modified: playpen/LUSCA_HEAD_bgp/src/access_log.c
==============================================================================
--- playpen/LUSCA_HEAD_bgp/src/access_log.c     (original)
+++ playpen/LUSCA_HEAD_bgp/src/access_log.c     Tue Feb 24 08:49:44 2009
@@ -323,6 +323,8 @@

      LFT_EXT_FRESHNESS,

+    LFT_CLIENT_AS,
+
      LFT_PERCENT                       /* special string cases for escaped 
chars */

  } logformat_bcode_t;
@@ -436,6 +438,8 @@

      {"ef", LFT_EXT_FRESHNESS},

+    {"cas", LFT_CLIENT_AS },
+
      {"%", LFT_PERCENT},

      {NULL, LFT_NONE}          /* this must be last */
@@ -720,6 +724,15 @@

            quote = 1;
            break;
+
+       case LFT_CLIENT_AS:
+               outint = bgpLookupAsNum(al->cache.caddr);
+               if (outint > 0) {
+                       snprintf(tmp, sizeof(tmp), "AS%d", (int) outint);
+                       out = tmp;
+               } else
+                       out = "-";
+               break;

        case LFT_PERCENT:
            out = "%";

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to