Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
IPv6          PHP       @koyhoge
about koyhoge✤ Programmer✤ id:koyhoge✤          / Agilemedia Network✤ PHP                2011
IPv6✤               10✤ IPv4
IPv6✤ 128✤ 0000:0000:0000:0000:0000:0000:0000:0000✤ 16       0-9a-f
example✤ 2001:0db8:0000:000:  d1ce:0000:0000:0001
✤       0✤   0       ::
case-insense✤ abcdef   ABCDEF   OK
Valiation✤   2001:db8::d1ce:0:0:0001✤   2001:db8::d1ce:0:0:1✤   2001:db8:0:0:d1ce::1✤   2001:DB8:0:0:D1CE::1✤   2001:0DB8:...
comparation probrem✤    IPv6✤
RFC5952✤ A Recommendation for IPv6  Address T Representation           ext✤    ✤          @NEC    ✤          @NEC
Rules✤ 16-Bit Field                “0”✤ “::”✤ 16-Bit 0 Field          “0000”                   “::”
Rules (cont.)✤ “::”                    Field                         16-Bit 0  Field          Field
Rules (last)✤ “a”   “f”
Normalized!✤ 2001:db8::d1ce:0:0:1
RegExp?✤ IPv6 Address Validation ✤ http://oldsite2.dartware.com/    ipv6regex
!   /^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|  ((25[0-5]|2[0-4]d|1dd|[1...
In PHP?✤ PEAR::Net_IPv6 ✤ http://pear.php.net/package/   net_ipv6/✤ Author: Alexander Merz
Net_IPv6::compress✤    OK✤
incompatible rule✤ 16-Bit 0 Field          “0000”                   “::”
Send a patchfunction recommendedFormat($ip) {   $compressed = self::compress($ip, true);   // RFC5952 4.2.2   // The symbo...
patch accepted✤ http://pear.php.net/bugs/  bug.php?id=18687
Fin
Upcoming SlideShare
Loading in …5
×

IPv6の闇とPHP

1,823 views

Published on

PHPMatsuri 2011 内の「闇PHPMatsuri」で発表したスライド。

Published in: Technology
  • Be the first to comment

IPv6の闇とPHP

  1. 1. IPv6 PHP @koyhoge
  2. 2. about koyhoge✤ Programmer✤ id:koyhoge✤ / Agilemedia Network✤ PHP 2011
  3. 3. IPv6✤ 10✤ IPv4
  4. 4. IPv6✤ 128✤ 0000:0000:0000:0000:0000:0000:0000:0000✤ 16 0-9a-f
  5. 5. example✤ 2001:0db8:0000:000: d1ce:0000:0000:0001
  6. 6. ✤ 0✤ 0 ::
  7. 7. case-insense✤ abcdef ABCDEF OK
  8. 8. Valiation✤ 2001:db8::d1ce:0:0:0001✤ 2001:db8::d1ce:0:0:1✤ 2001:db8:0:0:d1ce::1✤ 2001:DB8:0:0:D1CE::1✤ 2001:0DB8:0:0:D1CE::1
  9. 9. comparation probrem✤ IPv6✤
  10. 10. RFC5952✤ A Recommendation for IPv6 Address T Representation ext✤ ✤ @NEC ✤ @NEC
  11. 11. Rules✤ 16-Bit Field “0”✤ “::”✤ 16-Bit 0 Field “0000” “::”
  12. 12. Rules (cont.)✤ “::” Field 16-Bit 0 Field Field
  13. 13. Rules (last)✤ “a” “f”
  14. 14. Normalized!✤ 2001:db8::d1ce:0:0:1
  15. 15. RegExp?✤ IPv6 Address Validation ✤ http://oldsite2.dartware.com/ ipv6regex
  16. 16. ! /^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}| ((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f] {1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?: ((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f] {1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]? d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}) {1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd| [1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d| 1dd|[1-9]?d)){3}))|:)))(%.+)?s*$/
  17. 17. In PHP?✤ PEAR::Net_IPv6 ✤ http://pear.php.net/package/ net_ipv6/✤ Author: Alexander Merz
  18. 18. Net_IPv6::compress✤ OK✤
  19. 19. incompatible rule✤ 16-Bit 0 Field “0000” “::”
  20. 20. Send a patchfunction recommendedFormat($ip) { $compressed = self::compress($ip, true); // RFC5952 4.2.2 // The symbol "::" MUST NOT be used to shorten just one // 16-bit 0 field. if ((substr_count($compressed, :) == 7) && (strpos($compressed, ::) !== false)) { $compressed = str_replace(::, :0:, $compressed); } return $compressed;}
  21. 21. patch accepted✤ http://pear.php.net/bugs/ bug.php?id=18687
  22. 22. Fin

×