tcpdump mailing list archives

Re: [PATCH] Decode DHCPv6 AFTR-Name option (RFC6334)


From: François-Xavier Le Bail <fx.lebail () yahoo com>
Date: Tue, 20 Nov 2012 09:08:42 -0800 (PST)

Problem with tabs, I sent it via a pull request on github.




________________________________
From: François-Xavier Le Bail <fx.lebail () yahoo com>
To: François-Xavier Le Bail <fx.lebail () yahoo com>; "tcpdump-workers () lists tcpdump org" <tcpdump-workers () lists 
tcpdump org> 
Sent: Tuesday, November 20, 2012 5:05 PM
Subject: Re: [PATCH] Decode DHCPv6 AFTR-Name option (RFC6334)

Hello,

Another try inline, the PATCH was removed.

-------------------------------------------------------------------------------------------------------------------

diff --git a/print-dhcp6.c b/print-dhcp6.c
index a75da82..b384b72 100644
--- a/print-dhcp6.c
+++ b/print-dhcp6.c
@@ -36,6 +36,7 @@
  *  RFC4075,
  *  RFC4242,
  *  RFC4280,
+ *  RFC6334,
  */
 
 #ifndef lint
@@ -170,6 +171,7 @@ struct dhcp6_relay {
 #define DH6OPT_CLT_TIME 46
 #define DH6OPT_LQ_RELAY_DATA 47
 #define DH6OPT_LQ_CLIENT_LINK 48
+#define DH6OPT_AFTR_NAME 64
 
 struct dhcp6opt {
     u_int16_t dh6opt_type;
@@ -278,6 +280,8 @@ dhcp6opt_name(int type)
         return "LQ-relay-data";
     case DH6OPT_LQ_CLIENT_LINK:
         return "LQ-client-link";
+    case DH6OPT_AFTR_NAME:
+        return "AFTR-Name";
     default:
         snprintf(genstr, sizeof(genstr), "opt_%d", type);
         return(genstr);
@@ -712,6 +716,30 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
                 printf("%02x", tp[i]);
             printf("...)");
             break;
+        case DH6OPT_AFTR_NAME:
+            if (optlen < 3) {
+                printf(" ?)");
+                break;
+            }
+            tp = (u_char *)(dh6o + 1);
+            int remain_len = optlen;
+            printf(" ");
+            /* Encoding is described in section 3.1 of RFC 1035 */
+            int label_len; /* Label length */
+            while (remain_len && *tp) {
+                label_len =  *tp++;
+                if (label_len < remain_len - 1) {
+                    printf("%.*s", label_len, tp);
+                    tp += label_len;
+                    remain_len -= (label_len + 1);
+                    if(*tp) printf(".");
+                } else {
+                    printf(" ?");
+                    break;
+                }
+            }
+            printf(")");
+            break;
         default:
             printf(")");
-------------------------------------------------------------------------------------------------------------------


----- Original Message -----
From: François-Xavier Le Bail <fx.lebail () yahoo com>
To: "tcpdump-workers () lists tcpdump org" <tcpdump-workers () lists tcpdump org>
Cc: François-Xavier Le Bail <fx.lebail () yahoo com>
Sent: Thursday, November 15, 2012 10:45 AM
Subject: Re: [PATCH] Decode DHCPv6 AFTR-Name option (RFC6334)

Hello,

Please find the patch version 2 as an attachment.

Updated for more tests on lengths.


Any comment is welcome.

Francois-Xavier



----- Original Message -----
  From: François-Xavier Le Bail <fx.lebail () yahoo com>
  To: "tcpdump-workers () lists tcpdump org" 
<tcpdump-workers () lists tcpdump org>
  Cc: "fx.lebail () yahoo com" <fx.lebail () yahoo com>
  Sent: Wednesday, November 14, 2012 6:19 PM
  Subject: [PATCH] Decode DHCPv6 AFTR-Name option (RFC6334)

  Hello,

  Please find the patch as an attachment.

  Any comment is welcome.

  Francois-Xavier Le Bail





_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Current thread: