daraosn / ardrone-wpa2

WPA2 support for AR Drone 2.0
MIT License
126 stars 49 forks source link

DNS Support #1

Open felixge opened 11 years ago

felixge commented 11 years ago

Hi Diego,

just tried out ardrone-wpa2 and it's working like a charm! Thank you so much for doing this!!!

Did you figure out how to get DNS resolution working? I just tried adding my router to /etc/resolv.conf (which required me to rm the broken symlink that was in there), but it doesn't work. Any idea?

daraosn commented 11 years ago

Thanks Felix, glad it has worked cool for you :-)

I'm not 100% sure but I think we need more cross-compile work to be done for: host, bind and/or nslookup commands.

Anyway, I'll do some research tonight and get back with more info.

felixge commented 11 years ago

@daraosn no worries / no rush. I don't need it right now, but having this eventually would be nice to really do internet stuff with the drone!

daraosn commented 11 years ago

I'm on this. Found something useful (not 100% related, but really cool)

DHCP client: /sbin/udhcpc -i ath0

felixge commented 11 years ago

/sbin/udhcpc -i ath0

So this could be used to make the router assign an IP to the drone?

daraosn commented 11 years ago

Exactly :)

I just pushed a commit. Now is even simpler to connect the drone to a router. You can set Static DHCP leases with the Drone's MAC address and have always the same IP when it connects.

I'm still working on the DNS resolution issue.

daraosn commented 11 years ago

Some progress:

BusyBox actually has nslookup but you're right, /etc/resolv.conf won't help.

Even when you do nslookup google.com 8.8.8.8 using google's dns server, it won't work. I found some stuff that might lead to the fix: https://code.google.com/p/android-sapphire/issues/detail?id=19 https://sites.google.com/site/delocatedsystems/home/announcements/wgetresolutionfixed

felixge commented 11 years ago

@daraosn nice work! So seems like this guy has a patch but isn't giving it out? : )

felixge commented 11 years ago

Just tried the DHCP support which seems to work. However, what's the best way to find the new IP of the drone? I had to get it from my router, but IMO this may be unpractical in some cases.

daraosn commented 11 years ago

@felixge yeah, unfortunately it seems like he won't give it for free, but some more people reporting problem, more research to be done.

Regarding DHCP, I just set a DHCP Static Lease for the AR Drone MAC address. Then whenever you connect to it the network, the router will take care of always giving the same IP.

I agree though that it might be unpractical in some cases, and that's why it's still possible to pass the -a flag to give the desired address and avoid DHCP :-)

felixge commented 11 years ago

I agree though that it might be unpractical in some cases, and that's why it's still possible to pass the -a flag to give the desired address and avoid DHCP :-)

Yeah, that's good enough.

antlai commented 11 years ago

I managed to get DNS working by copying libresolv-2.15.so (from armtools/arm-none-linux-gnueabi/libc/lib) in /lib and creating the link /lib/libresolv.so.2 to it

daraosn commented 11 years ago

I can confirm is working!! Thanks for sharing @antlai. Now to install 3G stick.

➜  ardrone-wpa2 git:(master) ✗ telnet 192.168.1.101
Trying 192.168.1.101...
Connected to drone1.
Escape character is '^]'.

BusyBox v1.14.0 () built-in shell (ash)
Enter 'help' for a list of built-in commands.

