- Timestamp:
- Mar 31, 2013 2:03:24 AM (12 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c
r40423 r45261 1 1 /* $Id$ */ 2 3 /* 4 * Copyright (C) 2009-2013 Oracle Corporation 5 * 6 * This file is part of VirtualBox Open Source Edition (OSE), as 7 * available from http://www.virtualbox.org. This file is free software; 8 * you can redistribute it and/or modify it under the terms of the GNU 9 * General Public License (GPL) as published by the Free Software 10 * Foundation, in version 2 as it comes in the "COPYING" file of the 11 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the 12 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 13 * 14 * The contents of this file may alternatively be used under the terms 15 * of the Common Development and Distribution License Version 1.0 16 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the 17 * VirtualBox OSE distribution, in which case the provisions of the 18 * CDDL are applicable instead of those of the GPL. 19 * 20 * You may elect to license modified versions of this file under the 21 * terms and conditions of either the GPL or the CDDL or both. 22 */ 23 2 24 /* 3 25 * Copyright (c) 2003,2004,2005 Armin Wolfermann … … 105 127 struct request *req = (struct request *)arg; 106 128 struct dns_entry *de; 129 /* be paranoid */ 130 AssertPtrReturnVoid(arg); 107 131 de = TAILQ_PREV(req->dns_server, dns_list_head, de_list); 108 132 /* here we should check if we reached the end of the DNS server list */ … … 112 136 RTMemFree(req); 113 137 ++removed_queries; 138 /* the rest of clean up at the end of the method. */ 114 139 } 115 140 else 116 141 { 142 /* Note: so will be deleted after we create new one (so1) 143 * to make attempt on the next server. 144 */ 117 145 struct ip *ip; 118 146 struct udphdr *udp; … … 121 149 struct mbuf *m = NULL; 122 150 char *data; 151 123 152 if (so1 == NULL) 124 153 { 125 154 LogRel(("NAT: can't create DNS socket\n")); 126 return; 127 } 155 goto socket_clean_up; 156 } 157 128 158 if(udp_attach(pData, so1) == -1) 129 159 { 130 160 LogRel(("NAT: can't attach udp socket\n")); 131 161 sofree(pData, so1); 132 return; 133 } 162 goto socket_clean_up; 163 } 164 134 165 m = slirpDnsMbufAlloc(pData); 135 166 if (m == NULL) … … 137 168 LogRel(("NAT: Can't allocate mbuf\n")); 138 169 udp_detach(pData, so1); 139 return; 140 } 170 goto socket_clean_up; 171 } 172 141 173 /* mbuf initialization */ 142 174 m->m_data += if_maxlinkhdr; 175 143 176 ip = mtod(m, struct ip *); 144 177 udp = (struct udphdr *)&ip[1]; /* ip attributes */ 145 178 data = (char *)&udp[1]; 146 179 iphlen = sizeof(struct ip); 180 147 181 m->m_len += sizeof(struct ip); 148 182 m->m_len += sizeof(struct udphdr); 149 183 m->m_len += req->nbyte; 184 150 185 ip->ip_src.s_addr = so->so_laddr.s_addr; 151 186 ip->ip_dst.s_addr = RT_H2N_U32(RT_N2H_U32(pData->special_addr.s_addr) | CTL_DNS); … … 158 193 so1->so_faddr = so->so_faddr; 159 194 so1->so_fport = so->so_fport; 195 160 196 req->dns_server = de; 161 197 so1->so_timeout_arg = req; 162 198 so1->so_timeout = timeout; 199 163 200 dnsproxy_query(pData, so1, m, iphlen); 164 201 } 202 203 socket_clean_up: 204 /* This socket (so) will be detached, so we need to remove timeout(&_arg) references 205 * before leave 206 */ 207 so->so_timeout = NULL; 208 so->so_timeout_arg = NULL; 209 return; 210 165 211 } 166 212 #endif /* VBOX */ -
trunk/src/VBox/Devices/Network/slirp/queue.h
r28800 r45261 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as -
trunk/src/VBox/Devices/Network/slirp/socket.c
r43752 r45261 196 196 */ 197 197 Assert(!sototcpcb(so)); 198 /* udp checks */ 199 Assert(!so->so_timeout); 200 Assert(!so->so_timeout_arg); 198 201 if (so == tcp_last_so) 199 202 tcp_last_so = &tcb;
Note:
See TracChangeset
for help on using the changeset viewer.