diff options
Diffstat (limited to 'src/ipcpd')
| -rw-r--r-- | src/ipcpd/config.h.in | 5 | ||||
| -rw-r--r-- | src/ipcpd/ipcp.c | 8 | ||||
| -rw-r--r-- | src/ipcpd/ipcp.h | 2 | ||||
| -rw-r--r-- | src/ipcpd/local/main.c | 2 | ||||
| -rw-r--r-- | src/ipcpd/normal/dt.c | 6 | ||||
| -rw-r--r-- | src/ipcpd/normal/fa.c | 6 | ||||
| -rw-r--r-- | src/ipcpd/normal/pol/graph.c | 10 | ||||
| -rw-r--r-- | src/ipcpd/normal/pol/link_state.c | 2 | ||||
| -rw-r--r-- | src/ipcpd/shim-eth-llc/main.c | 2 | ||||
| -rw-r--r-- | src/ipcpd/shim-udp/main.c | 28 | 
10 files changed, 35 insertions, 36 deletions
diff --git a/src/ipcpd/config.h.in b/src/ipcpd/config.h.in index 39be449d..322c6856 100644 --- a/src/ipcpd/config.h.in +++ b/src/ipcpd/config.h.in @@ -23,12 +23,13 @@  #define PTHREAD_COND_CLOCK  @PTHREAD_COND_CLOCK@  #define SYS_MAX_FLOWS       @SYS_MAX_FLOWS@ -#define AP_RES_FDS          @AP_RES_FDS@ -#define AP_MAX_FLOWS        @AP_MAX_FLOWS@ +#define PROG_RES_FDS        @PROG_RES_FDS@ +#define PROG_MAX_FLOWS      @PROG_MAX_FLOWS@  #define IPCP_ACCEPT_TIMEOUT @IPCP_ACCEPT_TIMEOUT@  #define SOCKET_TIMEOUT      @SOCKET_TIMEOUT@ +#define CONNECT_TIMEOUT     @CONNECT_TIMEOUT@  #define SHM_BUFFER_SIZE     @SHM_BUFFER_SIZE@ diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index ba89e2cc..42064817 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -62,7 +62,7 @@ void ipcp_sig_handler(int         sig,          case SIGTERM:          case SIGHUP:          case SIGQUIT: -                if (info->si_pid == ipcpi.irmd_api) { +                if (info->si_pid == ipcpi.irmd_pid) {                          if (ipcp_get_state() == IPCP_INIT)                                  ipcp_set_state(IPCP_NULL); @@ -407,7 +407,7 @@ static void * mainloop(void * o)                                  break;                          } -                        fd = np1_flow_alloc(msg->api, +                        fd = np1_flow_alloc(msg->pid,                                              msg->port_id,                                              msg->qoscube);                          if (fd < 0) { @@ -526,11 +526,11 @@ static int parse_args(int    argc,          if (!(argc == 4 || argc == 3))                  return -1; -        /* argument 1: api of irmd */ +        /* argument 1: pid of irmd */          if (atoi(argv[1]) == 0)                  return -1; -        ipcpi.irmd_api = atoi(argv[1]); +        ipcpi.irmd_pid = atoi(argv[1]);          /* argument 2: IPCP name */          ipcpi.name = argv[2]; diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h index 62fb310a..fbc44e5d 100644 --- a/src/ipcpd/ipcp.h +++ b/src/ipcpd/ipcp.h @@ -73,7 +73,7 @@ struct ipcp_ops {  #define ipcp_dir_hash_len() (hash_len(ipcpi.dir_hash_algo))  struct ipcp { -        int                irmd_api; +        pid_t              irmd_pid;          char *             name;          enum ipcp_type     type; diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index 684949d9..dc998965 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -139,7 +139,7 @@ static int ipcp_local_bootstrap(const struct ipcp_config * conf)                  return -1;          } -        log_info("Bootstrapped local IPCP with api %d.", getpid()); +        log_info("Bootstrapped local IPCP with pid %d.", getpid());          return 0;  } diff --git a/src/ipcpd/normal/dt.c b/src/ipcpd/normal/dt.c index f99f7072..5692a699 100644 --- a/src/ipcpd/normal/dt.c +++ b/src/ipcpd/normal/dt.c @@ -61,7 +61,7 @@ struct {          struct routing_i * routing[QOS_CUBE_MAX];          struct bmp *       res_fds; -        struct ae_info     aes[AP_RES_FDS]; +        struct ae_info     aes[PROG_RES_FDS];          pthread_rwlock_t   lock;          pthread_t          listener; @@ -127,7 +127,7 @@ static void sdu_handler(int                  fd,          } else {                  dt_pci_shrink(sdb); -                if (dt_pci.fd > AP_RES_FDS) { +                if (dt_pci.fd > PROG_RES_FDS) {                          if (ipcp_flow_write(dt_pci.fd, sdb))                                  ipcp_sdb_release(sdb);                          return; @@ -225,7 +225,7 @@ int dt_init(enum pol_routing pr,                  goto fail_rwlock_init;          } -        dt.res_fds = bmp_create(AP_RES_FDS, 0); +        dt.res_fds = bmp_create(PROG_RES_FDS, 0);          if (dt.res_fds == NULL)                  goto fail_res_fds; diff --git a/src/ipcpd/normal/fa.c b/src/ipcpd/normal/fa.c index e684abd2..6b8c65aa 100644 --- a/src/ipcpd/normal/fa.c +++ b/src/ipcpd/normal/fa.c @@ -50,8 +50,8 @@ typedef FlowAllocMsg flow_alloc_msg_t;  struct {          pthread_rwlock_t   flows_lock; -        int                r_fd[AP_MAX_FLOWS]; -        uint64_t           r_addr[AP_MAX_FLOWS]; +        int                r_fd[PROG_MAX_FLOWS]; +        uint64_t           r_addr[PROG_MAX_FLOWS];          int                fd;          struct sdu_sched * sdu_sched; @@ -188,7 +188,7 @@ int fa_init(void)  {          int i; -        for (i = 0; i < AP_MAX_FLOWS; ++i) +        for (i = 0; i < PROG_MAX_FLOWS; ++i)                  destroy_conn(i);          if (pthread_rwlock_init(&fa.flows_lock, NULL)) diff --git a/src/ipcpd/normal/pol/graph.c b/src/ipcpd/normal/pol/graph.c index a0af19f9..c3b5f976 100644 --- a/src/ipcpd/normal/pol/graph.c +++ b/src/ipcpd/normal/pol/graph.c @@ -359,7 +359,7 @@ static int get_min_vertex(struct graph *   graph,          *v = NULL;          list_for_each(p, &graph->vertices) { -                if (used[i] == true) { +                if (used[i]) {                          i++;                          continue;                  } @@ -592,9 +592,9 @@ int graph_routing_table_lfa(struct graph *     graph,                              struct list_head * table)  {          int *              s_dist; -        int *              n_dist[AP_MAX_FLOWS]; -        uint64_t           addrs[AP_MAX_FLOWS]; -        int                n_index[AP_MAX_FLOWS]; +        int *              n_dist[PROG_MAX_FLOWS]; +        uint64_t           addrs[PROG_MAX_FLOWS]; +        int                n_index[PROG_MAX_FLOWS];          struct list_head * p;          struct list_head * q;          struct vertex *    v; @@ -609,7 +609,7 @@ int graph_routing_table_lfa(struct graph *     graph,          pthread_mutex_lock(&graph->lock); -        for (j = 0; j < AP_MAX_FLOWS; j++) { +        for (j = 0; j < PROG_MAX_FLOWS; j++) {                  n_dist[i] = NULL;                  n_index[i] = -1;                  addrs[i] = -1; diff --git a/src/ipcpd/normal/pol/link_state.c b/src/ipcpd/normal/pol/link_state.c index 3979328c..00c72069 100644 --- a/src/ipcpd/normal/pol/link_state.c +++ b/src/ipcpd/normal/pol/link_state.c @@ -416,7 +416,7 @@ static void * calculate_pff(void * o)          struct list_head   table;          struct list_head * p;          struct list_head * q; -        int                fds[AP_MAX_FLOWS]; +        int                fds[PROG_MAX_FLOWS];          instance = (struct routing_i *) o; diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c index 2dd56856..cd245323 100644 --- a/src/ipcpd/shim-eth-llc/main.c +++ b/src/ipcpd/shim-eth-llc/main.c @@ -1107,7 +1107,7 @@ static int eth_llc_ipcp_bootstrap(const struct ipcp_config * conf)                  goto fail_sdu_writer;          } -        log_dbg("Bootstrapped shim IPCP over Ethernet with LLC with api %d.", +        log_dbg("Bootstrapped shim IPCP over Ethernet with LLC with pid %d.",                  getpid());          return 0; diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index f8248f86..4fafc4de 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -631,7 +631,7 @@ static int ipcp_udp_bootstrap(const struct ipcp_config * conf)                  goto fail_sduloop;          } -        log_dbg("Bootstrapped shim IPCP over UDP with api %d.", getpid()); +        log_dbg("Bootstrapped shim IPCP over UDP with pid %d.", getpid());          log_dbg("Bound to IP address %s.", ipstr);          log_dbg("DNS server address is %s.", dnsstr); @@ -654,7 +654,7 @@ static int ipcp_udp_bootstrap(const struct ipcp_config * conf)  /* NOTE: Disgusted with this crap */  static int ddns_send(char * cmd)  { -        pid_t api = -1; +        pid_t pid = -1;          int wstatus;          int pipe_fd[2];          char * argv[] = {NSUPDATE_EXEC, 0}; @@ -665,13 +665,13 @@ static int ddns_send(char * cmd)                  return -1;          } -        api = fork(); -        if (api == -1) { +        pid = fork(); +        if (pid == -1) {                  log_err("Failed to fork.");                  return -1;          } -        if (api == 0) { +        if (pid == 0) {                  close(pipe_fd[1]);                  dup2(pipe_fd[0], 0);                  execve(argv[0], &argv[0], envp); @@ -685,9 +685,8 @@ static int ddns_send(char * cmd)                  return -1;          } -        waitpid(api, &wstatus, 0); -        if (WIFEXITED(wstatus) == true && -            WEXITSTATUS(wstatus) == 0) +        waitpid(pid, &wstatus, 0); +        if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) == 0)                  log_dbg("Succesfully communicated with DNS server.");          else                  log_err("Failed to register with DNS server."); @@ -699,7 +698,7 @@ static int ddns_send(char * cmd)  static uint32_t ddns_resolve(char *   name,                               uint32_t dns_addr)  { -        pid_t api = -1; +        pid_t pid = -1;          int wstatus;          int pipe_fd[2];          char dnsstr[INET_ADDRSTRLEN]; @@ -718,13 +717,13 @@ static uint32_t ddns_resolve(char *   name,                  return 0;          } -        api = fork(); -        if (api == -1) { +        pid = fork(); +        if (pid == -1) {                  log_err("Failed to fork.");                  return 0;          } -        if (api == 0) { +        if (pid == 0) {                  char * argv[] = {NSLOOKUP_EXEC, name, dnsstr, 0};                  char * envp[] = {0}; @@ -744,9 +743,8 @@ static uint32_t ddns_resolve(char *   name,          close(pipe_fd[0]); -        waitpid(api, &wstatus, 0); -        if (WIFEXITED(wstatus) == true && -            WEXITSTATUS(wstatus) == 0) +        waitpid(pid, &wstatus, 0); +        if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) == 0)                  log_dbg("Succesfully communicated with nslookup.");          else                  log_err("Failed to resolve DNS address.");  | 
