{"id":1648,"date":"2015-09-25T21:10:50","date_gmt":"2015-09-25T15:40:50","guid":{"rendered":"http:\/\/judepereira.com\/blog\/?p=1648"},"modified":"2015-09-25T21:10:50","modified_gmt":"2015-09-25T15:40:50","slug":"openwrt-wont-bring-my-wifi-interface-up-unless-the-other-is-up","status":"publish","type":"post","link":"https:\/\/judepereira.com\/blog\/openwrt-wont-bring-my-wifi-interface-up-unless-the-other-is-up\/","title":{"rendered":"OpenWRT won&#8217;t bring my WiFi interface up, unless the other is up"},"content":{"rendered":"<p>I recently bought a D-Link DIR 505 router. So far, I&#8217;ve got a DLNA server running on it, along with Transmission, a bit torrent client. Life is awesome so far.<\/p>\n<p>I set it up to repeat another WiFi router in my house, the one connected to the internet &#8211; using a bridge. It works really well right now.<\/p>\n<p>However, when that WiFi network is down, even the second WiFi network created by my new router won&#8217;t come up. I don&#8217;t know why as of yet, but I have a dirty hack &#8211; if within 10 seconds after boot the router cannot ping my other WiFi router, I will disable that interface and restart the WiFi. This brings the network created by the D-Link up, and I can continue to stream stuff off my hard drive from it.<\/p>\n<p>I created an executable shell script, and placed it in \/usr\/bin. Then I added a link\u00a0in rc.local, which is executed after the system is up:<\/p>\n<p>[code lang=&#8221;sh&#8221;]<br \/>\n#\u00a0\/usr\/bin\/wifi_failsafe.sh<\/p>\n<p>logger &#8220;Waiting for 10 seconds for network to settle down&#8221;<br \/>\nsleep 10<\/p>\n<p>if uci get wireless.@wifi-iface[0].disabled | grep 1; then<br \/>\n    logger &#8220;Primary interface is disabled&#8221;<br \/>\nelse<br \/>\n    logger &#8220;Primary interface hasn&#8217;t been disabled&#8221;<br \/>\n    logger &#8220;Checking for connectivity&#8221;<br \/>\n    if ping -c 1 192.168.2.1; then<br \/>\n        logger &#8220;Connectivity has been established&#8221;<br \/>\n    else<br \/>\n        logger &#8220;Connectivity lost. Disabling primary WiFi interface&#8221;<br \/>\n        uci set wireless.@wifi-iface[0].disabled=1<br \/>\n        uci commit wireless<br \/>\n        wifi<br \/>\n    fi<br \/>\nfi<br \/>\n[\/code]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently bought a D-Link DIR 505 router. So far, I&#8217;ve got a DLNA server running on it, along with Transmission, a bit torrent client. Life is awesome so far. I set it up to repeat another WiFi router in my house, the one connected to the internet &#8211; using a bridge. It works really [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[52],"tags":[538,535,537,539,536],"class_list":["post-1648","post","type-post","status-publish","format-standard","hentry","category-code","tag-dlink","tag-openwrt","tag-repeater","tag-uci","tag-wifi"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pqtyx-qA","jetpack-related-posts":[{"id":1940,"url":"https:\/\/judepereira.com\/blog\/lessons-learnt-from-esp-now\/","url_meta":{"origin":1648,"position":0},"title":"Lessons learnt from ESP NOW","author":"Jude Pereira","date":"February 18, 2021","format":false,"excerpt":"For those of you who aren\u2019t aware of ESP NOW, it\u2019s a communication protocol developed by Espressif for their ESP modules. What began as a simple \u201chook up my plant lights to HomeKit\u201d, turned into a massive home grown firmware, but more about that in another post. I\u2019ve successfully setup\u2026","rel":"","context":"In &quot;hardware&quot;","block_context":{"text":"hardware","link":"https:\/\/judepereira.com\/blog\/category\/hardware\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1918,"url":"https:\/\/judepereira.com\/blog\/sending-ota-updates-over-wifi-to-your-esp8266\/","url_meta":{"origin":1648,"position":1},"title":"Sending OTA updates over WiFi to your ESP8266","author":"Jude Pereira","date":"December 21, 2020","format":false,"excerpt":"This Christmas, I added a whole bunch of lights powered by 5V power sources. My goal was to switch them on at sunset, and switch them off on sunrise, by using a MOSFET for power control :) While I was doing this, I wanted to send OTA updates of my\u2026","rel":"","context":"In &quot;another snippet | code&quot;","block_context":{"text":"another snippet | code","link":"https:\/\/judepereira.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":64,"url":"https:\/\/judepereira.com\/blog\/faunos-shadow\/","url_meta":{"origin":1648,"position":2},"title":"FaunOS Shadow","author":"Jude Pereira","date":"January 20, 2009","format":false,"excerpt":"It's a distribution based totally on Arch Linux... specialized for USB Portable installs and can also be used as primary OS has over 600 packages pre-installed (I know... it reminds you of Fedora and me too!). So that's to say that it comes with definitely all the packages you would\u2026","rel":"","context":"In &quot;gnu linux&quot;","block_context":{"text":"gnu linux","link":"https:\/\/judepereira.com\/blog\/category\/linux\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1936,"url":"https:\/\/judepereira.com\/blog\/taming-a-throttled-api-with-dynamic-proxies-in-java\/","url_meta":{"origin":1648,"position":3},"title":"Taming a throttled API with Dynamic Proxies in Java","author":"Jude Pereira","date":"January 20, 2021","format":false,"excerpt":"Recently, at CleverTap, we've begun migrating some of our largest clusters to a new protocol (for starters, think ~115 instances at a time). One of the most fun things I've had my hands on during this migration was the AWS Systems Manager API. When we scaled up our migrations gradually\u2026","rel":"","context":"In &quot;another snippet | code&quot;","block_context":{"text":"another snippet | code","link":"https:\/\/judepereira.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1713,"url":"https:\/\/judepereira.com\/blog\/a-letter-to-tim-cook-regarding-ios-10-with-love-for-apple\/","url_meta":{"origin":1648,"position":4},"title":"A letter to Tim Cook regarding iOS 10, with love for Apple","author":"Jude Pereira","date":"June 17, 2016","format":false,"excerpt":"Tim, iOS has always been known for it's user interface, until recently. Your new take on notifications have not only made them very loud, and unsettling, but do not flow with the entire look and feel of Apple: No Mr. Tim, no. My notifications aren't waiting for me. They're crying\u2026","rel":"","context":"In &quot;life!&quot;","block_context":{"text":"life!","link":"https:\/\/judepereira.com\/blog\/category\/living-a-wonder\/"},"img":{"alt_text":"No Mr. Tim, no. My notifications will not be waiting for me. They're crying out for my attention.","src":"https:\/\/i0.wp.com\/judepereira.com\/blog\/wp-content\/uploads\/Screen-Shot-2016-06-17-at-08.49.59-614x1024.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/judepereira.com\/blog\/wp-content\/uploads\/Screen-Shot-2016-06-17-at-08.49.59-614x1024.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/judepereira.com\/blog\/wp-content\/uploads\/Screen-Shot-2016-06-17-at-08.49.59-614x1024.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1665,"url":"https:\/\/judepereira.com\/blog\/openframeworks-and-appcode\/","url_meta":{"origin":1648,"position":5},"title":"openFrameworks and AppCode","author":"Jude Pereira","date":"November 8, 2015","format":false,"excerpt":"Developing an openFrameworks app with AppCode is pretty easy. However, if you just open and run the project created by the project generator, you might see the following errors: Why doesn't it just work? This is because openFrameworks doesn't support 64 bit builds yet on the Mac, due to a\u2026","rel":"","context":"In &quot;another snippet | code&quot;","block_context":{"text":"another snippet | code","link":"https:\/\/judepereira.com\/blog\/category\/code\/"},"img":{"alt_text":"Building a stock openFrameworks app results in these errors","src":"https:\/\/i0.wp.com\/judepereira.com\/blog\/wp-content\/uploads\/fails_by_default-1024x407.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/judepereira.com\/blog\/wp-content\/uploads\/fails_by_default-1024x407.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/judepereira.com\/blog\/wp-content\/uploads\/fails_by_default-1024x407.png?resize=525%2C300 1.5x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/posts\/1648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/comments?post=1648"}],"version-history":[{"count":9,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/posts\/1648\/revisions"}],"predecessor-version":[{"id":1657,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/posts\/1648\/revisions\/1657"}],"wp:attachment":[{"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/media?parent=1648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/categories?post=1648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/judepereira.com\/blog\/wp-json\/wp\/v2\/tags?post=1648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}