Index of /~plonka/ipv6toolkit

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory  -  
[   ]README.ipv6toolkit-v2.02017-06-27 22:49 3.8K 
[   ]ipv6toolkit-v2.0.tar.gz2015-04-05 10:12 709K 
[TXT]ipv6toolkit-v2.0_hex_ip.patch2017-08-31 15:04 15K 

README for "hex_ip" patch to ipv6toolkit

This is a patch to add support for a new IPv6 address format called "hex_ip." The patch is for this package: https://www.si6networks.com/tools/ipv6toolkit/.
It is known to apply and work correctly with version 2, e.g., https://www.si6networks.com/tools/ipv6toolkit/ipv6toolkit-v2.0.tar.gz

Specifically, the patch adds the --print-hex, -H, --print-fixed, -F, --pass-thru, -p options to the addr6 command and enhances it to read hex_ip format as input.

When using the --print-hex, -H option, our convention is to name the output files with a .hex_ip suffix.

Sample usage:

$ cat hosts.txt                               
::1
ff02::1
ff02::2
$ addr6 --stdin --print-hex < hosts.txt > hosts.hex_ip  
$ cat hosts.hex_ip
00000000000000000000000000000001
ff020000000000000000000000000001
ff020000000000000000000000000002
$ addr6 --stdin --print-fixed < hosts.hex_ip          
0000:0000:0000:0000:0000:0000:0000:0001
ff02:0000:0000:0000:0000:0000:0000:0001
ff02:0000:0000:0000:0000:0000:0000:0002
$ addr6 --stdin --print-canonic < hosts.hex_ip
::1
ff02::1
ff02::2
$ sort -c hosts.hex_ip # check that IPv6 addresses are sorted
$ addr6 --stdin --print-decode --pass-thru < hosts.txt # decode, pass-thru col 1
::1 unicast=loopback=interface=low-byte=unspecified
ff02::1 multicast==link=unspecified=unspecified
ff02::2 multicast==link=unspecified=unspecified

The advantage of the hex[_ip] and fixed[-width] formats over the canonical IPv6 address format is that they can be simply sorted by text collating sequence, e.g., with sort(1).
Furthermore they work well with other [GNU] text utilities, so sets of IP addresses can be easily manipulated using standard tools: comm, join, paste, sort, etc.

Perhaps suprisingly, the hex[_ip] format is also nice in that, on average, it will be even smaller than presentation format (--print-canonic) for temporary privacy addresses with pseudorandom interface identifiers. (This is because privacy addresses don't allow much zeroes-compression and, thus, usually contain 7 colon characers that are eliminated with --print-hex.

$ ./addr6 -h
SI6 Networks' IPv6 Toolkit v2.0 (Guille)
addr6: An IPv6 address analysis and conversion tool

usage: addr6 (-i | -a) [-p] [-c | -F | -H | -d | -r | -s | -q] [-v] [-h]

OPTIONS:
  --address, -a             IPv6 address to be decoded
  --stdin, -i               Read IPv6 addresses from stdin (standard input)
  --pass-thru, -p           Pass address to output, e.g., prepend to -d info
  --print-canonic, -c       Print IPv6 addresses in canonic form
  --print-fixed, -F         Print IPv6 addresses in fixed-length form
  --print-hex, -H           Print IPv6 addresses in hex form
  --print-reverse, -r       Print reversed IPv6 address
  --print-decode, -d        Decode IPv6 addresses
  --print-stats, -s         Print statistics about IPv6 addresses
  --print-unique, -q        Discard duplicate IPv6 addresses
  --accept, -j              Accept IPv6 addresses from specified IPv6 prefix
  --accept-type, -b         Accept IPv6 addresses of specified type
  --accept-scope, -k        Accept IPv6 addresses of specified scope
  --accept-utype, -w        Accept IPv6 unicast addresses of specified type
  --accept-iid, -g          Accept IPv6 addresses with IIDs of specified type
  --block, -J               Block IPv6 addresses from specified IPv6 prefix
  --block-type, -B          Block IPv6 addresses of specified type
  --block-scope, -K         Block IPv6 addresses of specified scope
  --block-utype, -W         Block IPv6 unicast addresses of specified type
  --block-iid, -G           Block IPv6 addresses with IIDs of specified type
  --verbose, -v             Be verbose
  --help, -h                Print help for the addr6 tool


Dave Plonka, Aug 31 2017