[PATCH 1/3] dnsapi: Add support for DNS_TYPE_OPT records.

Hans Leidekker hans at codeweavers.com
Fri Mar 1 01:43:10 CST 2019


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46704
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/dnsapi/query.c  | 10 ++++++++++
 dlls/dnsapi/record.c | 10 ++++++++++
 include/windns.h     | 10 ++++++++++
 3 files changed, 30 insertions(+)

diff --git a/dlls/dnsapi/query.c b/dlls/dnsapi/query.c
index 19eecfded1..e601191c5d 100644
--- a/dlls/dnsapi/query.c
+++ b/dlls/dnsapi/query.c
@@ -218,6 +218,7 @@ static unsigned int dns_get_record_size( const ns_rr *rr )
         break;
     }
     case ns_t_null:
+    case ns_t_opt:
     {
         size += rr->rdlength - 1;
         break;
@@ -313,6 +314,15 @@ static DNS_STATUS dns_copy_rdata( ns_msg msg, const ns_rr *rr, DNS_RECORDA *r, W
         *dlen = sizeof(DNS_NULL_DATA) + rr->rdlength - 1;
         break;
     }
+    case ns_t_opt:
+    {
+        r->Data.OPT.wDataLength = rr->rdlength;
+        r->Data.OPT.wPad        = 0;
+        memcpy( r->Data.OPT.Data, rr->rdata, rr->rdlength );
+
+        *dlen = sizeof(DNS_OPT_DATA) + rr->rdlength - 1;
+        break;
+    }
     case ns_t_cname:
     case ns_t_ns:
     case ns_t_mb:
diff --git a/dlls/dnsapi/record.c b/dlls/dnsapi/record.c
index 7882b2290f..8d7b17af64 100644
--- a/dlls/dnsapi/record.c
+++ b/dlls/dnsapi/record.c
@@ -222,6 +222,16 @@ BOOL WINAPI DnsRecordCompare( PDNS_RECORD r1, PDNS_RECORD r2 )
             return FALSE;
         break;
     }
+    case DNS_TYPE_OPT:
+    {
+        if (r1->Data.Opt.wDataLength != r2->Data.Opt.wDataLength)
+            return FALSE;
+        /* ignore wPad */
+        if (memcmp( r1->Data.Opt.Data,
+                    r2->Data.Opt.Data, r1->Data.Opt.wDataLength ))
+            return FALSE;
+        break;
+    }
     case DNS_TYPE_AAAA:
     {
         for (i = 0; i < sizeof(IP6_ADDRESS)/sizeof(DWORD); i++)
diff --git a/include/windns.h b/include/windns.h
index f150919b42..d9a4b9adb0 100644
--- a/include/windns.h
+++ b/include/windns.h
@@ -519,6 +519,14 @@ typedef struct
 DECL_WINELIB_TYPE_AW(DNS_WINSR_DATA)
 DECL_WINELIB_TYPE_AW(PDNS_WINSR_DATA)
 
+typedef struct
+{
+    WORD wDataLength;
+    WORD wPad;
+    BYTE Data[1];
+}
+DNS_OPT_DATA, *PDNS_OPT_DATA;
+
 typedef struct _DnsRecordA
 {
     struct _DnsRecordA *pNext;
@@ -552,6 +560,7 @@ typedef struct _DnsRecordA
         DNS_TSIG_DATAA TSIG, Tsig;
         DNS_WINS_DATA WINS, Wins;
         DNS_WINSR_DATAA WINSR, WinsR, NBSTAT, Nbstat;
+        DNS_OPT_DATA OPT, Opt;
     } Data;
 } DNS_RECORDA, *PDNS_RECORDA;
 
@@ -588,6 +597,7 @@ typedef struct _DnsRecordW
         DNS_TSIG_DATAW TSIG, Tsig;
         DNS_WINS_DATA WINS, Wins;
         DNS_WINSR_DATAW WINSR, WinsR, NBSTAT, Nbstat;
+        DNS_OPT_DATA OPT, Opt;
     } Data;
 } DNS_RECORDW, *PDNS_RECORDW;
 
-- 
2.11.0




More information about the wine-devel mailing list