Skip to content

Support new networking setup#14

Open
rgw3d wants to merge 3 commits intomainfrom
networking-fix
Open

Support new networking setup#14
rgw3d wants to merge 3 commits intomainfrom
networking-fix

Conversation

@rgw3d
Copy link
Copy Markdown
Collaborator

@rgw3d rgw3d commented Jan 23, 2021

No description provided.

@rgw3d rgw3d requested a review from schmidtwmark January 23, 2021 03:42
@rgw3d
Copy link
Copy Markdown
Collaborator Author

rgw3d commented Jan 23, 2021

Need to fix comments/ further test things. This still shuts off interfaces which is probably bad.

@rgw3d rgw3d linked an issue Jan 23, 2021 that may be closed by this pull request
if matches.is_present("wait") {
info!("Waiting 90 seconds");
sleep(Duration::from_secs(90));
info!("Waiting 5 seconds");
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figure a short delay might be useful? I tried this to see if the is_connected() function would work again. No change, is_connected() is still broke.


self.execute("sudo", &["ifup", "wlan0"])?;
info!("Sleeping for a little bit to allow wpa to catch up after being restarted.");
sleep(Duration::from_secs(15));
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary to sleep because the hostname -I call to show the sync code will fail if run too soon.

let response = ureq::get("http://clients3.google.com/generate_204").call();
info!("Checking connection, status is {:?}", response.status());
response.status() == 204
true
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stonks. It’s able to connect to AWS to get scores, I assume?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, works fine

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try running this just before or after getting scores?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wack, still returning 400s on startup. Maybe the scoreboard service is running too early, before other networking things are fully up.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get 204s if I start the scoreboard app manually, so I don't think its the endpoint.

"set",
interface,
if enable { "up" } else { "down" },
"echo"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only reason I’m disabling interfaces is because I don’t want the scoreboard to constantly be broadcasting a WiFi connection. Does this still do that?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't. I'm working on a better way to disable the WIFIs

@schmidtwmark
Copy link
Copy Markdown
Collaborator

Are you thinking you want to merge this now? I think I’d be okay to merge it iff there’s a feature flag for it. I’ve been thinking about how I want to do this, it would look something like:

there’s a new file in /var/lib/scoreboard called features
if it does not exist, it gets created and defaulted to good defaults

For example, right now it would just be JSON looking like: { “networking_version”: 1 }. You would set this to networking_version 2, and that would also be set on any new scoreboards made from your Raspbian fork. Then, we could do things like have networking_version checks before the startup wait, and create a second run method for shellExecutor that will handle actions the way you’ve changed here.

I’d rather do that as a bridge while I figure out how I’m going to get everyone else upgraded, and so I can support feature development for you on your new networking code and for everyone else.

@rgw3d
Copy link
Copy Markdown
Collaborator Author

rgw3d commented Jan 23, 2021

@schmidtwmark This should not be merged now. Feature gating is a good idea, that's what I was going recommend!

@rgw3d
Copy link
Copy Markdown
Collaborator Author

rgw3d commented Jan 24, 2021

@schmidtwmark Instead of using ip link set I shutdown/ restart the services (wpa_supplicant & hostapd). This seems to be the better approach.

- Substitute your own IP addresses for the Access point
- Use wlan1 as access point
- Use wlan0 as internet connection
- Modify the wpa systemctl service such that wpa_supplicant will actually get wlan0 to connect to the internet.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you not have to install drivers for the dongle?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope! Works without installing anything.

@schmidtwmark
Copy link
Copy Markdown
Collaborator

schmidtwmark commented Jan 25, 2021 via email

Base automatically changed from master to main February 23, 2021 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wait for interface rather than just waiting 90 seconds

2 participants