-
Notifications
You must be signed in to change notification settings - Fork 0
Initial commit - Added bash version of mac2ip calculator #4
Conversation
Can you change the commit summary to be something more indicative of the content of the commit? E.g. "Adds bash version of calculator" or something like that. |
@@ -0,0 +1,127 @@ | |||
#!/bin/bash | |||
# | |||
# Script written for PittMesh by Jason Khanlar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to claim copyright on this, put in a header something more like this:
© 2016 Jason Khanlar. All rights reserved.
Licensed under the terms of the MIT license.
PittMesh isn't an entity for the purposes of licensing. If you want to assign the copyright to @metamesh, that's fine: swap in Meta Mesh Wireless Communities
for your name and add an authors block that looks like this:
AUTHORS
* Jason Khanlar
…less Communicaitons
…3rd and 4th octets of IPv4 address
thump |
@@ -0,0 +1,105 @@ | |||
#!/bin/bash | |||
# | |||
# � 2016 Meta Mesh Wireless Communications. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Communications/Communities
Almost there! |
s_h_a_k_e |
Initial commit - Added bash version of mac2ip calculator
Great work! Next (optional) step? Write a simple test script that checks the known good output of a few inputs. |
What kind of inputs? What determines known good outputs? |
If you know that the MAC address script_to_test=./mm-commotion-mac2ip
failure=0
test() {
local mac=$1
local ip=$2
if [[ "$($script_to_test $mac)" != "$ip" ]]; then
echo "$mac did not resolve to $ip"
failure=1
fi
}
test "de:ad:be:ef:00:01" "100.64.87.1"
test "d3-4d-B3-3F-10:11" "100.64.87.101"
if [[ $failure -gt 0 ]]; then
echo "There were failures."
exit 1
fi
} This eventually leads to a sort of generative test, where you can generate applicable MAC addresses at random and check the output against a known working implementation. This last bit is probably more work that is worth it for now, though. † The MACs and IPs mentioned in this post are certainly not correctly paired. |
No description provided.