netfilter: NETFILTER_XT_TARGET_LOG selects NF_LOG_*
[cascardo/linux.git] / net / ipv6 / ip6_output.c
index 45702b8..315a55d 100644 (file)
@@ -205,7 +205,8 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
        if (hlimit < 0)
                hlimit = ip6_dst_hoplimit(dst);
 
-       ip6_flow_hdr(hdr, tclass, fl6->flowlabel);
+       ip6_flow_hdr(hdr, tclass, ip6_make_flowlabel(net, skb, fl6->flowlabel,
+                                                    np->autoflowlabel));
 
        hdr->payload_len = htons(seg_len);
        hdr->nexthdr = proto;
@@ -802,8 +803,8 @@ slow_path:
                /*
                 *      Copy a block of the IP datagram.
                 */
-               if (skb_copy_bits(skb, ptr, skb_transport_header(frag), len))
-                       BUG();
+               BUG_ON(skb_copy_bits(skb, ptr, skb_transport_header(frag),
+                                    len));
                left -= len;
 
                fh->frag_off = htons(offset);
@@ -1156,6 +1157,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
        int err;
        int offset = 0;
        __u8 tx_flags = 0;
+       u32 tskey = 0;
 
        if (flags&MSG_PROBE)
                return 0;
@@ -1271,9 +1273,12 @@ emsgsize:
                }
        }
 
-       /* For UDP, check if TX timestamp is enabled */
-       if (sk->sk_type == SOCK_DGRAM)
+       if (sk->sk_type == SOCK_DGRAM || sk->sk_type == SOCK_RAW) {
                sock_tx_timestamp(sk, &tx_flags);
+               if (tx_flags & SKBTX_ANY_SW_TSTAMP &&
+                   sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)
+                       tskey = sk->sk_tskey++;
+       }
 
        /*
         * Let's try using as much space as possible.
@@ -1381,12 +1386,6 @@ alloc_new_skb:
                                                           sk->sk_allocation);
                                if (unlikely(skb == NULL))
                                        err = -ENOBUFS;
-                               else {
-                                       /* Only the initial fragment
-                                        * is time stamped.
-                                        */
-                                       tx_flags = 0;
-                               }
                        }
                        if (skb == NULL)
                                goto error;
@@ -1400,8 +1399,11 @@ alloc_new_skb:
                        skb_reserve(skb, hh_len + sizeof(struct frag_hdr) +
                                    dst_exthdrlen);
 
-                       if (sk->sk_type == SOCK_DGRAM)
-                               skb_shinfo(skb)->tx_flags = tx_flags;
+                       /* Only the initial fragment is time stamped */
+                       skb_shinfo(skb)->tx_flags = tx_flags;
+                       tx_flags = 0;
+                       skb_shinfo(skb)->tskey = tskey;
+                       tskey = 0;
 
                        /*
                         *      Find where to start putting bytes
@@ -1571,7 +1573,9 @@ int ip6_push_pending_frames(struct sock *sk)
        skb_reset_network_header(skb);
        hdr = ipv6_hdr(skb);
 
-       ip6_flow_hdr(hdr, np->cork.tclass, fl6->flowlabel);
+       ip6_flow_hdr(hdr, np->cork.tclass,
+                    ip6_make_flowlabel(net, skb, fl6->flowlabel,
+                                       np->autoflowlabel));
        hdr->hop_limit = np->cork.hop_limit;
        hdr->nexthdr = proto;
        hdr->saddr = fl6->saddr;