def updatectrlifhosts(self, netidx=0, remove=False):
        if not self.getcfgitembool('update_etc_hosts', False):
            return
        
        try:
            ctrlnet = self.getctrlnetobj(netidx)
        except KeyError:
            return
        header = "CORE session %s host entries" % self.sessionid
        if remove:
            if self.getcfgitembool('verbose', False):
                self.info("Removing /etc/hosts file entries.")
            filedemunge('/etc/hosts', header)
            return
        entries = []
        for ifc in ctrlnet.netifs():
            name = ifc.node.name
            for addr in ifc.addrlist:
                entries.append("%s %s" % (addr.split('/')[0], ifc.node.name))
        if self.getcfgitembool('verbose', False):
            self.info("Adding %d /etc/hosts file entries." % len(entries))
        filemunge('/etc/hosts', header, '\n'.join(entries) + '\n')
Add the IP addresses of control interfaces to the /etc/hosts file.
dataset/ETHPy150Open coreemu/core/daemon/core/session.py/Session.updatectrlifhosts