# wget http://google.com
wget: bad address 'google.com'
# route add default gw 192.168.1.1 ath0
# wget -O - http://www.google.com/
Connecting to www.google.com (173.194.113.179:80)
-                    100% |*******************************|     0  --:--:-- ETA<!doctype html><html itemscope="itemscope" itemtype="http://schema.org/WebPage"><head><meta itemprop="image" content="/images/google_favicon_128.png"><title>Google</title><script>(function(){
window.google={kEI:"E1q-UdCzE8fdsgaPhIBw",getEI:function(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||google.kEI},https:function(){return"https:"==window.location.protocol},kEXPI:"17259,4000116,4001350,4001947,4002464,4002693,4002854,4003881,4004205,4004320,4004334,4004788,4004844,4004949,4005031,4005613,4005986,4006339,4006347,4006425,4006442,4006466,4006727,4007009,4007055,4007077,4007080,4007117,4007158,4007173,4007232,4007296,4007311,4007322,4007328,4007418,4007425,4007445,4007482,4007489,4007490,4007533,4007566,4007683,4007715,4007779,4007788,4007798,4007850,4007851",kCSI:{e:"17259,4000116,4001350,4001947,4002464,4002693,4002854,4003881,4004205,4004320,4004334,4004788,4004844,4004949,4005031,4005613,4005986,4006339,4006347,4006425,4006442,4006466,4006727,4007009,4007055,4007077,4007080,4007117,4007158,4007173,4007232,4007296,4007311,4007322,4007328,4007418,4007425,4007445,4007482,4007489,4007490,4007533,4007566,4007683,4007715,4007779,4007788,4007798,4007850,4007851",ei:"E1q-UdCzE8fdsgaPhIBw"},authuser:0,ml:function(){},kHL:"de",time:function(){return(new Date).getTime()},log:function(a,b,c,h){var d=new Image,f=google.lc,e=google.li,g="";d.onerror=d.onload=
d.onabort=function(){delete f[e]};f[e]=d;c||-1!=b.search("&ei=")||(g="&ei="+google.getEI(h));c=c||"/gen_204?atyp=i&ct="+a+"&cad="+b+g+"&zx="+google.time();a=/^http:/i;
a.test(c)&&google.https()?(google.ml(Error("GLMM"),!1,{src:c}),delete f[e]):(d.src=c,google.li=e+1)},lc:[],li:0,Toolbelt:{},y:{},x:function(a,b){google.y[a.id]=[a,b];return!1},load:function(a,b){google.x({id:a+k++},function(){google.load(a,b)})}};var k=0;})();
(function(){google.sn="webhp";google.timers={};google.startTick=function(a,b){google.timers[a]={t:{start:google.time()},bfr:!!b}};google.tick=function(a,b,g){google.timers[a]||google.startTick(a);google.timers[a].t[b]=g||google.time()};google.startTick("load",!0);
try{}catch(d){}})();
var _gjwl=location;function _gjuc(){var a=_gjwl.href.indexOf("#");if(0<=a&&(a=_gjwl.href.substring(a),0<a.indexOf("&q=")||0<=a.indexOf("#q="))&&(a=a.substring(1),-1==a.indexOf("#"))){for(var d=0;d<a.length;){var b=d;"&"==a.charAt(b)&&++b;var c=a.indexOf("&",b);-1==c&&(c=a.length);b=a.substring(b,c);if(0==b.indexOf("fp="))a=a.substring(0,d)+a.substring(c,a.length),c=d;else if("cad=h"==b)return 0;d=c}_gjwl.href="/search?"+a+"&cad=h";return 1}return 0}
function _gjp(){window._gjwl.hash&&window._gjuc()||setTimeout(_gjp,500)};
window._gjp&&_gjp();</script><style>#gbar,#guser{font-size:13px;padding-top:1px !important;}#gbar{height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}@media all{.gb1{height:22;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{text-decoration:underline !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf .gb4{color:#900 !important}</style><style>.h{font-family:arial,sans-serif}body{font-family:arial,sans-serif}td{font-family:arial,sans-serif}a{font-family:arial,sans-serif}p{font-family:arial,sans-serif}body{margin:0;overflow-y:scroll}#gog{padding:3px 8px 0}.h{color:#36c}.q{color:#00c}.ts{border-collapse:collapse}td{line-height:.8em}.gac_m td{line-height:17px}form{margin-bottom:20px}.ts td{padding:0}em{font-weight:bold;font-style:normal}.lst{height:25px;width:496px;font:18px arial,sans-serif}.gsfi{font:18px arial,sans-serif}.gsfs{font:17px arial,sans-serif}.ds{display:inline-box;display: inline-block;margin:3px 0 4px;margin-left:4px}input{font-family:inherit}body{background:#fff;color:black}a.gb1{color:#11c !important}a.gb2{color:#11c !important}a.gb3{color:#11c !important}a.gb4{color:#11c !important}.sblc{padding-top:5px}.lsbb{background:#eee;border:solid 1px;border-color:#ccc #999 #999 #ccc;height:30px}a{color:#11c;text-decoration:none}a:hover{text-decoration:underline}a:active{text-decoration:underline}.fl a{color:#36c}a:visited{color:#551a8b}a.gb1{text-decoration:underline}a.gb4{text-decoration:underline}a.gb3:hover{text-decoration:none}.sblc a{display:block;margin:2px 0;margin-left:13px;font-size:11px}#ghead a.gb2:hover{color:#fff !important}.lsbb{display:block}.ftl{display:inline-block;margin:0 12px}.lsb{background:url(/images/srpr/nav_logo80.png) 0 -258px repeat-x;border:none;color:#000;cursor:pointer;height:30px;margin:0;outline:0;font:15px arial,sans-serif;vertical-align:top}#fll a{display:inline-block;margin:0 12px}.lsb:active{background:#ccc}.lst:focus{outline:none}#addlang a{padding:0 3px}</style><script></script> </head><body bgcolor="#fff"><script>(function(){var src='/images/srpr/nav_logo80.png';var iesg=false;document.body.onload = function(){window.n && window.n();if (document.images){new Image().src=src;}
if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbqf.q.focus();}
}
})();</script><textarea id="csi" style="display:none"></textarea><div id="mngb"><div id=gbar><nobr><b class=gb1>Suche</b> <a class=gb1 href="http://www.google.de/imghp?hl=de&tab=wi">Bilder</a> <a class=gb1 href="http://maps.google.de/maps?hl=de&tab=wl">Maps</a> <a class=gb1 href="https://play.google.com/?hl=de&tab=w8">Play</a> <a class=gb1 href="http://www.youtube.com/?gl=DE&tab=w1">YouTube</a> <a class=gb1 href="http://news.google.de/nwshp?hl=de&tab=wn">News</a> <a class=gb1 href="https://mail.google.com/mail/?tab=wm">Gmail</a> <a class=gb1 href="https://drive.google.com/?tab=wo">Drive</a> <a class=gb1 style="text-decoration:none" href="http://www.google.de/intl/de/options/"><u>Mehr</u> &raquo;</a></nobr></div><div id=guser width=100%><nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span id=gbe></span><a href="http://www.google.de/history/optout?hl=de" class=gb4>Webprotokoll</a> | <a  href="/preferences?hl=de" class=gb4>Einstellungen</a> | <a target=_top id=gb_70 href="https://accounts.google.com/ServiceLogin?hl=de&continue=http://www.google.de/" class=gb4>Anmelden</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div></div><center><br clear="all" id="lgpd"><div id="lga"><div style="padding:28px 0 3px"><div title="Google" align="left" id="hplogo" onload="window.lol&&lol()" style="height:110px;width:276px;background:url(/images/srpr/logo1w.png) no-repeat"><div nowrap="nowrap" style="color:#777;font-size:16px;font-weight:bold;position:relative;left:214px;top:70px">Deutschland</div></div></div><br></div><form action="/search" name="f"><table cellpadding="0" cellspacing="0"><tr valign="top"><td width="25%">&nbsp;</td><td align="center" nowrap="nowrap"><input name="ie" value="ISO-8859-1" type="hidden"><input value="de" name="hl" type="hidden"><input name="source" type="hidden" value="hp"><div class="ds" style="height:32px;margin:4px 0"><input autocomplete="off" class="lst" value="" title="Google-Suche" maxlength="2048" name="q" size="57" style="color:#000;margin:0;padding:5px 8px 0 6px;vertical-align:top"></div><br style="line-height:0"><span class="ds"><span class="lsbb"><input class="lsb" value="Google-Suche" name="btnG" type="submit"></span></span><span class="ds"><span class="lsbb"><input class="lsb" value="Auf gut Gl?ck!" name="btnI" type="submit" onclick="if(this.form.q.value)this.checked=1; else top.location='/doodles/'"></span></span></td><td class="fl sblc" align="left" nowrap="nowrap" width="25%"><a href="/advanced_search?hl=de&amp;authuser=0">Erweiterte Suche</a><a href="/language_tools?hl=de&amp;authuser=0">Sprachoptionen</a></td></tr></table><input type="hidden" id="gbv" name="gbv" value="1"></form><div id="gac_scont"></div><div style="font-size:83%;min-height:3.5em"><br></div><span id="footer"><div style="font-size:10pt"><div id="fll" style="margin:19px auto;text-align:center"><a href="/intl/de/ads/">Werben mit Google</a><a href="/services/">Unternehmensangebote</a><a href="https://plus.google.com/117570067846637741468" rel="publisher">+Google</a><a href="/intl/de/about.html">?ber Google</a><a href="http://www.google.de/setprefdomain?prefdom=US&amp;sig=0_HLS725h3eJCTZRbVszWse9oDGQ8%3D" id="fehl">Google.com</a></div></div><p style="color:#767676;font-size:8pt">&copy; 2013 - <a href="/intl/de/policies/">Datenschutzerkl?rung & Nutzungsbedingungen</a></p></span></center><div id=xjsd></div><div id=xjsi><script>if(google.y)google.y.first=[];(function(){function b(a){window.setTimeout(function(){var c=document.createElement("script");c.src=a;document.getElementById("xjsd").appendChild(c)},0)}google.dljp=function(a){google.xjsi||(google.xjsu=a,b(a))};google.dlj=b;})();
if(!google.xjs){window._=window._||{};window._._DumpException=function(e){throw e};if(google.timers&&google.timers.load.t){google.timers.load.t.xjsls=new Date().getTime();}google.dljp('/xjs/_/js/k\x3dxjs.hp.en_US.OkDjXvaw6iM.O/m\x3dsb_he,pcc/rt\x3dj/d\x3d1/sv\x3d1/rs\x3dAItRSTM4MSny_wUHT_zBd4VC7RWiolMmiQ');google.xjs=1;}google.pmc={"sb":{"agen":true,"cgen":true,"client":"heirloom-hp","dh":true,"ds":"","eqch":true,"fl":true,"host":"google.de","jsonp":true,"lm":true,"msgs":{"lcky":"Auf gut Gl?ck!","lml":"Weitere Informationen","oskt":"Eingabe-Tools","psrc":"Diese Suchanfrage wurde aus Ihrem \u003Ca href=\"/history\"\u003EWebprotokoll\u003C/a\u003E entfernt.","psrl":"Entfernen","sbit":"Bildersuche","srch":"Google-Suche"},"ovr":{"ejp":1,"ms":1},"pq":"","qcpw":false,"scd":10,"sce":5,"stok":"8wEpIFmZa00Ic7JFTFfCCc1rvrw"},"hp":{},"pcc":{}};google.y.first.push(function(){if(google.med){google.med('init');google.initHistory();google.med('history');}google.History&&google.History.initialize('/');google.hs&&google.hs.init&&google.hs.init()});if(google.j&&google.j.en&&google.j.xi){window.setTimeout(google.j.xi,0);}</script></div><script>(function(){var b,c,d,e;function g(a,f){a.removeEventListener?(a.removeEventListener("load",f,!1),a.removeEventListener("error",f,!1)):(a.detachEvent("onload",f),a.detachEvent("onerror",f))}function h(a){e=(new Date).getTime();++c;a=a||window.event;a=a.target||a.srcElement;g(a,h)}var k=document.getElementsByTagName("img");b=k.length;
for(var l=c=0,m;l<b;++l)m=k[l],m.complete||"string"!=typeof m.src||!m.src?++c:m.addEventListener?(m.addEventListener("load",h,!1),m.addEventListener("error",h,!1)):(m.attachEvent("onload",h),m.attachEvent("onerror",h));d=b-c;
function n(){if(google.timers.load.t){google.timers.load.t.ol=(new Date).getTime();google.timers.load.t.iml=e;google.kCSI.imc=c;google.kCSI.imn=b;google.kCSI.imp=d;void 0!==google.stt&&(google.kCSI.stt=google.stt);google.csiReport&&google.csiReport()}}window.addEventListener?window.addEventListener("load",n,!1):window.attachEvent&&window.attachEvent("onload",n);google.timers.load.t.prt=e=(new Date).getTime();})();
-                    100% |*******************************| 10906  --:--:-- ETA
# 
felixge commented 11 years ago

Woa! This is huge! @antlai thank you so much for sharing!

wildflower commented 5 years ago

Hi I've tried adding the route to my gateway, but still get the 'bad address' error I"m guessing there's something else missing in my ip tables

# ip r
192.168.1.1 dev ath0 
192.168.1.0/24 dev ath0  src 192.168.1.118 
127.0.0.0/8 dev lo 
default via 192.168.1.1 dev ath0 
# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.1     0.0.0.0         255.255.255.255 UH    0      0        0 ath0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 ath0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 ath0
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.1     *               255.255.255.255 UH    0      0        0 ath0
192.168.1.0     *               255.255.255.0   U     0      0        0 ath0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         192.168.1.1     0.0.0.0         UG    0      0        0 ath0
# ping www.google.com
ping: bad address 'www.google.com'