{
vlib_thread_main_t *tm = &vlib_thread_main;
u32 n_vlib_mains = tm->n_vlib_mains;
+ vlib_main_t *vm = dm->vlib_main;
if (is_enable)
{
&& (vec_len (dm->ip6_name_servers) == 0))
return VNET_API_ERROR_NO_NAME_SERVERS;
+ if (dm->udp_ports_registered == 0)
+ {
+ udp_register_dst_port (vm, UDP_DST_PORT_dns_reply,
+ dns46_reply_node.index, 1 /* is_ip4 */ );
+
+ udp_register_dst_port (vm, UDP_DST_PORT_dns_reply6,
+ dns46_reply_node.index, 0 /* is_ip4 */ );
+
+ udp_register_dst_port (vm, UDP_DST_PORT_dns,
+ dns4_request_node.index, 1 /* is_ip4 */ );
+
+ udp_register_dst_port (vm, UDP_DST_PORT_dns6,
+ dns6_request_node.index, 0 /* is_ip4 */ );
+
+ dm->udp_ports_registered = 1;
+ }
+
if (dm->cache_entry_by_name == 0)
{
if (n_vlib_mains > 1)
REPLY_MACRO (VL_API_DNS_NAME_SERVER_ADD_DEL_REPLY);
}
-static void
-send_dns4_request (dns_main_t * dm,
- dns_cache_entry_t * ep, ip4_address_t * server)
+void
+vnet_dns_send_dns4_request (dns_main_t * dm,
+ dns_cache_entry_t * ep, ip4_address_t * server)
{
vlib_main_t *vm = dm->vlib_main;
f64 now = vlib_time_now (vm);
{
clib_warning
("route to %U exists, fei %d, get_resolving_interface returned"
- " ~0", fei, format_ip4_address, &prefix.fp_addr);
+ " ~0", format_ip4_address, &prefix.fp_addr, fei);
return;
}
/* *INDENT-OFF* */
- foreach_ip_interface_address(lm4, ia, sw_if_index, 1 /* honor unnummbered */,
+ foreach_ip_interface_address(lm4, ia, sw_if_index, 1 /* honor unnumbered */,
({
src_address = ip_interface_address_get_address (lm4, ia);
goto found_src_address;
vnet_buffer (b)->sw_if_index[VLIB_TX] = 0; /* default VRF for now */
ip = vlib_buffer_get_current (b);
- memset (ip, 0, sizeof (*ip));
+ clib_memset (ip, 0, sizeof (*ip));
udp = (udp_header_t *) (ip + 1);
- memset (udp, 0, sizeof (*udp));
+ clib_memset (udp, 0, sizeof (*udp));
dns_request = (u8 *) (udp + 1);
ep->retry_timer = now + 2.0;
}
-static void
-send_dns6_request (dns_main_t * dm,
- dns_cache_entry_t * ep, ip6_address_t * server)
+void
+vnet_dns_send_dns6_request (dns_main_t * dm,
+ dns_cache_entry_t * ep, ip6_address_t * server)
{
vlib_main_t *vm = dm->vlib_main;
f64 now = vlib_time_now (vm);
sw_if_index = fib_entry_get_resolving_interface (fei);
/* *INDENT-OFF* */
- foreach_ip_interface_address(lm6, ia, sw_if_index, 1 /* honor unnummbered */,
+ foreach_ip_interface_address(lm6, ia, sw_if_index, 1 /* honor unnumbered */,
({
src_address = ip_interface_address_get_address (lm6, ia);
goto found_src_address;
VLIB_BUFFER_TOTAL_LENGTH_VALID | VNET_BUFFER_F_LOCALLY_ORIGINATED;
ip = vlib_buffer_get_current (b);
- memset (ip, 0, sizeof (*ip));
+ clib_memset (ip, 0, sizeof (*ip));
udp = (udp_header_t *) (ip + 1);
- memset (udp, 0, sizeof (*udp));
+ clib_memset (udp, 0, sizeof (*udp));
dns_request = (u8 *) (udp + 1);
dns_header_t *h;
dns_query_t *qp;
u16 tmp;
- u8 *request;
+ u8 *request, *name_copy;
u32 qp_offset;
/* This can easily happen if sitting in GDB, etc. */
- if (ep->flags & DNS_CACHE_ENTRY_FLAG_VALID)
+ if (ep->flags & DNS_CACHE_ENTRY_FLAG_VALID || ep->server_fails > 1)
return;
/* Construct the dns request, if we haven't been here already */
* per label is 63, enforce that.
*/
request = name_to_labels (ep->name);
+ name_copy = vec_dup (request);
qp_offset = vec_len (request);
+ /*
+ * At least when testing against "known good" DNS servers:
+ * it turns out that sending 2x requests - one for an A-record
+ * and another for a AAAA-record - seems to work better than
+ * sending a DNS_TYPE_ALL request.
+ */
+
/* Add space for the query header */
- vec_validate (request, qp_offset + sizeof (dns_query_t) - 1);
+ vec_validate (request, 2 * qp_offset + 2 * sizeof (dns_query_t) - 1);
qp = (dns_query_t *) (request + qp_offset);
- qp->type = clib_host_to_net_u16 (DNS_TYPE_ALL);
+ qp->type = clib_host_to_net_u16 (DNS_TYPE_A);
+ qp->class = clib_host_to_net_u16 (DNS_CLASS_IN);
+ qp++;
+ clib_memcpy (qp, name_copy, vec_len (name_copy));
+ qp = (dns_query_t *) (((u8 *) qp) + vec_len (name_copy));
+ vec_free (name_copy);
+
+ qp->type = clib_host_to_net_u16 (DNS_TYPE_AAAA);
qp->class = clib_host_to_net_u16 (DNS_CLASS_IN);
/* Punch in space for the dns_header_t */
/* Ask for a recursive lookup */
tmp = DNS_RD | DNS_OPCODE_QUERY;
h->flags = clib_host_to_net_u16 (tmp);
- h->qdcount = clib_host_to_net_u16 (1);
+ h->qdcount = clib_host_to_net_u16 (2);
h->nscount = 0;
h->arcount = 0;
{
if (vec_len (dm->ip6_name_servers))
{
- send_dns6_request (dm, ep,
- dm->ip6_name_servers + ep->server_rotor);
+ vnet_dns_send_dns6_request
+ (dm, ep, dm->ip6_name_servers + ep->server_rotor);
goto out;
}
else
}
if (vec_len (dm->ip4_name_servers))
{
- send_dns4_request (dm, ep, dm->ip4_name_servers + ep->server_rotor);
+ vnet_dns_send_dns4_request
+ (dm, ep, dm->ip4_name_servers + ep->server_rotor);
goto out;
}
}
}
if (ep->server_af == 1 /* ip6 */ )
- send_dns6_request (dm, ep, dm->ip6_name_servers + ep->server_rotor);
+ vnet_dns_send_dns6_request
+ (dm, ep, dm->ip6_name_servers + ep->server_rotor);
else
- send_dns4_request (dm, ep, dm->ip4_name_servers + ep->server_rotor);
+ vnet_dns_send_dns4_request
+ (dm, ep, dm->ip4_name_servers + ep->server_rotor);
out:
}
pool_get (dm->entries, ep);
- memset (ep, 0, sizeof (*ep));
+ clib_memset (ep, 0, sizeof (*ep));
/* Note: consumes the name vector */
ep->name = name;
/* add new hash table entry */
pool_get (dm->entries, ep);
- memset (ep, 0, sizeof (*ep));
+ clib_memset (ep, 0, sizeof (*ep));
ep->name = format (0, "%s%c", name, 0);
_vec_len (ep->name) = vec_len (ep->name) - 1;
dns_rr_t *rr;
u8 *curpos;
u8 *pos, *pos2;
+ u8 *cname_pos = 0;
int len, i;
u8 *cname = 0;
u8 *request = 0;
+ u8 *name_copy;
u32 qp_offset;
u16 flags;
u16 rcode;
case DNS_RCODE_SERVER_FAILURE:
case DNS_RCODE_NOT_IMPLEMENTED:
case DNS_RCODE_REFUSED:
- return 0;
+ return -1;
}
curpos = (u8 *) (h + 1);
else
return 0;
- rr = (dns_rr_t *) pos;
+ /* Walk the answer(s) to see what to do next */
+ for (i = 0; i < clib_net_to_host_u16 (h->anscount); i++)
+ {
+ rr = (dns_rr_t *) pos;
+ switch (clib_net_to_host_u16 (rr->type))
+ {
+ /* Real address record? Done.. */
+ case DNS_TYPE_A:
+ case DNS_TYPE_AAAA:
+ return 0;
+ /*
+ * Maybe chase a CNAME pointer?
+ * It's not unheard-of for name-servers to return
+ * both CNAME and A/AAAA records...
+ */
+ case DNS_TYPE_CNAME:
+ cname_pos = pos;
+ break;
- /* This is a real record, not a CNAME record */
- if (clib_net_to_host_u16 (rr->type) != DNS_TYPE_CNAME)
- return 0;
+ /* Some other junk, e.g. a nameserver... */
+ default:
+ break;
+ }
+ pos += sizeof (*rr) + clib_net_to_host_u16 (rr->rdlength);
+ /* Skip name... */
+ if ((pos2[0] & 0xc0) == 0xc0)
+ pos += 2;
+ }
+
+ /* Neither a CNAME nor a real address. Try another server */
+ if (cname_pos == 0)
+ {
+ flags &= ~DNS_RCODE_MASK;
+ flags |= DNS_RCODE_NAME_ERROR;
+ h->flags = clib_host_to_net_u16 (flags);
+ return -1;
+ }
/* This is a CNAME record, chase the name chain. */
+ pos = cname_pos;
/* The last request is no longer pending.. */
for (i = 0; i < vec_len (dm->unresolved_entries); i++)
ep->cname = cname;
ep->flags |= (DNS_CACHE_ENTRY_FLAG_CNAME | DNS_CACHE_ENTRY_FLAG_VALID);
/* Save the response */
+ if (ep->dns_response)
+ vec_free (ep->dns_response);
ep->dns_response = reply;
/* Set up expiration time */
ep->expiration_time = now + clib_net_to_host_u32 (rr->ttl);
/* Need to recompute ep post pool-get */
ep = pool_elt_at_index (dm->entries, ep_index);
- memset (next_ep, 0, sizeof (*next_ep));
+ clib_memset (next_ep, 0, sizeof (*next_ep));
next_ep->name = vec_dup (cname);
vec_add1 (next_ep->name, 0);
_vec_len (next_ep->name) -= 1;
#undef _
request = name_to_labels (cname);
+ name_copy = vec_dup (request);
qp_offset = vec_len (request);
/* Add space for the query header */
- vec_validate (request, qp_offset + sizeof (dns_query_t) - 1);
+ vec_validate (request, 2 * qp_offset + 2 * sizeof (dns_query_t) - 1);
qp = (dns_query_t *) (request + qp_offset);
- qp->type = clib_host_to_net_u16 (DNS_TYPE_ALL);
+ qp->type = clib_host_to_net_u16 (DNS_TYPE_A);
+ qp->class = clib_host_to_net_u16 (DNS_CLASS_IN);
+ clib_memcpy (qp, name_copy, vec_len (name_copy));
+ qp = (dns_query_t *) (((u8 *) qp) + vec_len (name_copy));
+ vec_free (name_copy);
+
+ qp->type = clib_host_to_net_u16 (DNS_TYPE_AAAA);
qp->class = clib_host_to_net_u16 (DNS_CLASS_IN);
/* Punch in space for the dns_header_t */
/* Ask for a recursive lookup */
h->flags = clib_host_to_net_u16 (DNS_RD | DNS_OPCODE_QUERY);
- h->qdcount = clib_host_to_net_u16 (1);
+ h->qdcount = clib_host_to_net_u16 (2);
h->nscount = 0;
h->arcount = 0;
dns_rr_t *rr;
int i, limit;
u8 len;
- u8 *curpos, *pos;
+ u8 *curpos, *pos, *pos2;
u16 flags;
u16 rcode;
u32 ttl;
+ int pointer_chase;
h = (dns_header_t *) response;
flags = clib_net_to_host_u16 (h->flags);
for (i = 0; i < limit; i++)
{
- pos = curpos;
+ pos = pos2 = curpos;
+ pointer_chase = 0;
/* Expect pointer chases in the answer section... */
- if ((pos[0] & 0xC0) == 0xC0)
- curpos += 2;
- else
+ if ((pos2[0] & 0xC0) == 0xC0)
{
- len = *pos++;
- while (len)
+ pos = pos2 + 2;
+ pos2 = response + ((pos2[0] & 0x3f) << 8) + pos2[1];
+ pointer_chase = 1;
+ }
+
+ len = *pos2++;
+
+ while (len)
+ {
+ pos2 += len;
+ if ((pos2[0] & 0xc0) == 0xc0)
{
- if ((pos[0] & 0xC0) == 0xC0)
- {
- curpos = pos + 2;
- goto curpos_set;
- }
- pos += len;
- len = *pos++;
+ /*
+ * If we've already done one pointer chase,
+ * do not move the pos pointer.
+ */
+ if (pointer_chase == 0)
+ pos = pos2 + 2;
+ pos2 = response + ((pos2[0] & 0x3f) << 8) + pos2[1];
+ len = *pos2++;
+ pointer_chase = 1;
}
- curpos = pos;
+ else
+ len = *pos2++;
}
- curpos_set:
- rr = (dns_rr_t *) curpos;
+ if (pointer_chase == 0)
+ pos = pos2;
+
+ rr = (dns_rr_t *) pos;
switch (clib_net_to_host_u16 (rr->type))
{
*min_ttlp = ttl;
rmp->ip6_set = 1;
break;
+
default:
break;
}
/* Might as well stop ASAP */
if (rmp->ip4_set && rmp->ip6_set)
break;
- curpos += sizeof (*rr) + clib_net_to_host_u16 (rr->rdlength);
+ pos += sizeof (*rr) + clib_net_to_host_u16 (rr->rdlength);
+ curpos = pos;
}
if ((rmp->ip4_set + rmp->ip6_set) == 0)
dns_rr_t *rr;
int i, limit;
u8 len;
- u8 *curpos, *pos;
+ u8 *curpos, *pos, *pos2;
u16 flags;
u16 rcode;
u8 *name;
u32 ttl;
u8 *junk __attribute__ ((unused));
int name_set = 0;
+ int pointer_chase;
h = (dns_header_t *) response;
flags = clib_net_to_host_u16 (h->flags);
for (i = 0; i < limit; i++)
{
- pos = curpos;
+ pos = pos2 = curpos;
+ pointer_chase = 0;
/* Expect pointer chases in the answer section... */
- if ((pos[0] & 0xC0) == 0xC0)
- curpos += 2;
- else
+ if ((pos2[0] & 0xC0) == 0xC0)
{
- len = *pos++;
- while (len)
+ pos = pos2 + 2;
+ pos2 = response + ((pos2[0] & 0x3f) << 8) + pos2[1];
+ pointer_chase = 1;
+ }
+
+ len = *pos2++;
+
+ while (len)
+ {
+ pos2 += len;
+ if ((pos2[0] & 0xc0) == 0xc0)
{
- if ((pos[0] & 0xC0) == 0xC0)
- {
- curpos = pos + 2;
- goto curpos_set;
- }
- pos += len;
- len = *pos++;
+ /*
+ * If we've already done one pointer chase,
+ * do not move the pos pointer.
+ */
+ if (pointer_chase == 0)
+ pos = pos2 + 2;
+ pos2 = response + ((pos2[0] & 0x3f) << 8) + pos2[1];
+ len = *pos2++;
+ pointer_chase = 1;
}
- curpos = pos;
+ else
+ len = *pos2++;
}
- curpos_set:
- rr = (dns_rr_t *) curpos;
+ if (pointer_chase == 0)
+ pos = pos2;
+
+ rr = (dns_rr_t *) pos;
switch (clib_net_to_host_u16 (rr->type))
{
name = vnet_dns_labels_to_name (rr->rdata, response, &junk);
memcpy (rmp->name, name, vec_len (name));
ttl = clib_net_to_host_u32 (rr->ttl);
- if (*min_ttlp)
+ if (min_ttlp)
*min_ttlp = ttl;
rmp->name[vec_len (name)] = 0;
name_set = 1;
/* Might as well stop ASAP */
if (name_set == 1)
break;
- curpos += sizeof (*rr) + clib_net_to_host_u16 (rr->rdlength);
+ pos += sizeof (*rr) + clib_net_to_host_u16 (rr->rdlength);
+ curpos = pos;
}
if (name_set == 0)
dm->max_ttl_in_seconds = 86400;
dm->random_seed = 0xDEADDABE;
- udp_register_dst_port (vm, UDP_DST_PORT_dns_reply, dns46_reply_node.index,
- 1 /* is_ip4 */ );
-
- udp_register_dst_port (vm, UDP_DST_PORT_dns_reply6, dns46_reply_node.index,
- 0 /* is_ip4 */ );
-
- udp_register_dst_port (vm, UDP_DST_PORT_dns, dns4_request_node.index,
- 1 /* is_ip4 */ );
-
- udp_register_dst_port (vm, UDP_DST_PORT_dns6, dns6_request_node.index,
- 0 /* is_ip4 */ );
return 0;
}
u8 *pos, *pos2;
dns_rr_t *rr;
int i;
- int initial_pointer_chase = 0;
+ int pointer_chase = 0;
u16 *tp;
u16 rrtype_host_byte_order;
s = format (s, " ");
/* chase pointer? almost always yes here... */
- if (pos2[0] == 0xc0)
+ if ((pos2[0] & 0xc0) == 0xc0)
{
- pos2 = reply + pos2[1];
- pos += 2;
- initial_pointer_chase = 1;
+ pos = pos2 + 2;
+ pos2 = reply + ((pos2[0] & 0x3f) << 8) + pos2[1];
+ pointer_chase = 1;
}
len = *pos2++;
vec_add1 (s, *pos2);
pos2++;
}
- len = *pos2++;
+ if ((pos2[0] & 0xc0) == 0xc0)
+ {
+ /*
+ * If we've already done one pointer chase,
+ * do not move the pos pointer.
+ */
+ if (pointer_chase == 0)
+ pos = pos2 + 2;
+ pos2 = reply + ((pos2[0] & 0x3f) << 8) + pos2[1];
+ len = *pos2++;
+ pointer_chase = 1;
+ }
+ else
+ len = *pos2++;
if (len)
{
if (verbose > 1)
}
}
- if (initial_pointer_chase == 0)
+ if (pointer_chase == 0)
pos = pos2;
rr = (dns_rr_t *) pos;
pos2 = rr->rdata;
/* chase pointer? */
- if (pos2[0] == 0xc0)
- pos2 = reply + pos2[1];
+ if ((pos2[0] & 0xc0) == 0xc0)
+ {
+ pos = pos2 + 2;
+ pos2 = reply + ((pos2[0] & 0x3f) << 8) + pos2[1];
+ }
len = *pos2++;
0x03, 0x63, 0x6f, 0x6d, 0x06, 0x61, 0x6b, 0x61, 0x64,
0x6e, 0x73, 0x03, 0x6e, 0x65, 0x74, 0x00,
};
-#else
+
+/* bind8 (linux widget, w/ nasty double pointer chasees */
+static u8 dns_reply_data_initializer[] = {
+ /* 0 */
+ 0x00, 0x01, 0x81, 0x80, 0x00, 0x01, 0x00, 0x08,
+ /* 8 */
+ 0x00, 0x06, 0x00, 0x06, 0x0a, 0x6f, 0x72, 0x69,
+ /* 16 */
+ 0x67, 0x69, 0x6e, 0x2d, 0x77, 0x77, 0x77, 0x05,
+ /* 24 */
+ 0x63, 0x69, 0x73, 0x63, 0x6f, 0x03, 0x63, 0x6f,
+ /* 32 */
+ 0x6d, 0x00, 0x00, 0xff, 0x00, 0x01, 0x0a, 0x6f,
+ /* 40 */
+ 0x72, 0x69, 0x67, 0x69, 0x6e, 0x2d, 0x77, 0x77,
+ /* 48 */
+ 0x77, 0x05, 0x43, 0x49, 0x53, 0x43, 0x4f, 0xc0,
+
+ /* 56 */
+ 0x1d, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x05,
+
+ /* 64 */
+ 0x9a, 0x00, 0x18, 0x15, 0x72, 0x63, 0x64,
+ 0x6e, 0x39, 0x2d, 0x31, 0x34, 0x70, 0x2d, 0x64, 0x63,
+ 0x7a, 0x30, 0x35, 0x6e, 0x2d, 0x67, 0x73, 0x73, 0x31,
+ 0xc0, 0x17, 0xc0, 0x26, 0x00, 0x02, 0x00, 0x01, 0x00,
+ 0x00, 0x05, 0x9a, 0x00, 0x1a, 0x17, 0x61, 0x6c, 0x6c,
+ 0x6e, 0x30, 0x31, 0x2d, 0x61, 0x67, 0x30, 0x39, 0x2d,
+ 0x64, 0x63, 0x7a, 0x30, 0x33, 0x6e, 0x2d, 0x67, 0x73,
+ 0x73, 0x31, 0xc0, 0x17, 0xc0, 0x26, 0x00, 0x02, 0x00,
+ 0x01, 0x00, 0x00, 0x05, 0x9a, 0x00, 0x10, 0x0d, 0x72,
+ 0x74, 0x70, 0x35, 0x2d, 0x64, 0x6d, 0x7a, 0x2d, 0x67,
+ 0x73, 0x73, 0x31, 0xc0, 0x17, 0xc0, 0x26, 0x00, 0x02,
+ 0x00, 0x01, 0x00, 0x00, 0x05, 0x9a, 0x00, 0x18, 0x15,
+ 0x6d, 0x74, 0x76, 0x35, 0x2d, 0x61, 0x70, 0x31, 0x30,
+ 0x2d, 0x64, 0x63, 0x7a, 0x30, 0x36, 0x6e, 0x2d, 0x67,
+ 0x73, 0x73, 0x31, 0xc0, 0x17, 0xc0, 0x26, 0x00, 0x02,
+ 0x00, 0x01, 0x00, 0x00, 0x05, 0x9a, 0x00, 0x1b, 0x18,
+ 0x73, 0x6e, 0x67, 0x64, 0x63, 0x30, 0x31, 0x2d, 0x61,
+ 0x62, 0x30, 0x37, 0x2d, 0x64, 0x63, 0x7a, 0x30, 0x31,
+ 0x6e, 0x2d, 0x67, 0x73, 0x73, 0x31, 0xc0, 0x17, 0xc0,
+ 0x26, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x05, 0x9a,
+ 0x00, 0x1a, 0x17, 0x61, 0x65, 0x72, 0x30, 0x31, 0x2d,
+ 0x72, 0x34, 0x63, 0x32, 0x35, 0x2d, 0x64, 0x63, 0x7a,
+ 0x30, 0x31, 0x6e, 0x2d, 0x67, 0x73, 0x73, 0x31, 0xc0,
+ 0x17, 0xc0, 0x26, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x81, 0x00, 0x04, 0x48, 0xa3, 0x04, 0xa1, 0xc0,
+ 0x26, 0x00, 0x1c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x82,
+ 0x00, 0x10, 0x20, 0x01, 0x04, 0x20, 0x12, 0x01, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a,
+ 0xc0, 0x0c, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x05,
+ 0x9a, 0x00, 0x02, 0xc0, 0xf4, 0xc0, 0x0c, 0x00, 0x02,
+ 0x00, 0x01, 0x00, 0x00, 0x05, 0x9a, 0x00, 0x02, 0xc0,
+ 0xcd, 0xc0, 0x0c, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00,
+ 0x05, 0x9a, 0x00, 0x02, 0xc0, 0x8d, 0xc0, 0x0c, 0x00,
+ 0x02, 0x00, 0x01, 0x00, 0x00, 0x05, 0x9a, 0x00, 0x02,
+ 0xc0, 0x43, 0xc0, 0x0c, 0x00, 0x02, 0x00, 0x01, 0x00,
+ 0x00, 0x05, 0x9a, 0x00, 0x02, 0xc0, 0xa9, 0xc0, 0x0c,
+ 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x05, 0x9a, 0x00,
+ 0x02, 0xc0, 0x67, 0xc0, 0x8d, 0x00, 0x01, 0x00, 0x01,
+ 0x00, 0x00, 0x07, 0x08, 0x00, 0x04, 0x40, 0x66, 0xf6,
+ 0x05, 0xc0, 0xa9, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
+ 0x07, 0x08, 0x00, 0x04, 0xad, 0x24, 0xe0, 0x64, 0xc0,
+ 0x43, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x07, 0x08,
+ 0x00, 0x04, 0x48, 0xa3, 0x04, 0x1c, 0xc0, 0xf4, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x00, 0x07, 0x08, 0x00, 0x04,
+ 0xad, 0x26, 0xd4, 0x6c, 0xc0, 0x67, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x00, 0x07, 0x08, 0x00, 0x04, 0xad, 0x25,
+ 0x90, 0x64, 0xc0, 0xcd, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x00, 0x07, 0x08, 0x00, 0x04, 0xad, 0x27, 0x70, 0x44,
+};
+
/* google.com */
static u8 dns_reply_data_initializer[] =
{ 0x0, 0x0, 0x81, 0x80, 0x0, 0x1, 0x0, 0xe, 0x0, 0x0, 0x0, 0x0, 0x6,
0x57,
0x0, 0x9, 0x0, 0x14, 0x4, 0x61, 0x6c, 0x74, 0x31, 0xc0, 0x9b
};
+
+#else
+/* www.weatherlink.com */
+static u8 dns_reply_data_initializer[] = {
+ 0x00, 0x00, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x77, 0x77, 0x77, 0x0b,
+ 0x77, 0x65, 0x61, 0x74, 0x68, 0x65, 0x72, 0x6c, 0x69,
+ 0x6e, 0x6b, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0xff,
+ 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x05, 0x00, 0x01, 0x00,
+ 0x00, 0x0c, 0x9e, 0x00, 0x1f, 0x0e, 0x64, 0x33, 0x6b,
+ 0x72, 0x30, 0x67, 0x75, 0x62, 0x61, 0x31, 0x64, 0x76,
+ 0x77, 0x66, 0x0a, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x66,
+ 0x72, 0x6f, 0x6e, 0x74, 0x03, 0x6e, 0x65, 0x74, 0x00,
+};
+
#endif
static clib_error_t *
vlib_cli_output (vm, "%U", format_dns_reply, dns_reply_data, verbose);
- memset (rmp, 0, sizeof (*rmp));
+ clib_memset (rmp, 0, sizeof (*rmp));
rv = vnet_dns_response_to_reply (dns_reply_data, rmp, 0 /* ttl-ptr */ );
vlib_cli_command_t * cmd)
{
dns_main_t *dm = &dns_main;
- u8 *name;
+ u8 *name = 0;
uword *p;
clib_error_t *e;
dns_cache_entry_t *ep;
vec_add1 (name, 0);
_vec_len (name) -= 1;
}
+ else
+ return clib_error_return (0, "no name provided");
dns_cache_lock (dm);
dns_cache_entry_t * ep, vlib_buffer_t * b0)
{
vlib_main_t *vm = dm->vlib_main;
- u32 bi;
+ u32 bi = 0;
fib_prefix_t prefix;
fib_node_index_t fei;
u32 sw_if_index, fib_index;
if (pr->request_type == DNS_PEER_PENDING_NAME_TO_IP)
{
/* Quick and dirty way to dig up the A-record address. $$ FIXME */
- memset (rnr, 0, sizeof (*rnr));
+ clib_memset (rnr, 0, sizeof (*rnr));
if (vnet_dns_response_to_reply (ep->dns_response, rnr, &ttl))
{
/* clib_warning ("response_to_reply failed..."); */
}
else if (pr->request_type == DNS_PEER_PENDING_IP_TO_NAME)
{
- memset (rir, 0, sizeof (*rir));
+ clib_memset (rir, 0, sizeof (*rir));
if (vnet_dns_response_to_name (ep->dns_response, rir, &ttl))
{
/* clib_warning ("response_to_name failed..."); */
* In the resolution-required / deferred case, resetting a freshly-allocated
* buffer won't hurt. We hope.
*/
- b0->flags &= VLIB_BUFFER_FREE_LIST_INDEX_MASK;
b0->flags |= (VNET_BUFFER_F_LOCALLY_ORIGINATED
| VLIB_BUFFER_TOTAL_LENGTH_VALID);
b0->current_data = 0;
}
/* *INDENT-OFF* */
- foreach_ip_interface_address(lm4, ia, sw_if_index, 1 /* honor unnummbered */,
+ foreach_ip_interface_address(lm4, ia, sw_if_index, 1 /* honor unnumbered */,
({
src_address = ip_interface_address_get_address (lm4, ia);
goto found_src_address;
ip = vlib_buffer_get_current (b0);
udp = (udp_header_t *) (ip + 1);
dns_response = (u8 *) (udp + 1);
- memset (ip, 0, sizeof (*ip) + sizeof (*udp));
+ clib_memset (ip, 0, sizeof (*ip) + sizeof (*udp));
/*
* Start with the variadic portion of the exercise.