Changeset 26de91a in mainline for uspace/srv/net/dnsrsrv/transport.c
- Timestamp:
- 2013-10-04T17:19:20Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9749e47
- Parents:
- e2839d7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/dnsrsrv/transport.c
re2839d7 r26de91a 182 182 { 183 183 trans_req_t *treq = NULL; 184 struct sockaddr *saddr = NULL; 185 socklen_t saddrlen; 184 186 185 187 void *req_data; … … 189 191 goto error; 190 192 191 struct sockaddr_in addr; 192 struct sockaddr_in6 addr6; 193 uint16_t af = 194 inet_addr_sockaddr_in(&dns_server_addr, &addr, &addr6); 195 196 struct sockaddr *address; 197 socklen_t addrlen; 198 199 switch (af) { 200 case AF_INET: 201 addr.sin_port = htons(DNS_SERVER_PORT); 202 address = (struct sockaddr *) &addr; 203 addrlen = sizeof(addr); 204 break; 205 case AF_INET6: 206 addr6.sin6_port = htons(DNS_SERVER_PORT); 207 address = (struct sockaddr *) &addr6; 208 addrlen = sizeof(addr6); 209 break; 210 default: 211 rc = EAFNOSUPPORT; 193 rc = inet_addr_sockaddr(&dns_server_addr, DNS_SERVER_PORT, 194 &saddr, &saddrlen); 195 if (rc != EOK) { 196 assert(rc == ENOMEM); 212 197 goto error; 213 198 } … … 217 202 while (ntry < REQ_RETRY_MAX) { 218 203 rc = sendto(transport_fd, req_data, req_size, 0, 219 (struct sockaddr *) address,addrlen);204 saddr, saddrlen); 220 205 if (rc != EOK) 221 206 goto error; … … 256 241 treq_destroy(treq); 257 242 free(req_data); 243 free(saddr); 258 244 return EOK; 259 245 … … 263 249 264 250 free(req_data); 251 free(saddr); 265 252 return rc; 266 253 }
Note:
See TracChangeset
for help on using the changeset viewer.