163 // the session needs the current server configuration |
163 // the session needs the current server configuration |
164 sn->config = request->connection->listener->cfg; |
164 sn->config = request->connection->listener->cfg; |
165 |
165 |
166 // add ip to sn->client pblock |
166 // add ip to sn->client pblock |
167 char ip_str[INET_ADDRSTRLEN]; |
167 char ip_str[INET_ADDRSTRLEN]; |
168 if(inet_ntop( |
168 // TODO: ipv6 |
169 AF_INET, |
169 if(request->connection->addr_type == CONN_ADDR_IPV4) { |
170 &request->connection->address.sin_addr, |
170 if(inet_ntop( |
171 ip_str, |
171 AF_INET, |
172 INET_ADDRSTRLEN) != NULL) |
172 &request->connection->address.address_v4.sin_addr, |
173 { |
173 ip_str, |
174 pblock_kvinsert(pb_key_ip, ip_str, INET_ADDRSTRLEN, sn->sn.client); |
174 INET_ADDRSTRLEN) != NULL) |
|
175 { |
|
176 pblock_kvinsert(pb_key_ip, ip_str, INET_ADDRSTRLEN, sn->sn.client); |
|
177 } |
175 } |
178 } |
176 |
179 |
177 // init NSAPI request structure |
180 // init NSAPI request structure |
178 if(request_initialize(pool, request, rq) != 0) { |
181 if(request_initialize(pool, request, rq) != 0) { |
179 log_ereport(LOG_FAILURE, "Cannot initialize request structure"); |
182 log_ereport(LOG_FAILURE, "Cannot initialize request structure"); |