android dns之dns服务器可用性机制,成功率低于门限则惩罚抑制(一)

1 dns服务器可用性检测

1.1 send dns请求前,所有dns server是否可用,可用性结果保存到usable_servers[]。

bionic\libc\dns\resolv\res_send.c

int
res_nsend(res_state statp,
	  const u_char *buf, int buflen, u_char *ans, int anssiz)
{
......
	    bool usable_servers[MAXNS];
	    android_net_res_stats_get_usable_servers(&params, stats, statp->nscount,
		    usable_servers);

	    for (ns = 0; ns < statp->nscount; ns++) {
		if (!usable_servers[ns]) continue;

1.2 通过_res_stats_usable_server遍历检查每个DNS server的可用性。如果检测为都不可用,则调整为都可用。

bionic\libc\dns\resolv\res_stats.c

android_net_res_stats_get_usable_servers(const struct __res_params* params,
        struct __res_stats stats[], int nscount, bool usable_servers[]) {
    unsigned usable_servers_found = 0;
    for (int ns = 0; ns < nscount; ns++) {
        bool usable = _res_stats_usable_server(params, &stats[ns]);
        if (usable) {
            ++usable_servers_found;
        }
        usable_servers[ns] = usable;
    }
    // If there are no usable servers, consider all of them usable.
    // TODO: Explore other possibilities, such as enabling only the best N servers, etc.
    if (usable_servers_found == 0) {
        for (int ns = 0; ns < nscount; ns++) {
            usable_servers[ns] = true;
        }
    }
}

1.3 _res_stats_usable_server检查

1.3.1 dns全局cache链_res_cache_list,一张网络netid对应一个链节点Cache,含该网络的dns统计__res_stats(最大4个NS的统计)

// Head of the list of caches.  Protected by _res_cache_list_lock.
static struct resolv_cache_info _res_cache_list;

struct resolv_cache_info {
    unsigned                    netid;
    Cache*                      cache;
    struct resolv_cache_info*   next;
    int                         nscount;
    char*                       nameservers[MAXNS];
    struct addrinfo*            nsaddrinfo[MAXNS];
    int                         revision_id; // # times the nameservers have been replaced
    struct __res_params         params;
    struct __res_stats          nsstats[MAXNS];
    char                        defdname[MAXDNSRCHPATH];
    int                         dnsrch_offset[MAXDNSRCH+1];  // offsets into defdname
/*AR000AT6PU liuheng 00308202 20180720 begin */
    bool                       isipv6optimizationopen;
    int                         ipv6timeout;
    unsigned                 iptype;// ipaddrtype ipv4,ipv6 or ipv4v6
    int                         servicetype;
    unsigned                 ipv6domainblacklistcount;
    char*                     domainblacklist[IPV6MAXBLACKLISTLEN];
/*AR000AT6PU liuheng 00308202 20180720 end */
};

1.3.1 dns参数(含惩罚门限)

1.3.1.1 成功率门限75% SUCCESS_THRESHOLD 75
1.3.1.2 默认sample有效期1800秒 #define NSSAMPLE_VALIDITY 1800
/* Hard-coded defines */
#define MAXNS			4	/* max # name servers we'll track */
#define MAXDNSRCH		6	/* max # domains in search path */
#define MAXDNSRCHPATH		256	/* max length of domain search paths */
#define MAXNSSAMPLES		64	/* max # samples to store per server */

/* Defaults used for initializing __res_params */
#define SUCCESS_THRESHOLD	75	/* if successes * 100 / total_samples is less than
					 * this value, the server is considered failing
					 */
#define NSSAMPLE_VALIDITY	1800	/* Sample validity in seconds.
					 * Set to -1 to disable skipping failing
					 * servers.
					 */

/* If EDNS0_PADDING is defined, queries will be padded to a multiple of this length
when EDNS0 is active. */
#define EDNS0_PADDING	128

/* per-netid configuration parameters passed from netd to the resolver */
struct __res_params {
    uint16_t sample_validity; // sample lifetime in s
    // threshold of success / total samples below which a server is considered broken
    uint8_t success_threshold; // 0: disable, value / 100 otherwise
    uint8_t min_samples; // min # samples needed for statistics to be considered meaningful
    uint8_t max_samples; // max # samples taken into account for statistics
};

1.3.2 dns server可用性统计参数

bionic\libc\dns\include\resolv_stats.h
__res_stats,针对一个dns server的统计,记录了最近sample_count个dns请求记录的时延等结果

#define RCODE_INTERNAL_ERROR    254
#define RCODE_TIMEOUT           255

/*
 * Resolver reachability statistics and run-time parameters.
 */

struct __res_sample {
    time_t			at;    // time in s at which the sample was recorded
    uint16_t			rtt;   // round-trip time in ms
    uint8_t			rcode; // the DNS rcode or RCODE_XXX defined above
};

struct __res_stats {
    // Stats of the last <sample_count> queries.
    struct __res_sample		samples[MAXNSSAMPLES];
    // The number of samples stored.
    uint8_t			sample_count;
    // The next sample to modify.
    uint8_t			sample_next; //下一个sample将存放到数组里的索引
};
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
EPSFB独立性设置提升回落成功率 问题名称:《EPSFB独立性设置提升回落成功率》 问题描述: 在 EPS Fallback测试中,SA用户需要返回4G进行语音业务,因此4G网络决 定了语音的感知。为了减少参数配置问题(配置错误或配置复杂)对现网的感知 和工作量带来的不利影响,针对SA终端,设置一套独立的移动性策略,适配现场 的参数设置需求。 解决方案 详细说明 问题分析: 1. SA用户独立移动性策略如下 在泉州SA测试中,为了提升EPS Fallback成 功 率 (§ 成功率),减少终端的异频测量的次数和时间,结合现场FDD 均 RSRP=79dBm, SINR=15. 19dB), 且覆盖连续,现场采用了 略 (设置非目标频点回落优先级为0), 且针对SA终端设置现 频 A2起测门限设置为-120), 让终端回落后完全驻留在FDDH 性参数配置,实现了个性化的场景需求。 2. SA独立移动策略配置 1) 针对现场各频段进行锁频测试,发现现场FDD1800的第 79dBm, SINR=15. 19dB), 如下: ④ 璃 金 体 含 私 st ⑥ 红 皿 城 、 Γ Z m Γ ⅛ ⅛ ≡ ⅜ . 下n 下 吊 鐘 江 余 坨 公 国 ■ , Jr .) ■州W S<κ>≡e | 上其■旳 / w**二lZ - ∖ 金市恰安1 匚公弟 CS3 ⑥ 妙 — 、 国 弋 小 学 ] ⅛ rt,∙* 、 ■ “ n安 "小 区 耳钝 ⑥ 日 ■ 国 皿 j / ⑥ ■ 或 网 42号 . 建大 &店 依 国 1 ∖ ③ … E 校 ⑥ 教 标 新 忖 B 建糸 @)«fl为时代 ) 中山四锚7型小g 4HI x>v - . —一 GlWA∙fBf*l__ 夹质是提升5to4切换 1800的覆盖情况(平 仅回落FDD1800的策 (立的移动性策略(异 ≡ o通过独立的移动 1盖情况(平均RSRP二-

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值