Browse Source

filter "truncate-mac-address-to-24-bits": truncate mac address in EUI-64 IPv6 addresses

SLAAC addresses with EUI-64 interface IDs embed the MAC address split
around an inserted ff:fe (with the universal/local bit flipped):

  fe80::1034:56ff:fe78:9abc  (MAC 12:34:56:78:9a:bc)

Truncate after the "fe" so only the OUI remains, consistent with the
existing rules:

  fe80::1034:56ff:fe…

Tolerates omitted leading zeros and covers global addresses as well as
link-local ones. Non-EUI-64 addresses (privacy, stable-privacy, manual)
are left unchanged. Case-insensitive via GNU sed's I flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fabian Peter Hammerle 2 weeks ago
parent
commit
3dfadcef62
1 changed files with 1 additions and 1 deletions
  1. 1 1
      gitconfig

+ 1 - 1
gitconfig

@@ -43,7 +43,7 @@
 	textconv = od -t x1z --
 
 [filter "truncate-mac-address-to-24-bits"]
-	clean = sed -E     -e 's/(^|[^[:xdigit:]:])([[:xdigit:]]{2}(:[[:xdigit:]]{2}){2})(:[[:xdigit:]]{2}){3}([^[:xdigit:]:]|$)/\\1\\2:…\\5/g'     -e 's/(-bccb-40e7-(8e6c|9f6c)-[[:xdigit:]]{6})[[:xdigit:]]{6}([^[:xdigit:]]|$)/\\1…\\3/gI'
+	clean = sed -E     -e 's/(^|[^[:xdigit:]:])([[:xdigit:]]{2}(:[[:xdigit:]]{2}){2})(:[[:xdigit:]]{2}){3}([^[:xdigit:]:]|$)/\\1\\2:…\\5/g'     -e 's/(-bccb-40e7-(8e6c|9f6c)-[[:xdigit:]]{6})[[:xdigit:]]{6}([^[:xdigit:]]|$)/\\1…\\3/gI'     -e 's/(:[[:xdigit:]]{0,4}:[[:xdigit:]]{0,2}ff:fe)[[:xdigit:]]{2}:[[:xdigit:]]{1,4}([^[:xdigit:]:]|$)/\\1…\\2/gI'
 	smudge = cat
 	required = true