Changes in uspace/srv/net/dnsrsrv/transport.c [26de91a:02a09ed] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/dnsrsrv/transport.c
r26de91a r02a09ed 158 158 assert(fibril_mutex_is_locked(&treq_lock)); 159 159 160 list_foreach(treq_list, lreq, trans_req_t, treq) { 160 list_foreach(treq_list, link) { 161 trans_req_t *treq = list_get_instance(link, trans_req_t, lreq); 162 161 163 if (treq->req->id == resp->id) { 162 164 /* Match */ … … 182 184 { 183 185 trans_req_t *treq = NULL; 184 struct sockaddr *saddr = NULL;185 socklen_t saddrlen;186 186 187 187 void *req_data; … … 191 191 goto error; 192 192 193 rc = inet_addr_sockaddr(&dns_server_addr, DNS_SERVER_PORT, 194 &saddr, &saddrlen); 195 if (rc != EOK) { 196 assert(rc == ENOMEM); 193 struct sockaddr_in addr; 194 struct sockaddr_in6 addr6; 195 uint16_t af = 196 inet_addr_sockaddr_in(&dns_server_addr, &addr, &addr6); 197 198 struct sockaddr *address; 199 socklen_t addrlen; 200 201 switch (af) { 202 case AF_INET: 203 addr.sin_port = htons(DNS_SERVER_PORT); 204 address = (struct sockaddr *) &addr; 205 addrlen = sizeof(addr); 206 break; 207 case AF_INET6: 208 addr6.sin6_port = htons(DNS_SERVER_PORT); 209 address = (struct sockaddr *) &addr6; 210 addrlen = sizeof(addr6); 211 break; 212 default: 213 rc = EAFNOSUPPORT; 197 214 goto error; 198 215 } … … 202 219 while (ntry < REQ_RETRY_MAX) { 203 220 rc = sendto(transport_fd, req_data, req_size, 0, 204 saddr, saddrlen);221 (struct sockaddr *) address, addrlen); 205 222 if (rc != EOK) 206 223 goto error; … … 241 258 treq_destroy(treq); 242 259 free(req_data); 243 free(saddr);244 260 return EOK; 245 261 … … 249 265 250 266 free(req_data); 251 free(saddr);252 267 return rc; 253 268 }
Note:
See TracChangeset
for help on using the changeset viewer.