Changeset 19846 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- May 20, 2009 6:04:28 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/ip_output.c
r19839 r19846 49 49 { 50 50 int i; 51 /* temporary do for dhcp client */ 51 /* @todo (r - vasily) to quick ramp up on routing rails 52 * we use information from DHCP server leasings, this 53 * code couldn't detect any changes in network topology 54 * and should be borrowed from other places 55 */ 52 56 for(i = 0; i < NB_ADDR; i++) 53 57 { … … 79 83 register int hlen = sizeof(struct ip ); 80 84 int len, off, error = 0; 85 #ifdef VBOX_WITHOUT_SLIRP_CLIENT_ETHER 86 extern uint8_t zerro_ethaddr[ETH_ALEN]; 87 struct ethhdr *eh; 88 uint8_t *eth_dst; 89 #endif 81 90 82 91 DEBUG_CALL("ip_output"); … … 117 126 } 118 127 #endif 128 #ifdef VBOX_WITHOUT_SLIRP_CLIENT_ETHER 129 /* Current TCP/IP stack hasn't routing information at 130 * all so we need to calculate destination ethernet address 131 */ 132 eh = (struct ethhdr *)MBUF_HEAD(m); 133 if (memcmp(eh->h_source, zerro_ethaddr, ETH_ALEN) == 0) { 134 eth_dst = rt_lookup_in_cache(pData, ip->ip_dst.s_addr); 135 } 136 137 #endif 119 138 120 139 /* … … 128 147 ip->ip_sum = cksum(m, hlen); 129 148 #ifdef VBOX_WITHOUT_SLIRP_CLIENT_ETHER 130 /* Current TCP/IP stack hasn't routing information at 131 * all so we need to calculate destination ethernet address 132 */ 133 { 134 extern uint8_t zerro_ethaddr[ETH_ALEN]; 135 struct ethhdr *eh; 136 eh = (struct ethhdr *)MBUF_HEAD(m); 137 if (memcmp(eh->h_source, zerro_ethaddr, ETH_ALEN) == 0) { 138 char *dst = rt_lookup_in_cache(pData, ip->ip_dst.s_addr); 139 if (dst != NULL) { 140 memcpy(eh->h_source, dst, ETH_ALEN); 141 } 142 } 149 if (eth_dst != NULL) { 150 memcpy(eh->h_source, eth_dst, ETH_ALEN); 143 151 } 144 152 #endif … … 178 186 for (off = hlen + len; off < (u_int16_t)ip->ip_len; off += len) 179 187 { 180 #ifdef VBOX_WITHOUT_SLIRP_CLIENT_ETHER181 struct ethhdr *eh0;182 struct ethhdr *eh;183 #endif184 188 register struct ip *mhip; 185 189 m = m_get(pData); … … 190 194 goto sendorfree; 191 195 } 192 #ifdef VBOX_WITH_NAT_SERVICE193 eh0 = (struct ethhdr *)MBUF_HEAD(m0);194 eh = (struct ethhdr *)MBUF_HEAD(m);195 memcpy(eh->h_source, eh0->h_source, ETH_ALEN);196 #endif197 196 m_adj(m, if_maxlinkhdr); 198 197 mhip = mtod(m, struct ip *); 199 198 *mhip = *ip; 199 #ifdef VBOX_WITHOUT_SLIRP_CLIENT_ETHER 200 /* we've calculated eth_dst for first packet */ 201 eh = (struct ethhdr *)MBUF_HEAD(m); 202 if (eth_dst != NULL) { 203 memcpy(eh->h_source, eth_dst, ETH_ALEN); 204 } 205 #endif 200 206 201 207 #if 0 /* No options */
Note:
See TracChangeset
for help on using the changeset viewer.