Skip to content

Commit

Permalink
fix(app): display robot ip not robot ip subnet base (#4411)
Browse files Browse the repository at this point in the history
pr #4372 (ac74c12) added the netmask
package (https://www.npmjs.com/package/netmask) to parse the robot's networking
response of CIDR-format ip/subnetbits into a separate ip and subnet mask.
Unfortunately, that PR was building a Netmask object and then using its base
member to represent the IP address. However, a Netmask object only represents
information _about the subnet_, not about a specific ip; the base attribute is
the base address of the subnet, e.g. ip & subnetmask.

Instead, split off the CIDR suffix and use the result as the IP address.
  • Loading branch information
sfoster1 authored Nov 8, 2019
1 parent e1017f7 commit 57cdfee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/http-api-client/networking.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export const makeGetRobotNetworkingStatus = (): GetNetworkingStatusCall =>
if (iface.ipAddress != null) {
try {
const block = new Netmask(iface.ipAddress)
ipAddress = block.base
ipAddress = iface.ipAddress.split('/')[0]
subnetMask = block.mask
} catch (e) {
// just use what was passed if unable to parse
Expand Down

0 comments on commit 57cdfee

Please sign in to comment.