Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign safer AP mode IP address #317

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Each configuration option is optional and will fall back to

### DNS in AP-mode

When the wizard is running, users go to either `http://192.168.0.1/` or
When the wizard is running, users go to either `http://172.16.61.0/` or
`http://wifi.config/` to access the web user interface. The latter can be
changed via the `config.exs`:

Expand Down Expand Up @@ -252,7 +252,7 @@ Place the MicroSD card in the Raspberry Pi and power it on. You should see a
WiFi access point appear with the SSID "nerves-1234" where "1234" are part of
the device's serial number. Connect to the access point and then point your web
browser at [http://wifi.config](http://wifi.config/) or
[http://192.168.0.1/](http://192.168.0.1/). If you've configured an SSL
[http://172.16.61.0/](http://172.16.61.0/). If you've configured an SSL
certificate, it's possible to use `https`. You may also need to change the
`:dns_name` configuration to match the name on your SSL certificate.

Expand Down
6 changes: 3 additions & 3 deletions lib/vintage_net_wizard/ap_mode.ex
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ defmodule VintageNetWizard.APMode do
@spec ap_mode_configuration(String.t(), String.t()) :: map()
def ap_mode_configuration(hostname, our_name) do
ssid = sanitize_hostname_for_ssid(hostname)
our_ip_address = {192, 168, 0, 1}
our_ip_address = {172, 16, 61, 0}

%{
type: VintageNetWiFi,
Expand All @@ -60,8 +60,8 @@ defmodule VintageNetWizard.APMode do
},
dhcpd: %{
# These are defaults and are reproduced here as documentation
start: {192, 168, 0, 20},
end: {192, 168, 0, 254},
start: {172, 16, 61, 20},
end: {172, 16, 61, 254},
max_leases: 235,
options: %{
dns: [our_ip_address],
Expand Down
12 changes: 6 additions & 6 deletions test/vintage_net_wizard/ap_mode_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ defmodule VintageNetWizard.APModeTest do

expected = %{
type: VintageNetWiFi,
ipv4: %{address: {192, 168, 0, 1}, method: :static, prefix_length: 24},
ipv4: %{address: {172, 16, 61, 0}, method: :static, prefix_length: 24},
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ipv4: %{address: {172, 16, 61, 0}, method: :static, prefix_length: 24},
ipv4: %{address: {172, 16, 61, 1}, method: :static, prefix_length: 24},

The references below need to have the .1 in them too.

vintage_net_wifi: %{networks: [%{key_mgmt: :none, mode: :ap, ssid: "hostname"}]},
dhcpd: %{
end: {192, 168, 0, 254},
end: {172, 16, 61, 254},
max_leases: 235,
options: %{
dns: [{192, 168, 0, 1}],
dns: [{172, 16, 61, 0}],
domain: "our_name",
router: [{192, 168, 0, 1}],
router: [{172, 16, 61, 0}],
search: ["our_name"],
subnet: {255, 255, 255, 0}
},
start: {192, 168, 0, 20}
start: {172, 16, 61, 20}
},
dnsd: %{records: [{"our_name", {192, 168, 0, 1}}]}
dnsd: %{records: [{"our_name", {172, 16, 61, 0}}]}
}

assert expected == config
Expand Down