Changeset 22478 in vbox
- Timestamp:
- Aug 26, 2009 4:39:10 PM (15 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/bootp.c
r22225 r22478 47 47 return NULL; 48 48 } 49 staticBOOTPClient *alloc_addr(PNATState pData)49 BOOTPClient *alloc_addr(PNATState pData) 50 50 { 51 51 int i; … … 74 74 bc->addr.s_addr = paddr->s_addr; 75 75 return bc; 76 return NULL;77 76 } 78 77 -
trunk/src/VBox/Devices/Network/slirp/ip_output.c
r22024 r22478 60 60 return &bootp_clients[i].macaddr[0]; 61 61 } 62 63 if (dst != 0)64 return pData->slirp_ethaddr;65 62 /* 63 * no chance to send this packet, sorry, we will request ether address via ARP 64 */ 65 slirp_arp_who_has(pData, dst); 66 66 return NULL; 67 67 } -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r22449 r22478 550 550 } 551 551 flags = LibAliasSetMode(pData->proxy_alias, 0, 0); 552 #ifndef NO_FW_PUNCH 553 flags |= PKT_ALIAS_PUNCH_FW; 554 #endif 552 555 flags |= PKT_ALIAS_LOG; /* set logging */ 553 556 flags = LibAliasSetMode(pData->proxy_alias, flags, ~0); … … 1367 1370 } 1368 1371 break; 1372 case ARPOP_REPLY: 1373 /* @todo check if we already have requested address */ 1374 /* if no*/ 1375 { 1376 BOOTPClient *bc = alloc_addr(pData); 1377 bc->addr.s_addr = *(uint32_t *)ah->ar_sip; 1378 memcpy(bc->macaddr, ah->ar_sha, ETH_ALEN); 1379 m_free(pData, m); 1380 } 1381 break; 1369 1382 default: 1370 1383 break; … … 1783 1796 } 1784 1797 1798 void slirp_arp_who_has(PNATState pData, uint32_t dst) 1799 { 1800 struct mbuf *m; 1801 struct ethhdr *ehdr; 1802 struct arphdr *ahdr; 1803 1804 m = m_get(pData); 1805 if (m == NULL) 1806 { 1807 LogRel(("NAT: Can't alloc mbuf for ARP request\n")); 1808 return; 1809 } 1810 ehdr = mtod(m, struct ethhdr *); 1811 memset(ehdr->h_source, 0xff, ETH_ALEN); 1812 ahdr = (struct ahdr *)&ehdr[1]; 1813 ahdr->ar_hrd = htons(1); 1814 ahdr->ar_pro = htons(ETH_P_IP); 1815 ahdr->ar_hln = ETH_ALEN; 1816 ahdr->ar_pln = 4; 1817 ahdr->ar_op = htons(ARPOP_REQUEST); 1818 memcpy(ahdr->ar_sha, special_ethaddr, ETH_ALEN); 1819 *(uint32_t *)ahdr->ar_sip = htonl(ntohl(special_addr.s_addr) | CTL_ALIAS); 1820 memset(ahdr->ar_tha, 0xff, ETH_ALEN); /*broadcast*/ 1821 *(uint32_t *)ahdr->ar_tip = dst; 1822 m->m_data += if_maxlinkhdr; 1823 m->m_len = sizeof(struct arphdr); 1824 if_encap(pData, ETH_P_ARP, m); 1825 LogRel(("NAT: ARP request sent\n")); 1826 }
Note:
See TracChangeset
for help on using the changeset viewer.