aboutsummaryrefslogtreecommitdiffstats
path: root/build
AgeCommit message (Expand)AuthorFilesLines
2019-03-22dpdk: add ENIC PMD patch to untag default vlanHyong Youb Kim1-0/+31
2019-03-01dpdk: update mlx[45] linking optionsMatthew Smith1-3/+2
2019-02-14make install-ext-deps broken.Paul Vinciguerra1-1/+1
2019-02-02dpdk: bump to dpdk 19.02Damjan Marion10-1233/+2
2018-12-12dpdk: net/bonding: fix buffer corruption in packetsIgor Mikhailov (imichail)1-0/+203
2018-11-29dpdk: bump to DPDK 18.11Damjan Marion1-2/+2
2018-11-05dpdk: enable gso when the tap PMD is enabledMatthew Smith1-1/+1
2018-10-26dpdk: fix mlx5 build on SUSEStephen Hemminger1-0/+39
2018-10-26dpdk: ENA PMD patch for failure on port restartMatthew Smith1-0/+359
2018-10-25Address "is already installed" Jenkins issueMarco Varlese1-1/+1
2018-10-24dpdk: disable unused rxtx callbacks in ethdevStephen Hemminger1-0/+1
2018-10-20dpdk: turn off unused DPDK componentsStephen Hemminger1-0/+17
2018-10-15dpdk: drop no longer used config optionsStephen Hemminger1-6/+0
2018-10-11Fix vpp-ext-deps package version in stable branchDamjan Marion1-1/+1
2018-10-01dpdk: updated makefile to enable QAT cryptodevRadu Nicolau1-0/+1
2018-09-27dpdk_plugin: fix mlx5 build and runtime issuesSirshak Das1-1/+2
2018-09-27fix typo in vpp-ext-deps rpm packagingDamjan Marion1-1/+1
2018-09-25dpdk: add patch to fix 25G AOC cable detectionDamjan Marion1-0/+30
2018-09-21add: nasm and ipsec-mb into vpp-ext-deps packagingDamjan Marion16-397/+547
2018-09-20rename vpp-dpdk-dev to vpp-ext-depsDamjan Marion14-0/+1233
nd-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2017 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef included_dns_h
#define included_dns_h

#include <vppinfra/time.h>
#include <vppinfra/cache.h>
#include <vppinfra/error.h>

#include <vppinfra/hash.h>
#include <vnet/dns/dns_packet.h>
#include <vnet/ip/ip.h>

typedef struct
{
  u32 request_type;
  u32 client_index;
  u32 client_context;
} pending_api_request_t;

#define DNS_API_PENDING_NAME_TO_IP 1
#define DNS_API_PENDING_IP_TO_NAME 2

typedef struct
{
  /** flags */
  volatile u8 flags;

  /** The name in "normal human being" notation, e.g. www.foobar.com */
  u8 *name;

  /** For CNAME records, the "next name" to resolve */
  u8 *cname;

  /** Expiration time */
  f64 expiration_time;

  /** Cached dns request, for sending retries */
  u8 *dns_request;

  /** Retry parameters */
  int retry_count;
  int server_rotor;
  int server_af;
  f64 retry_timer;

  /** Cached dns response */
  u8 *dns_response;

  /** Clients awaiting responses */
  pending_api_request_t *pending_api_requests;
  ip4_address_t *ip4_peers_to_notify;
  ip6_address_t *ip6_peers_to_notify;
} dns_cache_entry_t;

#define DNS_CACHE_ENTRY_FLAG_VALID	(1<<0) /**< we have Actual Data */
#define DNS_CACHE_ENTRY_FLAG_STATIC	(1<<1) /**< static entry */
#define DNS_CACHE_ENTRY_FLAG_CNAME	(1<<2) /**< CNAME (indirect) entry */

#define DNS_RETRIES_PER_SERVER 3

#define DNS_RESOLVER_EVENT_RESOLVED	1
#define DNS_RESOLVER_EVENT_PENDING	2


typedef struct
{
  /** Pool of cache entries */
  dns_cache_entry_t *entries;

  /** Pool indices of unresolved entries */
  u32 *unresolved_entries;

  /** Find cached record by name */
  uword *cache_entry_by_name;
  uword *cache_lock;

  /** enable / disable flag */
  int is_enabled;

  /** upstream name servers, e.g. 8.8.8.8 */
  ip4_address_t *ip4_name_servers;
  ip6_address_t *ip6_name_servers;

  /** config parameters */
  u32 name_cache_size;
  u32 max_ttl_in_seconds;
  u32 random_seed;

  /* convenience */
  vlib_main_t *vlib_main;
  vnet_main_t *vnet_main;
} dns_main_t;

extern dns_main_t dns_main;

extern vlib_node_registration_t dns46_reply_node;
extern vlib_node_registration_t dns_resolver_node;

#define foreach_dns46_reply_error                       \
_(PROCESSED, "DNS reply pkts processed")                \
_(NO_ELT, "No DNS pool element")                        \
_(FORMAT_ERROR, "DNS format errors")                    \
_(TEST_DROP, "DNS reply pkt dropped for test purposes")

typedef enum
{
#define _(sym,str) DNS46_REPLY_ERROR_##sym,
  foreach_dns46_reply_error
#undef _
    DNS46_REPLY_N_ERROR,
} dns46_reply_error_t;

void vnet_send_dns_request (dns_main_t * dm, dns_cache_entry_t * ep);
int
vnet_dns_cname_indirection_nolock (dns_main_t * dm, u32 ep_index, u8 * reply);

int vnet_dns_delete_entry_by_index_nolock (dns_main_t * dm, u32 index);

format_function_t format_dns_reply;

static inline void
dns_cache_lock (dns_main_t * dm)
{
  if (dm->cache_lock)
    {
      while (__sync_lock_test_and_set (dm->cache_lock, 1))
	;
    }
}

static inline void
dns_cache_unlock (dns_main_t * dm)
{
  if (dm->cache_lock)
    {
      CLIB_MEMORY_BARRIER ();
      *dm->cache_lock = 0;
    }
}

#endif /* included_dns_h */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */