ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/ether.cpp
(Generate patch)

Comparing BasiliskII/src/ether.cpp (file contents):
Revision 1.6 by cebix, 2001-07-13T15:39:21Z vs.
Revision 1.7 by cebix, 2001-07-13T18:49:22Z

# Line 182 | Line 182 | void EtherReset(void)
182  
183  
184   /*
185 < *  Check whether Ethernet address is AppleTalk broadcast address
185 > *  Check whether Ethernet address is AppleTalk or Ethernet broadcast address
186   */
187  
188   static inline bool is_apple_talk_broadcast(uint8 *p)
# Line 191 | Line 191 | static inline bool is_apple_talk_broadca
191              && p[3] == 0xff && p[4] == 0xff && p[5] == 0xff;
192   }
193  
194 + static inline bool is_ethernet_broadcast(uint8 *p)
195 + {
196 +        return p[0] == 0xff && p[1] == 0xff && p[2] == 0xff
197 +            && p[3] == 0xff && p[4] == 0xff && p[5] == 0xff;
198 + }
199 +
200  
201   /*
202   *  Driver Open() routine
# Line 290 | Line 296 | int16 EtherControl(uint32 pb, uint32 dce
296  
297                  case kENetWrite: {              // Transmit raw Ethernet packet
298                          uint32 wds = ReadMacInt32(pb + ePointer);
299 <                        D(bug(" EtherWrite\n"));
299 >                        D(bug(" EtherWrite "));
300                          if (ReadMacInt16(wds) < 14)
301                                  return eLenErr; // Header incomplete
302 +
303 +                        // Set source address
304 +                        uint32 hdr = ReadMacInt32(wds + 2);
305 +                        Host2Mac_memcpy(hdr + 6, ether_addr, 6);
306 +                        D(bug("to %08x%04x, type %04x\n", ReadMacInt32(hdr), ReadMacInt16(hdr + 4), ReadMacInt16(hdr + 12)));
307 +
308                          if (net_open) {
309   #if SUPPORTS_UDP_TUNNEL
310                                  if (udp_tunnel) {
# Line 301 | Line 313 | int16 EtherControl(uint32 pb, uint32 dce
313                                          uint8 packet[1514];
314                                          int len = ether_wds_to_buffer(wds, packet);
315  
316 <                                        // Set source address and extract destination address
305 <                                        memcpy(packet + 6, ether_addr, 6);
316 >                                        // Extract destination address
317                                          uint32 dest_ip;
318                                          if (packet[0] == 'B' && packet[1] == '2')
319                                                  dest_ip = (packet[2] << 24) | (packet[3] << 16) | (packet[4] << 8) | packet[5];
320 <                                        else if (is_apple_talk_broadcast(packet))
320 >                                        else if (is_apple_talk_broadcast(packet) || is_ethernet_broadcast(packet))
321                                                  dest_ip = INADDR_BROADCAST;
322                                          else
323                                                  return eMultiErr;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines