@@ -979,13 +979,14 @@ int ip6_tnl_xmit_ctl(struct ip6_tnl *t,
979
979
EXPORT_SYMBOL_GPL (ip6_tnl_xmit_ctl );
980
980
981
981
/**
982
- * ip6_tnl_xmit2 - encapsulate packet and send
982
+ * ip6_tnl_xmit - encapsulate packet and send
983
983
* @skb: the outgoing socket buffer
984
984
* @dev: the outgoing tunnel device
985
985
* @dsfield: dscp code for outer header
986
- * @fl : flow of tunneled packet
986
+ * @fl6 : flow of tunneled packet
987
987
* @encap_limit: encapsulation limit
988
988
* @pmtu: Path MTU is stored if packet is too big
989
+ * @proto: next header value
989
990
*
990
991
* Description:
991
992
* Build new header and do some sanity checks on the packet before sending
@@ -997,12 +998,9 @@ EXPORT_SYMBOL_GPL(ip6_tnl_xmit_ctl);
997
998
* %-EMSGSIZE message too big. return mtu in this case.
998
999
**/
999
1000
1000
- static int ip6_tnl_xmit2 (struct sk_buff * skb ,
1001
- struct net_device * dev ,
1002
- __u8 dsfield ,
1003
- struct flowi6 * fl6 ,
1004
- int encap_limit ,
1005
- __u32 * pmtu )
1001
+ int ip6_tnl_xmit (struct sk_buff * skb , struct net_device * dev , __u8 dsfield ,
1002
+ struct flowi6 * fl6 , int encap_limit , __u32 * pmtu ,
1003
+ __u8 proto )
1006
1004
{
1007
1005
struct ip6_tnl * t = netdev_priv (dev );
1008
1006
struct net * net = t -> net ;
@@ -1013,7 +1011,6 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
1013
1011
struct net_device * tdev ;
1014
1012
int mtu ;
1015
1013
unsigned int max_headroom = sizeof (struct ipv6hdr );
1016
- u8 proto ;
1017
1014
int err = -1 ;
1018
1015
1019
1016
/* NBMA tunnel */
@@ -1075,12 +1072,23 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
1075
1072
mtu = IPV6_MIN_MTU ;
1076
1073
if (skb_dst (skb ))
1077
1074
skb_dst (skb )-> ops -> update_pmtu (skb_dst (skb ), NULL , skb , mtu );
1078
- if (skb -> len > mtu ) {
1075
+ if (skb -> len > mtu && ! skb_is_gso ( skb ) ) {
1079
1076
* pmtu = mtu ;
1080
1077
err = - EMSGSIZE ;
1081
1078
goto tx_err_dst_release ;
1082
1079
}
1083
1080
1081
+ if (t -> err_count > 0 ) {
1082
+ if (time_before (jiffies ,
1083
+ t -> err_time + IP6TUNNEL_ERR_TIMEO )) {
1084
+ t -> err_count -- ;
1085
+
1086
+ dst_link_failure (skb );
1087
+ } else {
1088
+ t -> err_count = 0 ;
1089
+ }
1090
+ }
1091
+
1084
1092
skb_scrub_packet (skb , !net_eq (t -> net , dev_net (dev )));
1085
1093
1086
1094
/*
@@ -1108,7 +1116,6 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
1108
1116
1109
1117
skb -> transport_header = skb -> network_header ;
1110
1118
1111
- proto = fl6 -> flowi6_proto ;
1112
1119
if (encap_limit >= 0 ) {
1113
1120
init_tel_txopt (& opt , encap_limit );
1114
1121
ipv6_push_nfrag_opts (skb , & opt .ops , & proto , NULL );
@@ -1119,6 +1126,11 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
1119
1126
skb -> encapsulation = 1 ;
1120
1127
}
1121
1128
1129
+ max_headroom = LL_RESERVED_SPACE (dst -> dev ) + sizeof (struct ipv6hdr )
1130
+ + dst -> header_len ;
1131
+ if (max_headroom > dev -> needed_headroom )
1132
+ dev -> needed_headroom = max_headroom ;
1133
+
1122
1134
skb_push (skb , sizeof (struct ipv6hdr ));
1123
1135
skb_reset_network_header (skb );
1124
1136
ipv6h = ipv6_hdr (skb );
@@ -1137,6 +1149,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
1137
1149
dst_release (dst );
1138
1150
return err ;
1139
1151
}
1152
+ EXPORT_SYMBOL (ip6_tnl_xmit );
1140
1153
1141
1154
static inline int
1142
1155
ip4ip6_tnl_xmit (struct sk_buff * skb , struct net_device * dev )
@@ -1160,7 +1173,6 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
1160
1173
encap_limit = t -> parms .encap_limit ;
1161
1174
1162
1175
memcpy (& fl6 , & t -> fl .u .ip6 , sizeof (fl6 ));
1163
- fl6 .flowi6_proto = IPPROTO_IPIP ;
1164
1176
1165
1177
dsfield = ipv4_get_dsfield (iph );
1166
1178
@@ -1170,7 +1182,8 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
1170
1182
if (t -> parms .flags & IP6_TNL_F_USE_ORIG_FWMARK )
1171
1183
fl6 .flowi6_mark = skb -> mark ;
1172
1184
1173
- err = ip6_tnl_xmit2 (skb , dev , dsfield , & fl6 , encap_limit , & mtu );
1185
+ err = ip6_tnl_xmit (skb , dev , dsfield , & fl6 , encap_limit , & mtu ,
1186
+ IPPROTO_IPIP );
1174
1187
if (err != 0 ) {
1175
1188
/* XXX: send ICMP error even if DF is not set. */
1176
1189
if (err == - EMSGSIZE )
@@ -1214,7 +1227,6 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
1214
1227
encap_limit = t -> parms .encap_limit ;
1215
1228
1216
1229
memcpy (& fl6 , & t -> fl .u .ip6 , sizeof (fl6 ));
1217
- fl6 .flowi6_proto = IPPROTO_IPV6 ;
1218
1230
1219
1231
dsfield = ipv6_get_dsfield (ipv6h );
1220
1232
if (t -> parms .flags & IP6_TNL_F_USE_ORIG_TCLASS )
@@ -1224,7 +1236,8 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
1224
1236
if (t -> parms .flags & IP6_TNL_F_USE_ORIG_FWMARK )
1225
1237
fl6 .flowi6_mark = skb -> mark ;
1226
1238
1227
- err = ip6_tnl_xmit2 (skb , dev , dsfield , & fl6 , encap_limit , & mtu );
1239
+ err = ip6_tnl_xmit (skb , dev , dsfield , & fl6 , encap_limit , & mtu ,
1240
+ IPPROTO_IPV6 );
1228
1241
if (err != 0 ) {
1229
1242
if (err == - EMSGSIZE )
1230
1243
icmpv6_send (skb , ICMPV6_PKT_TOOBIG , 0 , mtu );
@@ -1235,7 +1248,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
1235
1248
}
1236
1249
1237
1250
static netdev_tx_t
1238
- ip6_tnl_xmit (struct sk_buff * skb , struct net_device * dev )
1251
+ ip6_tnl_start_xmit (struct sk_buff * skb , struct net_device * dev )
1239
1252
{
1240
1253
struct ip6_tnl * t = netdev_priv (dev );
1241
1254
struct net_device_stats * stats = & t -> dev -> stats ;
@@ -1556,7 +1569,7 @@ EXPORT_SYMBOL(ip6_tnl_get_iflink);
1556
1569
static const struct net_device_ops ip6_tnl_netdev_ops = {
1557
1570
.ndo_init = ip6_tnl_dev_init ,
1558
1571
.ndo_uninit = ip6_tnl_dev_uninit ,
1559
- .ndo_start_xmit = ip6_tnl_xmit ,
1572
+ .ndo_start_xmit = ip6_tnl_start_xmit ,
1560
1573
.ndo_do_ioctl = ip6_tnl_ioctl ,
1561
1574
.ndo_change_mtu = ip6_tnl_change_mtu ,
1562
1575
.ndo_get_stats = ip6_get_stats ,
0 commit comments