From 0973d57d2a0ef04a97c405470689453ae939f498 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 27 Jan 2013 23:08:56 +0100 Subject: Add canonicalize option to hostmux Taking the canonical name makes very little sense nowadays with a lot of services behind the same IP but virtual hostnames. * hostmux/hostmux.h (hostmux): Add canonicalize field. * hostmux/hostmux.c (options, parse_opt): Add -C/--canonicalize option. * hostmux/mux.c (lookup_host): Only call getaddrinfo if canonicalize is true, pass NULL as HE to lookup_addrinfo otherwise. (lookup_addrinfo): When !HE, use name given by user. --- hostmux/hostmux.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'hostmux/hostmux.h') diff --git a/hostmux/hostmux.h b/hostmux/hostmux.h index e6cfb767..4f971473 100644 --- a/hostmux/hostmux.h +++ b/hostmux/hostmux.h @@ -55,6 +55,9 @@ struct hostmux argument. */ char *host_pat; + /* Whether we should canonicalize host names or not. */ + boolean_t canonicalize; + /* Constant fields for host stat entries. */ struct stat stat_template; @@ -69,9 +72,10 @@ struct hostmux_name const char *name; /* Looked up name (may be a number). */ const char *canon; /* The canonical (fq) host name. */ - /* A filesystem node associated with NAME. If NAME = CANON, then this will - refer to a node with a translator for that host, otherwise, the node - will be a symbolic link to the canonical name. */ + /* A filesystem node associated with NAME. If canonicalize is 0 or + NAME = CANON, then this will refer to a node with a translator for that + host, otherwise, the node will be a symbolic link to the canonical name. + */ struct node *node; ino_t fileno; /* The inode number for this entry. */ -- cgit v1.2.3