@@ -91,8 +91,8 @@ struct fd_repair_tile_ctx {
91
91
ushort net_id ;
92
92
/* Includes Ethernet, IP, UDP headers */
93
93
uchar buffer [ MAX_BUFFER_SIZE ];
94
- fd_net_hdrs_t intake_hdr [1 ];
95
- fd_net_hdrs_t serve_hdr [1 ];
94
+ fd_ip4_udp_hdrs_t intake_hdr [1 ];
95
+ fd_ip4_udp_hdrs_t serve_hdr [1 ];
96
96
97
97
fd_stake_ci_t * stake_ci ;
98
98
@@ -148,28 +148,26 @@ send_packet( fd_repair_tile_ctx_t * ctx,
148
148
ulong payload_sz ,
149
149
ulong tsorig ) {
150
150
uchar * packet = fd_chunk_to_laddr ( ctx -> net_out_mem , ctx -> net_out_chunk );
151
-
152
- fd_memcpy ( packet , ( is_intake ? ctx -> intake_hdr : ctx -> serve_hdr ), sizeof (fd_net_hdrs_t ) );
153
- fd_net_hdrs_t * hdr = (fd_net_hdrs_t * )packet ;
154
-
155
- hdr -> ip4 -> saddr = src_ip_addr ;
156
- hdr -> ip4 -> daddr = dst_ip_addr ;
157
- hdr -> ip4 -> net_id = fd_ushort_bswap ( ctx -> net_id ++ );
158
- hdr -> ip4 -> check = 0U ;
159
- hdr -> ip4 -> net_tot_len = fd_ushort_bswap ( (ushort )(payload_sz + sizeof (fd_ip4_hdr_t )+ sizeof (fd_udp_hdr_t )) );
160
- hdr -> ip4 -> check = fd_ip4_hdr_check_fast ( hdr -> buf + 14 );
161
-
162
- ulong packet_sz = payload_sz + sizeof (fd_net_hdrs_t );
163
- fd_memcpy ( packet + sizeof (fd_net_hdrs_t ), payload , payload_sz );
164
- hdr -> udp -> net_dport = dst_port ;
165
- hdr -> udp -> net_len = fd_ushort_bswap ( (ushort )(payload_sz + sizeof (fd_udp_hdr_t )) );
166
- hdr -> udp -> check = fd_ip4_udp_check ( hdr -> ip4 -> saddr ,
167
- hdr -> ip4 -> daddr ,
168
- (fd_udp_hdr_t const * )(hdr -> buf + 34 ),
169
- packet + sizeof (fd_net_hdrs_t ) );
170
-
171
- ulong tspub = fd_frag_meta_ts_comp ( fd_tickcount () );
172
- ulong sig = fd_disco_netmux_sig ( dst_ip_addr , dst_port , dst_ip_addr , DST_PROTO_OUTGOING , FD_NETMUX_SIG_MIN_HDR_SZ );
151
+ fd_ip4_udp_hdrs_t * hdr = (fd_ip4_udp_hdrs_t * )packet ;
152
+ * hdr = * (is_intake ? ctx -> intake_hdr : ctx -> serve_hdr );
153
+
154
+ fd_ip4_hdr_t * ip4 = hdr -> ip4 ;
155
+ ip4 -> saddr = src_ip_addr ;
156
+ ip4 -> daddr = dst_ip_addr ;
157
+ ip4 -> net_id = fd_ushort_bswap ( ctx -> net_id ++ );
158
+ ip4 -> check = 0U ;
159
+ ip4 -> net_tot_len = fd_ushort_bswap ( (ushort )(payload_sz + sizeof (fd_ip4_hdr_t )+ sizeof (fd_udp_hdr_t )) );
160
+ ip4 -> check = fd_ip4_hdr_check_fast ( ip4 );
161
+
162
+ fd_udp_hdr_t * udp = hdr -> udp ;
163
+ udp -> net_dport = dst_port ;
164
+ udp -> net_len = fd_ushort_bswap ( (ushort )(payload_sz + sizeof (fd_udp_hdr_t )) );
165
+ fd_memcpy ( packet + sizeof (fd_ip4_udp_hdrs_t ), payload , payload_sz );
166
+ hdr -> udp -> check = 0U ;
167
+
168
+ ulong tspub = fd_frag_meta_ts_comp ( fd_tickcount () );
169
+ ulong sig = fd_disco_netmux_sig ( dst_ip_addr , dst_port , dst_ip_addr , DST_PROTO_OUTGOING , sizeof (fd_ip4_udp_hdrs_t ) );
170
+ ulong packet_sz = payload_sz + sizeof (fd_ip4_udp_hdrs_t );
173
171
fd_mcache_publish ( ctx -> net_out_mcache , ctx -> net_out_depth , ctx -> net_out_seq , sig , ctx -> net_out_chunk , packet_sz , 0UL , tsorig , tspub );
174
172
ctx -> net_out_seq = fd_seq_inc ( ctx -> net_out_seq , 1UL );
175
173
ctx -> net_out_chunk = fd_dcache_compact_next ( ctx -> net_out_chunk , packet_sz , ctx -> net_out_chunk0 , ctx -> net_out_wmark );
@@ -535,8 +533,8 @@ unprivileged_init( fd_topo_t * topo,
535
533
536
534
ctx -> net_id = (ushort )0 ;
537
535
538
- fd_net_create_packet_header_template ( ctx -> intake_hdr , FD_REPAIR_MAX_PACKET_SIZE , 0 , ctx -> repair_intake_listen_port );
539
- fd_net_create_packet_header_template ( ctx -> serve_hdr , FD_REPAIR_MAX_PACKET_SIZE , 0 , ctx -> repair_serve_listen_port );
536
+ fd_ip4_udp_hdr_init ( ctx -> intake_hdr , FD_REPAIR_MAX_PACKET_SIZE , 0 , ctx -> repair_intake_listen_port );
537
+ fd_ip4_udp_hdr_init ( ctx -> serve_hdr , FD_REPAIR_MAX_PACKET_SIZE , 0 , ctx -> repair_serve_listen_port );
540
538
541
539
/* Keyguard setup */
542
540
fd_topo_link_t * sign_in = & topo -> links [ tile -> in_link_id [ SIGN_IN_IDX ] ];
0 commit comments