android clear dns bug處理

問題:服務器IP改變以後,android dns cache 由於沒有被清除,導致域名解析出錯。

http://stackoverflow.com/questions/2101762/android-flush-dns

同時 android dns cache 緩存清除沒有提供上層接口,但是android 系統層卻提供了這種功能,因此需要導出api 給上層程序使用。

查看ndc interface list

interface list
readrxcounter| readtxcounter
getthrottle<iface><”rx|tx”>
setthrottle<iface><rx_kbps|tx_kbps>
driver<iface><cmd><args>
route<add|remove> <iface> <”default|secondary”><dst> <prefix> <gateway>
list_ttys  
ipfwd status
enable|disable
tether status
start-reverse|stop-reverse
stop<
start<addr_1 addr_2 addr_3 addr_4 [addr_2n]>
interface<add|remove|list>
dnslist
dnsset <addr_1> < addr_2>
nat <enable|disable><iface><extface><addrcnt><nated-ipaddr/prelength>
pppd attach<tty> <addr_local> <add_remote> <dns_1><dns_2>
detach<tty>
softap startap|stopap
fwreload<iface> <AP|P2P>
clients
status
set<iface> <SSID> <wpa-psk|wpa2-psk|open> [<key><channel> <preamble><max SCB>]
resolver setdefaultif<iface>
setifdns<iface><dns_1><dns_2>
flushdefaultif
flushif<iface>
bandwith enable|disable
removequota|rq
getquota|gq
getiquota|giq<iface>
setquota|sq<bytes> <iface>
removequota|rqs<iface>
removeiiquota|riq<iface>
setiquota|sq<interface><bytes>
addnaughtyapps|ana<appUid>
removenaughtyapps|rna<appUid>
setgolbalalert|sga<bytes>
debugsettetherglobalalert|dstga<iface0><iface1>
setsharedalert|ssa<bytes>
removesharedalert|rsa
setinterfacealert|sia<iface><bytes>
removeinterfacealert|ria<iface>
gettetherstats|gts<iface0><iface1>
idletimer enable|disable
add|remove<iface><timeout><classLabel>
firewall enable|disable|is_enabled
set_interface_rule<rmnet0><allow|deny>
set_egress_source_rule<ip_addr><allow|deny>
set_egress_dest_rule<ip_addr><port><allow|deny>
set_uid_rule<uid><allow|deny>
clatd stop|status|start<iface>


在實際代碼調試時,可用flushdefaultif 命令清除DNS,實際代碼中可以通過分析flushdefualtif命令流程,新增api接口供上層使用。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章