[CUWiN-Dev] Routing private IP's
Matthew Isaacs
isaacsm at cuwireless.net
Wed Mar 14 16:09:17 CDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've been looking into the issue of zebra/hsls exposing routes to
private networks on the wired interfaces. The issue is in the isprivate
command (located in src/ipschema/isprivate). No matter what IP you pass
it, it returns that it is a public address. Inspecting the code reveals
some byte-ordering issues. These should be easy to fix. An alternative
would be a shell script similar to the one following this message. The
script is significantly smaller than the program (~300 bytes vs 4K).
Thoughts?
- ----------------------
#!/bin/sh
# determine whether a given IP is public or private
O1=$(echo $1 | cut -d "." -f 1 )
O2=$(echo $1 | cut -d "." -f 2 )
if [ "$O1" -eq "10" ]; then
exit 0
elif [ "$O1" -eq "172" ] && [ "$O2" -ge "16" ] && [ "$O2" -le "31" ]; then
exit 0
elif [ "$O1" -eq "192" ] && [ "$O2" -eq "168" ]; then
exit 0
else
exit 1
fi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF+GR9FTAfZok65zkRAm87AJ9/Jv2e6U6B9lP8Wuwo5iJLBZ8p+QCfXNts
CVplADy7kFn1dPII8Ju9F1M=
=pWoM
-----END PGP SIGNATURE-----
More information about the CU-Wireless-Dev
mailing list