Commit e158162d authored by Damien Lucas's avatar Damien Lucas

. Checked all #include's in order to remove all #include inside .h files

  and to call only the usefull .h files

. Few chages in Makefile

. Added #ifndef __XXXX_H__   inside .h files
        #define __XXXX_H__
	[..]
	#endif

. Changed the vlanserver struct, now vs->cfg, vs->snmp, vs->db are pointers
parent 50227d60
......@@ -22,20 +22,20 @@ LDLIBS += -lpthread
# Use SNMP lib
LDLIBS += -lsnmp
#LDLIBS += -L./lib
# Compile debugging version
# Without the debugging version, LOGDEBUG has no effect.
CFLAGS += -DDEBUG
# Debug with the symbols (Don't forget to remove Opims)
CFLAGS += -g
# Optim level automatically removed if DBG is activated
OPTIMS=6
# Memory debugging
# Add limitation and malloc & free pointers printing (see mem.c)
# Don't take care on warnings while compiling mem.c
MEM_DBG=0
# debugging
# includes symbol tables and DEBUG message
# setting BDG to 1 will automatically remove optims
DBG=0
############################# LEXER Config ####################################
#Use flex
......@@ -53,12 +53,19 @@ LEXFLAGS += -PCFG_yy
ifeq ($(MEM_DBG),1)
CFLAGS += -DDEBUG
endif
#------------------ Do not change anything below this line --------------------
ifeq ($(MEM_DBG),1)
CFLAGS += -DMEM_DBG
else
ifeq ($(DBG),1)
CFLAGS += -DDEBUG
CFLAGS += -g
endif
CFLAGS += -O$(OPTIMS)
endif
########################### FILES DESCRIPTION #################################
......
#ifndef __COMMON_H__
#define __COMMON_H__
/* VideoLAN VLAN operations: definitions of all codes for messages exchange between
* VLANserver, VLANclient and VLANbridge
*
......@@ -50,3 +52,4 @@
#define VLAN_LOCATION_ANSWER 32 /* <switch> <port> <vlan> <sharers> */
#define VLAN_LOCATION_UNKNOW 33 /* VLANserver don't know */
#endif
......@@ -4,7 +4,8 @@
%{
#include <string.h>
#include <arpa/inet.h> /* types.h */
#include <string.h> /* strncmp */
#include "../types.h"
#include "../logger.h"
......
#include <stdlib.h>
#include <unistd.h>
#include <stdlib.h> /* free, malloc */
#include <pthread.h> /* pthread_mutex_lock */
#include <semaphore.h> /* sem_wait */
#include <arpa/inet.h> /* ip.h */
#include <ucd-snmp/asn1.h> /* snmp_switch.h */
#include <ucd-snmp/snmp_impl.h> /* snmp_switch.h */
#include <ucd-snmp/snmp_api.h> /* snmp_switch.h */
#include "../types.h"
#include "../logger.h"
#include "../snmp/snmp_switch.h"
#include "../snmp/if_snmp.h"
#include "../snmp/snmp.h"
#include "../snmp/snmp_switch.h" /* struct SNMP_switch */
#include "db.h"
/******************************************************************************
......
#ifndef __DB_TYPES_H__
#define __DB_TYPES_H__
#include <pthread.h>
#include <semaphore.h>
#define DB_MACHINES_HASH 64
#define DB_machines_hash(x) (x&63)
......
#include<stdio.h>
#include<stdlib.h>
#include<pthread.h>
#include <arpa/inet.h> /* types.h */
#include <stdlib.h> /* malloc, free */
#include <pthread.h> /* pthread_create */
#include <semaphore.h> /* db.h */
#include <ucd-snmp/asn1.h> /* snmp_switch.h */
#include <ucd-snmp/snmp_impl.h> /* snmp_switch.h */
#include <ucd-snmp/snmp_api.h> /* snmp_switch.h */
#include "../types.h"
#include "../logger.h"
#include "../snmp/snmp_switch.h"
#include "../snmp/if_snmp.h"
#include "../snmp/snmp.h"
#include "../db/db.h"
#include "../config/config.h"
#include "telnet.h"
#include "interface.h"
#include "../server/server.h"
#include "../vlanserver.h"
#include "../snmp/snmp_switch.h" /* struct SNMP_switch */
#include "../db/db.h" /* DB_machines_lock */
#include "telnet.h" /* IF_telnet */
#include "../server/server.h" /* VS_reinit_switches */
#include "../vlanserver.h" /* vs */
ERR_CODE IF_start(void)
{
......@@ -51,14 +52,14 @@ char* IF_info(VS_MachineId mMac)
sMessage=malloc(256*sizeof(char));
rc=DB_machines_lock(&vs->db, mMac, &machine_elt);
rc=DB_machines_lock(vs->db, mMac, &machine_elt);
if(rc)
{
sprintf(sMessage,"Mac not found in database\r\n");
}
else
{
rc=DB_switchs_port_lock(&vs->db, machine_elt->switch_ip,\
rc=DB_switchs_port_lock(vs->db, machine_elt->switch_ip,\
machine_elt->port, &port, &zwitch);
if(rc)
{
......
#ifndef __INTERFACE_H__
#define __INTERFACE_H__
ERR_CODE IF_start(void);
ERR_CODE IF_reload(void);
char* IF_info(VS_MachineId);
#endif __INTERFACE_H__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <arpa/telnet.h>
#include <stdio.h> /* sprintf */
#include <stdlib.h> /* free, malloc */
#include <string.h> /* bzero */
#include <unistd.h> /* close, read, write */
#include <sys/socket.h> /* socket, bind, ... */
#include <arpa/inet.h> /* types.h */
#include <arpa/telnet.h> /* WILL, IAC, ... */
#include "../types.h"
#include "../logger.h"
#include "./telnet.h"
#include "./interface.h"
#include "telnet.h"
#include "interface.h"
#define PORT 7891
#define SERVER "138.195.141.185"
//#define SERVER "138.195.138.42"
#define MAXCONNECTIONS 20 // how many connections are queued
/* TELNET Interface */
......@@ -40,9 +36,9 @@ static void IF_telnet_commands(int iSocket, char* sUser);
static void Menu_init (struct IF_Menu* mMenu);
static void Menu_send (int iSocket, struct IF_Menu mMenu);
ERR_CODE TELNET_stop (int iSocket);
ERR_CODE TELNET_reload(int iSocket);
ERR_CODE TELNET_info (int iSocket);
static ERR_CODE TELNET_stop (int iSocket);
static ERR_CODE TELNET_reload(int iSocket);
static ERR_CODE TELNET_info (int iSocket);
static char* Catch_Word (int iSocket);
static char* Catch_Passwd (int iSocket);
......@@ -85,7 +81,7 @@ void* IF_telnet(void* ar)
addr.sin_family = AF_INET;
addr.sin_port = htons(PORT);
addr.sin_addr.s_addr = inet_addr(SERVER);
addr.sin_addr.s_addr = INADDR_ANY;
bzero(&(addr.sin_zero),8);
setsockopt(sock,SOL_SOCKET, SO_REUSEADDR, &iOpt,sizeof(iOpt));
......@@ -253,19 +249,19 @@ static void Menu_init (struct IF_Menu* mMenu)
}
ERR_CODE TELNET_stop(int iSocket)
static ERR_CODE TELNET_stop(int iSocket)
{
uStop=1;
return 0;
}
ERR_CODE TELNET_reload(int iSocket)
static ERR_CODE TELNET_reload(int iSocket)
{
IF_reload();
return 0;
}
ERR_CODE TELNET_info(int iSocket)
static ERR_CODE TELNET_info(int iSocket)
{
char * sMessage;
VS_MachineId mMac;
......
#ifndef __TELNET_H__
#define __TELNET_H__
struct IF_Menu
{
struct IFT_Command *Command;
......@@ -14,3 +17,5 @@ struct IFT_Command
void* IF_telnet(void* ar);
#endif
#include <pthread.h>
#include <pthread.h> /* pthread_mutex_lock */
#include <stdarg.h> /* va_arg */
#include <time.h> /* time */
#include <stdio.h> /* fflush , ... */
#include "types.h"
#include "logger.h"
#define LOGBUFF_MAXSIZE 120
/* We just use a single logFile */
/* Local Functions prototypes */
static FILE * fdLogFile;
static unsigned char method;
......
#ifndef __LOGGER_H__
#define __LOGGER_H__
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
/* Methods for logger
* TODO should be in a enum */
#define LOG_NONE 0
......@@ -12,6 +8,8 @@
#define LOG_SCREEN_ONLY 2
#define LOG_BOTH 3
#define LOGBUFF_MAXSIZE 120
char * VS_log_errstr(ERR_CODE err);
void VS_log(LOG_LEVELS level, LOG_MODULES module, char * format, ...);
......
#define __DEF_VS_INIT__
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <arpa/inet.h> /* types.h */
#include <stdlib.h> /* malloc */
#include "types.h"
#include "logger.h"
#include "snmp/snmp_switch.h"
#include "snmp/if_snmp.h"
#include "snmp/snmp.h"
#include "db/db.h"
#include "config/config.h"
#include "server/server.h"
#include "vlanserver.h"
#include "mem.h"
#include "server/server.h" /* VS_init */
#include "vlanserver.h" /* struct VLANserver */
#ifdef MEM_DBG
# include "mem.h" /* mem_init */
#endif
struct VLANserver *vs;
......
#ifndef __MEM_H__
#define __MEM_H__
void mem_init (void);
#endif
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <arpa/inet.h> /* types.h */
#include <stdio.h> /* printf, sprintf */
#include <string.h> /* bzero */
#include <stdlib.h> /* free */
#include <unistd.h> /* close */
#include <net/if.h> /* interface */
#include <sys/ioctl.h> /* ioctl */
#include <sys/socket.h> /* bind, sendto */
#include <sys/time.h> /* time */
#include "../types.h"
#include "../config.h"
#include "client.h"
#define INTERFACE "eth0"
......
#include <asm/errno.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <pthread.h>
#include <arpa/inet.h> /* types.h */
#include <asm/errno.h> /* EBUSY */
#include <sys/time.h> /* struct time_val */
#include <unistd.h> /* close, sleep */
#include <sys/socket.h> /* bind, socket */
#include <pthread.h> /* pthread_mutex_lock */
#include <stdio.h> /* sprintf */
#include "../types.h"
#include "../logger.h"
#include "../config.h"
#include "../snmp/snmp_switch.h"
#include "../snmp/if_snmp.h"
#include "../snmp/snmp.h"
#include "../db/db.h"
#include "../config/config.h"
#include "../vlanserver.h"
#include "../common.h"
#include "../config.h" /* VERSION */
#include "../config/config.h" /* vs->cfg->vlanbridge ... */
#include "../vlanserver.h" /* vs */
#include "../common.h" /* for protocol */
#include "connect.h"
/*****************************************************************************
......@@ -25,7 +20,7 @@
*****************************************************************************
* Tries to log on again on the VLANbridge when the connection has been lost
*****************************************************************************/
static void CNX_cnx_lost(struct VLANserver * vs)
static void CNX_cnx_lost()
{
unsigned int retry_delay;
unsigned int still_sleep;
......@@ -135,10 +130,10 @@ unsigned int CNX_vlb_login(char * version)
break;
if (version[i]=='.')
j=sprintf(message, "%u %s %s %s\n", VLAN_LOGIN_REQUEST, version,
vs->cfg.vlanbridge_login, vs->cfg.vlanbridge_password);
vs->cfg->vlanbridge_login, vs->cfg->vlanbridge_password);
else
j=sprintf(message, "%u %s.0 %s %s\n", VLAN_LOGIN_REQUEST, version,
vs->cfg.vlanbridge_login, vs->cfg.vlanbridge_password);
vs->cfg->vlanbridge_login, vs->cfg->vlanbridge_password);
k=socket(AF_INET, SOCK_STREAM, 0);
if (k==-1)
......
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <semaphore.h>
#include <stdlib.h> /* malloc */
#include <unistd.h> /* usleep */
#include <semaphore.h> /* sem_wait */
#include <netdb.h> /* if_snmp.h */
#include <ucd-snmp/asn1.h> /* if_snmp.h */
#include <ucd-snmp/snmp.h> /* if_snmp.h */
#include <ucd-snmp/snmp_impl.h> /* if_snmp.h */
#include <ucd-snmp/default_store.h> /* if_snmp.h */
#include <ucd-snmp/snmp_api.h> /* if_snmp.h */
#include <ucd-snmp/snmp_client.h> /* if_snmp.h */
#include <ucd-snmp/mib.h> /* if_snmp.h */
#include "../types.h"
#include "../logger.h"
#include "../snmp/snmp_switch.h"
#include "../snmp/if_snmp.h"
#include "../snmp/snmp.h"
#include "../config/config.h"
#include "../db/db.h"
#include "../vlanserver.h"
#include "../sleep.h"
#include "../snmp/snmp_switch.h" /* if_snmp.h */
#include "../snmp/if_snmp.h" /* snmp.h */
#include "../snmp/snmp.h" /* SNMP_init_switch */
#include "../config/config.h" /* vs->cfg->switches */
#include "../vlanserver.h" /* vs */
#include "server.h"
#include "poll_switch.h"
ERR_CODE VS_switch_init(struct VS_switches * list_switch)
......@@ -22,18 +27,18 @@ ERR_CODE VS_switch_init(struct VS_switches * list_switch)
unsigned int i;
unsigned int iter;
vs->snmp.sem_end_init=malloc(sizeof(sem_t));
sem_init(vs->snmp.sem_end_init,0,0);
vs->snmp->sem_end_init=malloc(sizeof(sem_t));
sem_init(vs->snmp->sem_end_init,0,0);
/* Init of ALL switches */
for(z=vs->cfg.zwitches, i=1 ; z!=NULL ; z=z->next, i++)
for(z=vs->cfg->zwitches, i=1 ; z!=NULL ; z=z->next, i++)
{
SNMP_init_switch(&(vs->snmp), z->type, z->ip, z->nports, z->community,
SNMP_init_switch(vs->snmp, z->type, z->ip, z->nports, z->community,
z->unit, list_switch->zwitch[i]);
usleep(100000);
}
sem_wait(vs->snmp.sem_end_init);
sem_wait(vs->snmp->sem_end_init);
for(iter=1;iter<i;iter++)
{
if(!list_switch->zwitch[iter]->badinit)
......
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <semaphore.h>
#include <arpa/inet.h> /* types.h */
#include <stdlib.h> /* malloc */
#include <semaphore.h> /* if_snmp.h */
#include <pthread.h> /* db.h */
#include <netdb.h> /* if_snmp.h */
#include <ucd-snmp/asn1.h> /* if_snmp.h */
#include <ucd-snmp/snmp.h> /* if_snmp.h */
#include <ucd-snmp/snmp_impl.h> /* if_snmp.h */
#include <ucd-snmp/default_store.h> /* if_snmp.h */
#include <ucd-snmp/snmp_api.h> /* if_snmp.h */
#include <ucd-snmp/snmp_client.h> /* if_snmp.h */
#include <ucd-snmp/mib.h> /* if_snmp.h */
#include "../types.h"
#include "../logger.h"
#include "../config.h"
#include "../snmp/snmp_switch.h"
#include "../snmp/if_snmp.h"
#include "../snmp/snmp.h"
#include "../db/db.h"
#include "../config/config.h"
#include "../vlanserver.h"
#include "../sleep.h"
#include "server.h"
#include "../snmp/snmp_switch.h" /* if_snmp.h */
#include "../snmp/if_snmp.h" /* SNMP_start */
#include "../db/db.h" /* DB_flush */
#include "../vlanserver.h" /* vs */
#include "../sleep.h" /* VS_sleep */
#include "server.h" /* VS_reinit_switches */
/*****************************************************************************
* VS_reinit_switchs_thread
......@@ -59,7 +65,7 @@ ERR_CODE VS_reinit_switchs (struct VS_info_poller * info_poller)
return VS_R_MEMORY;
}
rc=SNMP_stop(&(vs->snmp));
rc=SNMP_stop(vs->snmp);
if(rc)
{
VS_log(LOGERROR, SERVER, "unable to stop the snmp");
......@@ -70,7 +76,7 @@ ERR_CODE VS_reinit_switchs (struct VS_info_poller * info_poller)
/* sleep for the timeout of the switches */
VS_sleep(12);
rc=DB_flush(&(vs->db));
rc=DB_flush(vs->db);
if(rc)
{
VS_log(LOGERROR, SERVER, "unable to stop the db");
......@@ -80,8 +86,8 @@ ERR_CODE VS_reinit_switchs (struct VS_info_poller * info_poller)
}
sem_init(vs->snmp.sem,0,0);
rc=SNMP_start(&(vs->snmp));
sem_init(vs->snmp->sem,0,0);
rc=SNMP_start(vs->snmp);
if(rc)
{
VS_log(LOGERROR, SERVER, "unable to restart the snmp");
......@@ -89,7 +95,7 @@ ERR_CODE VS_reinit_switchs (struct VS_info_poller * info_poller)
}
/* We should not start the db_init before snmp loop started */
sem_wait(vs->snmp.sem);
sem_wait(vs->snmp->sem);
rc=VS_db_init(info_poller);
if(rc)
......
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <arpa/inet.h> /* types.h */
#include <sys/socket.h> /* socket, sendto */
#include <stdlib.h> /* free */
#include <string.h> /* bzero */
#include <unistd.h> /* close */
#include <pthread.h> /* db.h */
#include <semaphore.h> /* db.h */
#include <netdb.h> /* if_snmp.h */
#include <ucd-snmp/asn1.h> /* if_snmp.h */
#include <ucd-snmp/snmp.h> /* if_snmp.h */
#include <ucd-snmp/snmp_impl.h> /* if_snmp.h */
#include <ucd-snmp/default_store.h> /* if_snmp.h */
#include <ucd-snmp/snmp_api.h> /* if_snmp.h */
#include <ucd-snmp/snmp_client.h> /* if_snmp.h */
#include <ucd-snmp/mib.h> /* if_snmp.h */
#include "../types.h"
#include "../logger.h"
#include "../config.h"
#include "../snmp/snmp_switch.h"
#include "../snmp/if_snmp.h"
#include "../snmp/snmp.h"
#include "../db/db.h"
#include "../config/config.h"
#include "../vlanserver.h"
#include "connect.h"
#include "server.h"
#include "request_handler.h"
#include "../snmp/snmp_switch.h" /* struct SNMP_switch */
#include "../snmp/if_snmp.h" /* SNMP_set_vlan */
#include "../db/db.h" /* DB_machines_lock */
#include "../config/config.h" /* vs->cfg */
#include "../vlanserver.h" /* vs */
#include "connect.h" /* CNX_vlb_set_vlan */
#include "server.h" /* struct VS_info_client */
/*****************************************************************************
* VS_request_handler
......@@ -99,7 +105,7 @@ ERR_CODE VS_request_handler(struct VS_info_client * info_client)
*/
/* looking for the DB entry of the mac */
rc=DB_machines_lock(&vs->db, macaddr_db, &machines_elt);
rc=DB_machines_lock(vs->db, macaddr_db, &machines_elt);
if(!rc)
{
VS_log(LOGINFO, SERVER, "switch:%s port:%u",\
......@@ -107,16 +113,16 @@ ERR_CODE VS_request_handler(struct VS_info_client * info_client)
(unsigned)machines_elt->port);
/* looking of the DB entry of the switch */
rc=DB_switchs_port_lock(&vs->db, machines_elt->switch_ip,\
rc=DB_switchs_port_lock(vs->db, machines_elt->switch_ip,\
machines_elt->port, &port, &zwitch);
if(!rc)
{
if(zwitch->ports[machines_elt->port].protection<VS_PL_VIDEOLAN)
{
vlan_dest=ChannelToVlan(vs->cfg, channel_dest);
vlan_dest=ChannelToVlan(*(vs->cfg), channel_dest);
/* Asking the SNMP to change VLAN */
rc=SNMP_set_vlan(&vs->snmp, zwitch, machines_elt->port,\
rc=SNMP_set_vlan(vs->snmp, zwitch, machines_elt->port,\
vlan_dest);
if(!rc)
{
......@@ -139,7 +145,7 @@ ERR_CODE VS_request_handler(struct VS_info_client * info_client)
sendto(socket_th, &message, sizeof(message), 0, (struct sockaddr *)(&sa_client),\
sizeof(struct sockaddr));
}
DB_switchs_port_unlock(&vs->db, port);
DB_switchs_port_unlock(vs->db, port);
}
else
{
......@@ -160,7 +166,7 @@ ERR_CODE VS_request_handler(struct VS_info_client * info_client)
sizeof(struct sockaddr));
}
DB_machines_unlock(&vs->db, machines_elt);
DB_machines_unlock(vs->db, machines_elt);
}
else
{
......
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <string.h>
#include <arpa/inet.h> /* types.h */
#include <sys/socket.h> /* sendto */
#include <unistd.h> /* close */
#include <string.h> /* bzero */
#include "../types.h"
#include "../logger.h"
#include "send.h"
/*****************************************************************************
......
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
#include <pthread.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include <unistd.h>
#include <semaphore.h>
#include <stdlib.h> /* malloc */
#include <string.h> /* bzero */
#include <sys/socket.h> /* socket, bind, sendto */
#include <pthread.h> /* pthread_mutex_init, ... */
#include <sys/time.h> /* struct timeval */
#include <unistd.h> /* close */
#include <semaphore.h> /* sem_wait */
#include <arpa/inet.h> /* types.h */
#include <netdb.h> /* if_snmp.h */
#include <ucd-snmp/asn1.h> /* if_snmp.h */
#include <ucd-snmp/snmp.h> /* if_snmp.h */
#include <ucd-snmp/snmp_impl.h> /* if_snmp.h */
#include <ucd-snmp/default_store.h> /* if_snmp.h */
#include <ucd-snmp/snmp_api.h> /* if_snmp.h */
#include <ucd-snmp/snmp_client.h> /* if_snmp.h */
#include <ucd-snmp/mib.h> /* if_snmp.h */
#include "../types.h"
#include "../logger.h"
#include "../config.h"
#include "../snmp/snmp_switch.h"
#include "../snmp/if_snmp.h"
#include "../snmp/snmp.h"
#include "../db/db.h"
#include "../config/config.h"
#include "../vlanserver.h"
#include "connect.h"
#include "server.h"
#include "poll_switch.h"
#include "request_handler.h"
#include "../config.h" /* VERSION */
#include "../snmp/snmp_switch.h" /* if_snmp.h */
#include "../snmp/if_snmp.h" /* vs->snmp */
#include "../db/db.h" /* DB_switch_insert */
#include "../config/config.h" /* vs-> cfg */
#include "../vlanserver.h" /* vs */
#include "connect.h" /* CNX_vlb_login */
#include "server.h" /* VS_stop */
#include "poll_switch.h" /* VS_switch_init */
#include "request_handler.h" /* VS_request_handler_thread */
ERR_CODE VS_start()
{
......@@ -71,7 +76,7 @@ ERR_CODE VS_start()
}
/* We should not run db_init before snmp_loop started */
sem_wait(vs->snmp.sem);
sem_wait(vs->snmp->sem);
rc=VS_db_init(info_poller);
if(rc)
......@@ -90,7 +95,7 @@ ERR_CODE VS_start()
return VS_R_CONNECT;
}
vs->snmp.se_port=server_snmp.sin_port;
vs->snmp->se_port=server_snmp.sin_port;
/* We are not really sure wether this code should be inside the loop or not*/
......@@ -152,7 +157,7 @@ ERR_CODE VS_db_init(struct VS_info_poller * info_poller)
args=info_poller->args;
/* Malloc of ALL the switches read in the config file */
for(z=vs->cfg.zwitches, i=1 ; z!=NULL ; z=z->next, i++)
for(z=vs->cfg->zwitches, i=1 ; z!=NULL ; z=z->next, i++)
{