-;;;--------------------------------------------------------------------------
-;;; Host allocations
-
-;; External addresses.
-(defhost guvnor.inet (inet 1))
-(defhost radius.inet (inet 2))
-(defhost roadstar.inet (inet 3))
-(defhost jem.inet (inet 4))
-(defhost artist.inet (inet 5))
-(defhost vampire.inet (inet 6))
-(defhost ibanez.inet (inet 9))
-(defhost gate.inet (inet 13))
-(defhost nat.inet (inet 14))
-
-;; Unsafe network.
-(defhost radius (unsafe 1))
-(defhost roadstar (unsafe 2))
-(defhost jem (unsafe 3))
-(defhost artist (unsafe 4))
-(defhost vampire (unsafe 5))
-(defhost ibanez (unsafe 14))
-
-;; Safe network.
-(defhost tubescreamer (safe 1))
-(defhost obsidian (safe 2))
-
-;; Wireless network.
-(defhost radius.untrusted (untrusted 1))
-(defhost evolution (untrusted 2))
-(defhost vampire.untrusted (untrusted 3))
-
-;; Virtual private network.
-(defhost crybaby (virtual 1))
-(defhost terror (virtual 2))
-
-;; Iodine network.
-(defhost vampire.iodine (iodine 1))
-
-;; Special network for ITS.
-;; It doesn't understand point-to-point links, so we need a little net.
-(defhost gw (its 1))
-(defhost mz (its 2))
+(defvar *anycast-routable-families* (list :ipv6))
+
+(defzoneparse :anycast (name data rec :prefix prefix :zname zname)
+ (destructuring-bind (any-provider default-provider &rest other-providers)
+ data
+
+ ;; First, the default address. If the anycast network is preferred then
+ ;; this is easy; otherwise we have something complicated to do because
+ ;; IPv6 anycast addresses are globally routable, while IPv4 ones aren't.
+ (if (zone-preferred-subnet-p (car any-provider))
+ (zone-set-address #'rec (cdr any-provider) :make-ptr-p t)
+ (dolist (addr (host-addrs (host-parse (cdr any-provider))))
+ (let ((family (ipaddr-family addr)))
+ (if (member family *anycast-routable-families*)
+ (zone-set-address #'rec addr
+ :family family :make-ptr-p t)
+ (zone-set-address #'rec (cdr default-provider)
+ :family family :make-ptr-p nil)))))
+
+ ;; Now for all of the others.
+ (dolist (provider (list* any-provider default-provider other-providers))
+ (zone-set-address #'rec (cdr provider)
+ :make-ptr-p (eq provider any-provider)
+ :name (concatenate 'string prefix "."
+ (string-downcase (car provider))
+ "." (string-downcase zname))))))