Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

inet: Pass flowi to ->queue_xmit().

This allows us to acquire the exact route keying information from the
protocol, however that might be managed.

It handles all of the possibilities, from the simplest case of storing
the key in inet->cork.fl to the more complex setup SCTP has where
individual transports determine the flow.

Signed-off-by: David S. Miller <davem@davemloft.net>

+17 -15
+1 -1
include/net/inet6_connection_sock.h
··· 41 41 42 42 extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 43 43 44 - extern int inet6_csk_xmit(struct sk_buff *skb); 44 + extern int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl); 45 45 #endif /* _INET6_CONNECTION_SOCK_H */
+1 -1
include/net/inet_connection_sock.h
··· 36 36 * (i.e. things that depend on the address family) 37 37 */ 38 38 struct inet_connection_sock_af_ops { 39 - int (*queue_xmit)(struct sk_buff *skb); 39 + int (*queue_xmit)(struct sk_buff *skb, struct flowi *fl); 40 40 void (*send_check)(struct sock *sk, struct sk_buff *skb); 41 41 int (*rebuild_header)(struct sock *sk); 42 42 int (*conn_request)(struct sock *sk, struct sk_buff *skb);
+1 -1
include/net/ip.h
··· 104 104 extern void ip_send_check(struct iphdr *ip); 105 105 extern int __ip_local_out(struct sk_buff *skb); 106 106 extern int ip_local_out(struct sk_buff *skb); 107 - extern int ip_queue_xmit(struct sk_buff *skb); 107 + extern int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl); 108 108 extern void ip_init(void); 109 109 extern int ip_append_data(struct sock *sk, 110 110 int getfrag(void *from, char *to, int offset, int len,
+2 -2
net/dccp/output.c
··· 43 43 static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb) 44 44 { 45 45 if (likely(skb != NULL)) { 46 - const struct inet_sock *inet = inet_sk(sk); 46 + struct inet_sock *inet = inet_sk(sk); 47 47 const struct inet_connection_sock *icsk = inet_csk(sk); 48 48 struct dccp_sock *dp = dccp_sk(sk); 49 49 struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); ··· 136 136 137 137 DCCP_INC_STATS(DCCP_MIB_OUTSEGS); 138 138 139 - err = icsk->icsk_af_ops->queue_xmit(skb); 139 + err = icsk->icsk_af_ops->queue_xmit(skb, &inet->cork.fl); 140 140 return net_xmit_eval(err); 141 141 } 142 142 return -ENOBUFS;
+2 -2
net/ipv4/ip_output.c
··· 312 312 !(IPCB(skb)->flags & IPSKB_REROUTED)); 313 313 } 314 314 315 - int ip_queue_xmit(struct sk_buff *skb) 315 + int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl) 316 316 { 317 317 struct sock *sk = skb->sk; 318 318 struct inet_sock *inet = inet_sk(sk); ··· 332 332 goto packet_routed; 333 333 334 334 /* Make sure we can route this packet. */ 335 - fl4 = &inet->cork.fl.u.ip4; 335 + fl4 = &fl->u.ip4; 336 336 rt = (struct rtable *)__sk_dst_check(sk, 0); 337 337 if (rt == NULL) { 338 338 __be32 daddr;
+1 -1
net/ipv4/tcp_output.c
··· 899 899 TCP_ADD_STATS(sock_net(sk), TCP_MIB_OUTSEGS, 900 900 tcp_skb_pcount(skb)); 901 901 902 - err = icsk->icsk_af_ops->queue_xmit(skb); 902 + err = icsk->icsk_af_ops->queue_xmit(skb, &inet->cork.fl); 903 903 if (likely(err <= 0)) 904 904 return err; 905 905
+1 -1
net/ipv6/inet6_connection_sock.c
··· 203 203 return dst; 204 204 } 205 205 206 - int inet6_csk_xmit(struct sk_buff *skb) 206 + int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl_unused) 207 207 { 208 208 struct sock *sk = skb->sk; 209 209 struct inet_sock *inet = inet_sk(sk);
+6 -4
net/l2tp/l2tp_core.c
··· 954 954 } 955 955 956 956 static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, 957 - size_t data_len) 957 + struct flowi *fl, size_t data_len) 958 958 { 959 959 struct l2tp_tunnel *tunnel = session->tunnel; 960 960 unsigned int len = skb->len; ··· 987 987 988 988 /* Queue the packet to IP for output */ 989 989 skb->local_df = 1; 990 - error = ip_queue_xmit(skb); 990 + error = ip_queue_xmit(skb, fl); 991 991 992 992 /* Update stats */ 993 993 if (error >= 0) { ··· 1028 1028 int data_len = skb->len; 1029 1029 struct l2tp_tunnel *tunnel = session->tunnel; 1030 1030 struct sock *sk = tunnel->sock; 1031 + struct flowi *fl; 1031 1032 struct udphdr *uh; 1032 1033 struct inet_sock *inet; 1033 1034 __wsum csum; ··· 1071 1070 skb_dst_drop(skb); 1072 1071 skb_dst_set(skb, dst_clone(__sk_dst_get(sk))); 1073 1072 1073 + inet = inet_sk(sk); 1074 + fl = &inet->cork.fl; 1074 1075 switch (tunnel->encap) { 1075 1076 case L2TP_ENCAPTYPE_UDP: 1076 1077 /* Setup UDP header */ 1077 - inet = inet_sk(sk); 1078 1078 __skb_push(skb, sizeof(*uh)); 1079 1079 skb_reset_transport_header(skb); 1080 1080 uh = udp_hdr(skb); ··· 1113 1111 1114 1112 l2tp_skb_set_owner_w(skb, sk); 1115 1113 1116 - l2tp_xmit_core(session, skb, data_len); 1114 + l2tp_xmit_core(session, skb, fl, data_len); 1117 1115 out_unlock: 1118 1116 bh_unlock_sock(sk); 1119 1117
+1 -1
net/l2tp/l2tp_ip.c
··· 508 508 skb_dst_set(skb, dst_clone(&rt->dst)); 509 509 510 510 /* Queue the packet to IP for output */ 511 - rc = ip_queue_xmit(skb); 511 + rc = ip_queue_xmit(skb, &inet->cork.fl); 512 512 513 513 error: 514 514 /* Update stats */
+1 -1
net/sctp/protocol.c
··· 855 855 IP_PMTUDISC_DO : IP_PMTUDISC_DONT; 856 856 857 857 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); 858 - return ip_queue_xmit(skb); 858 + return ip_queue_xmit(skb, &transport->fl); 859 859 } 860 860 861 861 static struct sctp_af sctp_af_inet;