Changeset 16254 in vbox for trunk/src/VBox/Devices/Network/slirp
- Timestamp:
- Jan 27, 2009 10:09:55 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/bootp.c
r16249 r16254 215 215 RTStrPrintf((char*)rbp->bp_file, sizeof(rbp->bp_file), "%s", bootp_filename); 216 216 217 saddr.sin_addr.s_addr = pData->tftp_server.s_addr; 217 /* Address/port of the DHCP server. */ 218 saddr.sin_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS); 218 219 saddr.sin_port = htons(BOOTP_SERVER); 219 220 … … 227 228 228 229 rbp->bp_yiaddr = daddr.sin_addr; /* Client IP address */ 229 rbp->bp_siaddr = saddr.sin_addr; /* Server IP address */ 230 231 /*XXX: latter it used for initialization of gateway*/ 232 saddr.sin_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS); 230 rbp->bp_siaddr = pData->tftp_server; /* Next Server IP address, i.e. TFTP */ 233 231 234 232 q = rbp->bp_vend; -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r16249 r16254 204 204 inet_aton("255.0.0.0", &local_mask); 205 205 inet_aton("127.0.0.0", &local_network); 206 for (pIPAddr = &FixedInfo->DnsServerList; pIPAddr != NULL; pIPAddr = pIPAddr->Next) 207 { 208 struct dns_entry *da = RTMemAllocZ(sizeof (struct dns_entry)); 209 if (da == NULL) 206 for (pIPAddr = &FixedInfo->DnsServerList; pIPAddr != NULL; pIPAddr = pIPAddr->Next) 207 { 208 struct dns_entry *da = RTMemAllocZ(sizeof (struct dns_entry)); 209 if (da == NULL) 210 210 { 211 211 LogRel(("can't alloc memory for DNS entry\n")); … … 215 215 inet_aton(pIPAddr->IpAddress.String, &da->de_addr); 216 216 if ((ntohl(da->de_addr.s_addr) & ntohl(local_mask.s_addr)) == ntohl(local_network.s_addr)) { 217 da->de_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS); 217 da->de_addr.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS); 218 218 } 219 219 LIST_INSERT_HEAD(&pData->dns_list_head, da, de_list); … … 374 374 bootp_filename = pszBootFile; 375 375 pData->netmask = u32Netmask; 376 /* @todo: add ability to configurate this staff */377 pData->tftp_server.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_TFTP);378 376 379 377 #ifdef RT_OS_WINDOWS … … 399 397 inet_aton(pszNetAddr, &special_addr); 400 398 alias_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS); 399 /* @todo: add ability to configure this staff */ 400 pData->tftp_server.s_addr = htonl(ntohl(special_addr.s_addr) | CTL_TFTP); 401 401 402 402 /* set default addresses */ … … 747 747 { 748 748 #if defined(RT_OS_WINDOWS) 749 /*XXX: before renaming please make see define 749 /*XXX: before renaming please make see define 750 750 * fIcmp in slirp_state.h 751 751 */ … … 1010 1010 eh = (struct ethhdr *)pkt; 1011 1011 #else 1012 struct mbuf *mr; 1012 struct mbuf *mr; 1013 1013 eh = mtod(m, struct ethhdr *); 1014 1014 #endif … … 1057 1057 memcpy(rah->ar_sha, special_ethaddr, ETH_ALEN); 1058 1058 1059 switch (htip & ~pData->netmask) 1059 switch (htip & ~pData->netmask) 1060 1060 { 1061 1061 case CTL_DNS: … … 1065 1065 default:; 1066 1066 } 1067 1067 1068 1068 memcpy(rah->ar_sip, ah->ar_tip, 4); 1069 1069 memcpy(rah->ar_tha, ah->ar_sha, ETH_ALEN); … … 1088 1088 static bool fWarnedIpv6; 1089 1089 1090 if (pkt_len < ETH_HLEN) 1090 if (pkt_len < ETH_HLEN) 1091 1091 { 1092 1092 LogRel(("NAT: packet having size %d has been ingnored\n", pkt_len)); 1093 1093 return; 1094 1094 } 1095 1095 1096 1096 m = m_get(pData); 1097 1097 if (!m) … … 1157 1157 eh = mtod(m, struct ethhdr *); 1158 1158 #else 1159 uint8_t buf[1600]; 1159 uint8_t buf[1600]; 1160 1160 struct ethhdr *eh = (struct ethhdr *)buf; 1161 1161 1162 1162 if (ip_data_len + ETH_HLEN > sizeof(buf)) 1163 1163 return; 1164 1164 1165 1165 memcpy(buf + sizeof(struct ethhdr), ip_data, ip_data_len); 1166 1166 #endif … … 1176 1176 slirp_output(pData->pvUser, m, mtod(m, uint8_t *), m->m_len); 1177 1177 #else 1178 memcpy(buf, mtod(m, uint8_t *), m->m_len); 1178 memcpy(buf, mtod(m, uint8_t *), m->m_len); 1179 1179 slirp_output(pData->pvUser, NULL, buf, m->m_len); 1180 1180 m_free(pData, m); … … 1244 1244 void slirp_post_sent(PNATState pData, void *pvArg) 1245 1245 { 1246 struct socket *so = 0; 1246 struct socket *so = 0; 1247 1247 struct tcpcb *tp = 0; 1248 1248 struct mbuf *m = (struct mbuf *)pvArg; 1249 m_free(pData, m); 1250 } 1249 m_free(pData, m); 1250 }
Note:
See TracChangeset
for help on using the changeset viewer.