- # Frame size = PROX pkt size + 4 bytes CRC
- # The set_size function takes the PROX packet size as a parameter
- self.socket.set_size(self.machine_params['gencores'], 0, frame_size - 4)
- # 18 is the difference between the frame size and IP size = size of (MAC addresses, ethertype and FCS)
- self.socket.set_value(self.machine_params['gencores'], 0, 16, frame_size-18, 2)
- # 38 is the difference between the frame size and UDP size = 18 + size of IP header (=20)
- self.socket.set_value(self.machine_params['gencores'], 0, 38, frame_size-38, 2)
+ # If only 1 packet size, still using the 'old' way of setting the
+ # packet sizes in PROX. Otherwise, using the 'new' way which
+ # automatically sets IP and UDP sizes. We should switch to the new way
+ # eventually for all cases.
+ if len(imix_frame_sizes) == 1:
+ # Frame size = PROX pkt size + 4 bytes CRC
+ # The set_size function takes the PROX packet size as a parameter
+ self.socket.set_size(self.machine_params['gencores'], 0,
+ imix_frame_sizes[0] - 4)
+ # 18 is the difference between the frame size and IP size =
+ # size of (MAC addresses, ethertype and FCS)
+ self.socket.set_value(self.machine_params['gencores'], 0, 16,
+ imix_frame_sizes[0] - 18, 2)
+ # 38 is the difference between the frame size and UDP size =
+ # 18 + size of IP header (=20)
+ self.socket.set_value(self.machine_params['gencores'], 0, 38,
+ imix_frame_sizes[0] - 38, 2)
+ else:
+ prox_sizes = [frame_size - 4 for frame_size in imix_frame_sizes]
+ self.socket.set_imix(self.machine_params['gencores'], 0,
+ prox_sizes)