@@ -90,12 +90,12 @@ static __always_inline int vlan_tag_push(struct xdp_md *ctx,
9090 if (eth + 1 > data_end )
9191 return -1 ;
9292
93- /* Copy back the Ethernet header in the right place, populate the VLAN
94- * tag with the ID and proto, and set the outer Ethernet header to VLAN
95- * type. * /
93+ /* Copy back Ethernet header in the right place, populate VLAN tag with
94+ * ID and proto, and set outer Ethernet header to VLAN type.
95+ */
9696 __builtin_memcpy (eth , & eth_cpy , sizeof (* eth ));
9797
98- vlh = (void * )(eth + 1 );
98+ vlh = (void * )(eth + 1 );
9999
100100 if (vlh + 1 > data_end )
101101 return -1 ;
@@ -113,6 +113,7 @@ static __always_inline int vlan_tag_push(struct xdp_md *ctx,
113113static __always_inline void swap_src_dst_mac (struct ethhdr * eth )
114114{
115115 __u8 h_tmp [ETH_ALEN ];
116+
116117 __builtin_memcpy (h_tmp , eth -> h_source , ETH_ALEN );
117118 __builtin_memcpy (eth -> h_source , eth -> h_dest , ETH_ALEN );
118119 __builtin_memcpy (eth -> h_dest , h_tmp , ETH_ALEN );
@@ -124,6 +125,7 @@ static __always_inline void swap_src_dst_mac(struct ethhdr *eth)
124125static __always_inline void swap_src_dst_ipv6 (struct ipv6hdr * ipv6 )
125126{
126127 struct in6_addr tmp = ipv6 -> saddr ;
128+
127129 ipv6 -> saddr = ipv6 -> daddr ;
128130 ipv6 -> daddr = tmp ;
129131}
@@ -134,6 +136,7 @@ static __always_inline void swap_src_dst_ipv6(struct ipv6hdr *ipv6)
134136static __always_inline void swap_src_dst_ipv4 (struct iphdr * iphdr )
135137{
136138 __be32 tmp = iphdr -> saddr ;
139+
137140 iphdr -> saddr = iphdr -> daddr ;
138141 iphdr -> daddr = tmp ;
139142}
0 commit comments