Skip to content
Snippets Groups Projects
Commit 19cff311 authored by Iustin Pop's avatar Iustin Pop
Browse files

Update hconfd bind address handling


Instead of hardcoded IPv4 INADDR_ANY, this patch changes hconfd to use
either the any network for the configured cluster address family
(ipv4/ipv6), or whatever the user passes in via the --bind option.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 152e05e1
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@
{-
Copyright (C) 2011 Google Inc.
Copyright (C) 2011, 2012 Google Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -51,6 +51,7 @@ import Ganeti.Confd
import Ganeti.Config
import Ganeti.Hash
import Ganeti.Logging
import Ganeti.BasicTypes
import qualified Ganeti.Constants as C
-- * Types and constants definitions
......@@ -502,9 +503,10 @@ listener s hmac resp = do
-- | Main function.
main :: DaemonOptions -> IO ()
main opts = do
s <- S.socket S.AF_INET S.Datagram S.defaultProtocol
let port = maybe C.defaultConfdPort fromIntegral $ optPort opts
S.bindSocket s (S.SockAddrInet (fromIntegral port) S.iNADDR_ANY)
parseresult <- parseAddress opts C.defaultConfdPort
(af_family, bindaddr) <- exitIfBad parseresult
s <- S.socket af_family S.Datagram S.defaultProtocol
S.bindSocket s bindaddr
cref <- newIORef (Bad "Configuration not yet loaded")
statemvar <- newMVar initialState
hmac <- getClusterHmac
......
......@@ -4,7 +4,7 @@
{-
Copyright (C) 2009, 2011 Google Inc.
Copyright (C) 2009, 2011, 2012 Google Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -39,6 +39,7 @@ options =
, oNoUserChecks
, oDebug
, oPort C.defaultConfdPort
, oBindAddress
]
-- | Main function.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment