@@ -927,10 +927,6 @@ static inline void gtp1_push_header(struct sk_buff *skb, struct pdp_ctx *pctx)
927
927
928
928
struct gtp_pktinfo {
929
929
struct sock * sk ;
930
- union {
931
- struct iphdr * iph ;
932
- struct ipv6hdr * ip6h ;
933
- };
934
930
union {
935
931
struct flowi4 fl4 ;
936
932
struct flowi6 fl6 ;
@@ -941,6 +937,7 @@ struct gtp_pktinfo {
941
937
};
942
938
struct pdp_ctx * pctx ;
943
939
struct net_device * dev ;
940
+ __u8 tos ;
944
941
__be16 gtph_port ;
945
942
};
946
943
@@ -959,27 +956,27 @@ static void gtp_push_header(struct sk_buff *skb, struct gtp_pktinfo *pktinfo)
959
956
}
960
957
961
958
static inline void gtp_set_pktinfo_ipv4 (struct gtp_pktinfo * pktinfo ,
962
- struct sock * sk , struct iphdr * iph ,
959
+ struct sock * sk , __u8 tos ,
963
960
struct pdp_ctx * pctx , struct rtable * rt ,
964
961
struct flowi4 * fl4 ,
965
962
struct net_device * dev )
966
963
{
967
964
pktinfo -> sk = sk ;
968
- pktinfo -> iph = iph ;
965
+ pktinfo -> tos = tos ;
969
966
pktinfo -> pctx = pctx ;
970
967
pktinfo -> rt = rt ;
971
968
pktinfo -> fl4 = * fl4 ;
972
969
pktinfo -> dev = dev ;
973
970
}
974
971
975
972
static void gtp_set_pktinfo_ipv6 (struct gtp_pktinfo * pktinfo ,
976
- struct sock * sk , struct ipv6hdr * ip6h ,
973
+ struct sock * sk , __u8 tos ,
977
974
struct pdp_ctx * pctx , struct rt6_info * rt6 ,
978
975
struct flowi6 * fl6 ,
979
976
struct net_device * dev )
980
977
{
981
978
pktinfo -> sk = sk ;
982
- pktinfo -> ip6h = ip6h ;
979
+ pktinfo -> tos = tos ;
983
980
pktinfo -> pctx = pctx ;
984
981
pktinfo -> rt6 = rt6 ;
985
982
pktinfo -> fl6 = * fl6 ;
@@ -1057,7 +1054,7 @@ static int gtp_build_skb_ip4(struct sk_buff *skb, struct net_device *dev,
1057
1054
goto err_rt ;
1058
1055
}
1059
1056
1060
- gtp_set_pktinfo_ipv4 (pktinfo , pctx -> sk , iph , pctx , rt , & fl4 , dev );
1057
+ gtp_set_pktinfo_ipv4 (pktinfo , pctx -> sk , iph -> tos , pctx , rt , & fl4 , dev );
1061
1058
gtp_push_header (skb , pktinfo );
1062
1059
1063
1060
netdev_dbg (dev , "gtp -> IP src: %pI4 dst: %pI4\n" ,
@@ -1080,6 +1077,7 @@ static int gtp_build_skb_ip6(struct sk_buff *skb, struct net_device *dev,
1080
1077
struct ipv6hdr * ip6h ;
1081
1078
struct rt6_info * rt ;
1082
1079
struct flowi6 fl6 ;
1080
+ __u8 tos ;
1083
1081
int mtu ;
1084
1082
1085
1083
/* Read the IP destination address and resolve the PDP context.
@@ -1135,7 +1133,8 @@ static int gtp_build_skb_ip6(struct sk_buff *skb, struct net_device *dev,
1135
1133
goto err_rt ;
1136
1134
}
1137
1135
1138
- gtp_set_pktinfo_ipv6 (pktinfo , pctx -> sk , ip6h , pctx , rt , & fl6 , dev );
1136
+ tos = ipv6_get_dsfield (ip6h );
1137
+ gtp_set_pktinfo_ipv6 (pktinfo , pctx -> sk , tos , pctx , rt , & fl6 , dev );
1139
1138
gtp_push_header (skb , pktinfo );
1140
1139
1141
1140
netdev_dbg (dev , "gtp -> IP src: %pI6 dst: %pI6\n" ,
@@ -1182,7 +1181,7 @@ static netdev_tx_t gtp_dev_xmit(struct sk_buff *skb, struct net_device *dev)
1182
1181
case ETH_P_IP :
1183
1182
udp_tunnel_xmit_skb (pktinfo .rt , pktinfo .sk , skb ,
1184
1183
pktinfo .fl4 .saddr , pktinfo .fl4 .daddr ,
1185
- pktinfo .iph -> tos ,
1184
+ pktinfo .tos ,
1186
1185
ip4_dst_hoplimit (& pktinfo .rt -> dst ),
1187
1186
0 ,
1188
1187
pktinfo .gtph_port , pktinfo .gtph_port ,
@@ -1194,7 +1193,7 @@ static netdev_tx_t gtp_dev_xmit(struct sk_buff *skb, struct net_device *dev)
1194
1193
#if IS_ENABLED (CONFIG_IPV6 )
1195
1194
udp_tunnel6_xmit_skb (& pktinfo .rt6 -> dst , pktinfo .sk , skb , dev ,
1196
1195
& pktinfo .fl6 .saddr , & pktinfo .fl6 .daddr ,
1197
- ipv6_get_dsfield ( pktinfo .ip6h ) ,
1196
+ pktinfo .tos ,
1198
1197
ip6_dst_hoplimit (& pktinfo .rt -> dst ),
1199
1198
0 ,
1200
1199
pktinfo .gtph_port , pktinfo .gtph_port ,
0 commit comments