ipv6: fold sockcm_cookie into ipcm6_cookie
ipcm_cookie includes sockcm_cookie. Do the same for ipcm6_cookie. This reduces the number of arguments that need to be passed around, applies ipcm6_init to all cookie fields at once and reduces code differentiation between ipv4 and ipv6. Signed-off-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
657a066702
commit
5fdaa88dfe
@@ -294,6 +294,7 @@ struct ipv6_fl_socklist {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ipcm6_cookie {
|
struct ipcm6_cookie {
|
||||||
|
struct sockcm_cookie sockc;
|
||||||
__s16 hlimit;
|
__s16 hlimit;
|
||||||
__s16 tclass;
|
__s16 tclass;
|
||||||
__s8 dontfrag;
|
__s8 dontfrag;
|
||||||
@@ -959,8 +960,7 @@ int ip6_append_data(struct sock *sk,
|
|||||||
int odd, struct sk_buff *skb),
|
int odd, struct sk_buff *skb),
|
||||||
void *from, int length, int transhdrlen,
|
void *from, int length, int transhdrlen,
|
||||||
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
|
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
|
||||||
struct rt6_info *rt, unsigned int flags,
|
struct rt6_info *rt, unsigned int flags);
|
||||||
const struct sockcm_cookie *sockc);
|
|
||||||
|
|
||||||
int ip6_push_pending_frames(struct sock *sk);
|
int ip6_push_pending_frames(struct sock *sk);
|
||||||
|
|
||||||
@@ -977,8 +977,7 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
|
|||||||
void *from, int length, int transhdrlen,
|
void *from, int length, int transhdrlen,
|
||||||
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
|
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
|
||||||
struct rt6_info *rt, unsigned int flags,
|
struct rt6_info *rt, unsigned int flags,
|
||||||
struct inet_cork_full *cork,
|
struct inet_cork_full *cork);
|
||||||
const struct sockcm_cookie *sockc);
|
|
||||||
|
|
||||||
static inline struct sk_buff *ip6_finish_skb(struct sock *sk)
|
static inline struct sk_buff *ip6_finish_skb(struct sock *sk)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,8 +42,7 @@ void ip6_datagram_recv_specific_ctl(struct sock *sk, struct msghdr *msg,
|
|||||||
struct sk_buff *skb);
|
struct sk_buff *skb);
|
||||||
|
|
||||||
int ip6_datagram_send_ctl(struct net *net, struct sock *sk, struct msghdr *msg,
|
int ip6_datagram_send_ctl(struct net *net, struct sock *sk, struct msghdr *msg,
|
||||||
struct flowi6 *fl6, struct ipcm6_cookie *ipc6,
|
struct flowi6 *fl6, struct ipcm6_cookie *ipc6);
|
||||||
struct sockcm_cookie *sockc);
|
|
||||||
|
|
||||||
void __ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
|
void __ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
|
||||||
__u16 srcp, __u16 destp, int rqueue, int bucket);
|
__u16 srcp, __u16 destp, int rqueue, int bucket);
|
||||||
|
|||||||
@@ -736,7 +736,7 @@ EXPORT_SYMBOL_GPL(ip6_datagram_recv_ctl);
|
|||||||
|
|
||||||
int ip6_datagram_send_ctl(struct net *net, struct sock *sk,
|
int ip6_datagram_send_ctl(struct net *net, struct sock *sk,
|
||||||
struct msghdr *msg, struct flowi6 *fl6,
|
struct msghdr *msg, struct flowi6 *fl6,
|
||||||
struct ipcm6_cookie *ipc6, struct sockcm_cookie *sockc)
|
struct ipcm6_cookie *ipc6)
|
||||||
{
|
{
|
||||||
struct in6_pktinfo *src_info;
|
struct in6_pktinfo *src_info;
|
||||||
struct cmsghdr *cmsg;
|
struct cmsghdr *cmsg;
|
||||||
@@ -755,7 +755,7 @@ int ip6_datagram_send_ctl(struct net *net, struct sock *sk,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cmsg->cmsg_level == SOL_SOCKET) {
|
if (cmsg->cmsg_level == SOL_SOCKET) {
|
||||||
err = __sock_cmsg_send(sk, msg, cmsg, sockc);
|
err = __sock_cmsg_send(sk, msg, cmsg, &ipc6->sockc);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -430,7 +430,6 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
|
|||||||
struct icmp6hdr tmp_hdr;
|
struct icmp6hdr tmp_hdr;
|
||||||
struct flowi6 fl6;
|
struct flowi6 fl6;
|
||||||
struct icmpv6_msg msg;
|
struct icmpv6_msg msg;
|
||||||
struct sockcm_cookie sockc_unused = {0};
|
|
||||||
struct ipcm6_cookie ipc6;
|
struct ipcm6_cookie ipc6;
|
||||||
int iif = 0;
|
int iif = 0;
|
||||||
int addr_type = 0;
|
int addr_type = 0;
|
||||||
@@ -573,7 +572,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
|
|||||||
len + sizeof(struct icmp6hdr),
|
len + sizeof(struct icmp6hdr),
|
||||||
sizeof(struct icmp6hdr),
|
sizeof(struct icmp6hdr),
|
||||||
&ipc6, &fl6, (struct rt6_info *)dst,
|
&ipc6, &fl6, (struct rt6_info *)dst,
|
||||||
MSG_DONTWAIT, &sockc_unused)) {
|
MSG_DONTWAIT)) {
|
||||||
ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
|
ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
|
||||||
ip6_flush_pending_frames(sk);
|
ip6_flush_pending_frames(sk);
|
||||||
} else {
|
} else {
|
||||||
@@ -677,7 +676,6 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
|
|||||||
struct dst_entry *dst;
|
struct dst_entry *dst;
|
||||||
struct ipcm6_cookie ipc6;
|
struct ipcm6_cookie ipc6;
|
||||||
u32 mark = IP6_REPLY_MARK(net, skb->mark);
|
u32 mark = IP6_REPLY_MARK(net, skb->mark);
|
||||||
struct sockcm_cookie sockc_unused = {0};
|
|
||||||
|
|
||||||
saddr = &ipv6_hdr(skb)->daddr;
|
saddr = &ipv6_hdr(skb)->daddr;
|
||||||
|
|
||||||
@@ -731,8 +729,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
|
|||||||
if (ip6_append_data(sk, icmpv6_getfrag, &msg,
|
if (ip6_append_data(sk, icmpv6_getfrag, &msg,
|
||||||
skb->len + sizeof(struct icmp6hdr),
|
skb->len + sizeof(struct icmp6hdr),
|
||||||
sizeof(struct icmp6hdr), &ipc6, &fl6,
|
sizeof(struct icmp6hdr), &ipc6, &fl6,
|
||||||
(struct rt6_info *)dst, MSG_DONTWAIT,
|
(struct rt6_info *)dst, MSG_DONTWAIT)) {
|
||||||
&sockc_unused)) {
|
|
||||||
__ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
|
__ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
|
||||||
ip6_flush_pending_frames(sk);
|
ip6_flush_pending_frames(sk);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -373,7 +373,6 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq,
|
|||||||
if (olen > 0) {
|
if (olen > 0) {
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
struct flowi6 flowi6;
|
struct flowi6 flowi6;
|
||||||
struct sockcm_cookie sockc_junk;
|
|
||||||
struct ipcm6_cookie ipc6;
|
struct ipcm6_cookie ipc6;
|
||||||
|
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
@@ -392,7 +391,7 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq,
|
|||||||
memset(&flowi6, 0, sizeof(flowi6));
|
memset(&flowi6, 0, sizeof(flowi6));
|
||||||
|
|
||||||
ipc6.opt = fl->opt;
|
ipc6.opt = fl->opt;
|
||||||
err = ip6_datagram_send_ctl(net, sk, &msg, &flowi6, &ipc6, &sockc_junk);
|
err = ip6_datagram_send_ctl(net, sk, &msg, &flowi6, &ipc6);
|
||||||
if (err)
|
if (err)
|
||||||
goto done;
|
goto done;
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
|
|||||||
@@ -1158,8 +1158,7 @@ static void ip6_append_data_mtu(unsigned int *mtu,
|
|||||||
|
|
||||||
static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork,
|
static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork,
|
||||||
struct inet6_cork *v6_cork, struct ipcm6_cookie *ipc6,
|
struct inet6_cork *v6_cork, struct ipcm6_cookie *ipc6,
|
||||||
struct rt6_info *rt, struct flowi6 *fl6,
|
struct rt6_info *rt, struct flowi6 *fl6)
|
||||||
const struct sockcm_cookie *sockc)
|
|
||||||
{
|
{
|
||||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||||
unsigned int mtu;
|
unsigned int mtu;
|
||||||
@@ -1227,7 +1226,7 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork,
|
|||||||
cork->base.flags |= IPCORK_ALLFRAG;
|
cork->base.flags |= IPCORK_ALLFRAG;
|
||||||
cork->base.length = 0;
|
cork->base.length = 0;
|
||||||
|
|
||||||
cork->base.transmit_time = sockc->transmit_time;
|
cork->base.transmit_time = ipc6->sockc.transmit_time;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1241,8 +1240,7 @@ static int __ip6_append_data(struct sock *sk,
|
|||||||
int getfrag(void *from, char *to, int offset,
|
int getfrag(void *from, char *to, int offset,
|
||||||
int len, int odd, struct sk_buff *skb),
|
int len, int odd, struct sk_buff *skb),
|
||||||
void *from, int length, int transhdrlen,
|
void *from, int length, int transhdrlen,
|
||||||
unsigned int flags, struct ipcm6_cookie *ipc6,
|
unsigned int flags, struct ipcm6_cookie *ipc6)
|
||||||
const struct sockcm_cookie *sockc)
|
|
||||||
{
|
{
|
||||||
struct sk_buff *skb, *skb_prev = NULL;
|
struct sk_buff *skb, *skb_prev = NULL;
|
||||||
unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu, pmtu;
|
unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu, pmtu;
|
||||||
@@ -1321,7 +1319,7 @@ emsgsize:
|
|||||||
csummode = CHECKSUM_PARTIAL;
|
csummode = CHECKSUM_PARTIAL;
|
||||||
|
|
||||||
if (sk->sk_type == SOCK_DGRAM || sk->sk_type == SOCK_RAW) {
|
if (sk->sk_type == SOCK_DGRAM || sk->sk_type == SOCK_RAW) {
|
||||||
sock_tx_timestamp(sk, sockc->tsflags, &tx_flags);
|
sock_tx_timestamp(sk, ipc6->sockc.tsflags, &tx_flags);
|
||||||
if (tx_flags & SKBTX_ANY_SW_TSTAMP &&
|
if (tx_flags & SKBTX_ANY_SW_TSTAMP &&
|
||||||
sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)
|
sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)
|
||||||
tskey = sk->sk_tskey++;
|
tskey = sk->sk_tskey++;
|
||||||
@@ -1563,8 +1561,7 @@ int ip6_append_data(struct sock *sk,
|
|||||||
int odd, struct sk_buff *skb),
|
int odd, struct sk_buff *skb),
|
||||||
void *from, int length, int transhdrlen,
|
void *from, int length, int transhdrlen,
|
||||||
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
|
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
|
||||||
struct rt6_info *rt, unsigned int flags,
|
struct rt6_info *rt, unsigned int flags)
|
||||||
const struct sockcm_cookie *sockc)
|
|
||||||
{
|
{
|
||||||
struct inet_sock *inet = inet_sk(sk);
|
struct inet_sock *inet = inet_sk(sk);
|
||||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||||
@@ -1578,7 +1575,7 @@ int ip6_append_data(struct sock *sk,
|
|||||||
* setup for corking
|
* setup for corking
|
||||||
*/
|
*/
|
||||||
err = ip6_setup_cork(sk, &inet->cork, &np->cork,
|
err = ip6_setup_cork(sk, &inet->cork, &np->cork,
|
||||||
ipc6, rt, fl6, sockc);
|
ipc6, rt, fl6);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@@ -1592,7 +1589,7 @@ int ip6_append_data(struct sock *sk,
|
|||||||
|
|
||||||
return __ip6_append_data(sk, fl6, &sk->sk_write_queue, &inet->cork.base,
|
return __ip6_append_data(sk, fl6, &sk->sk_write_queue, &inet->cork.base,
|
||||||
&np->cork, sk_page_frag(sk), getfrag,
|
&np->cork, sk_page_frag(sk), getfrag,
|
||||||
from, length, transhdrlen, flags, ipc6, sockc);
|
from, length, transhdrlen, flags, ipc6);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ip6_append_data);
|
EXPORT_SYMBOL_GPL(ip6_append_data);
|
||||||
|
|
||||||
@@ -1752,8 +1749,7 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
|
|||||||
void *from, int length, int transhdrlen,
|
void *from, int length, int transhdrlen,
|
||||||
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
|
struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
|
||||||
struct rt6_info *rt, unsigned int flags,
|
struct rt6_info *rt, unsigned int flags,
|
||||||
struct inet_cork_full *cork,
|
struct inet_cork_full *cork)
|
||||||
const struct sockcm_cookie *sockc)
|
|
||||||
{
|
{
|
||||||
struct inet6_cork v6_cork;
|
struct inet6_cork v6_cork;
|
||||||
struct sk_buff_head queue;
|
struct sk_buff_head queue;
|
||||||
@@ -1770,7 +1766,7 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
|
|||||||
cork->base.opt = NULL;
|
cork->base.opt = NULL;
|
||||||
cork->base.dst = NULL;
|
cork->base.dst = NULL;
|
||||||
v6_cork.opt = NULL;
|
v6_cork.opt = NULL;
|
||||||
err = ip6_setup_cork(sk, cork, &v6_cork, ipc6, rt, fl6, sockc);
|
err = ip6_setup_cork(sk, cork, &v6_cork, ipc6, rt, fl6);
|
||||||
if (err) {
|
if (err) {
|
||||||
ip6_cork_release(cork, &v6_cork);
|
ip6_cork_release(cork, &v6_cork);
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
@@ -1781,7 +1777,7 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
|
|||||||
err = __ip6_append_data(sk, fl6, &queue, &cork->base, &v6_cork,
|
err = __ip6_append_data(sk, fl6, &queue, &cork->base, &v6_cork,
|
||||||
¤t->task_frag, getfrag, from,
|
¤t->task_frag, getfrag, from,
|
||||||
length + exthdrlen, transhdrlen + exthdrlen,
|
length + exthdrlen, transhdrlen + exthdrlen,
|
||||||
flags, ipc6, sockc);
|
flags, ipc6);
|
||||||
if (err) {
|
if (err) {
|
||||||
__ip6_flush_pending_frames(sk, &queue, cork, &v6_cork);
|
__ip6_flush_pending_frames(sk, &queue, cork, &v6_cork);
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
|
|||||||
@@ -489,7 +489,6 @@ sticky_done:
|
|||||||
struct ipv6_txoptions *opt = NULL;
|
struct ipv6_txoptions *opt = NULL;
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
struct flowi6 fl6;
|
struct flowi6 fl6;
|
||||||
struct sockcm_cookie sockc_junk;
|
|
||||||
struct ipcm6_cookie ipc6;
|
struct ipcm6_cookie ipc6;
|
||||||
|
|
||||||
memset(&fl6, 0, sizeof(fl6));
|
memset(&fl6, 0, sizeof(fl6));
|
||||||
@@ -522,7 +521,7 @@ sticky_done:
|
|||||||
msg.msg_control = (void *)(opt+1);
|
msg.msg_control = (void *)(opt+1);
|
||||||
ipc6.opt = opt;
|
ipc6.opt = opt;
|
||||||
|
|
||||||
retv = ip6_datagram_send_ctl(net, sk, &msg, &fl6, &ipc6, &sockc_junk);
|
retv = ip6_datagram_send_ctl(net, sk, &msg, &fl6, &ipc6);
|
||||||
if (retv)
|
if (retv)
|
||||||
goto done;
|
goto done;
|
||||||
update:
|
update:
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
|||||||
struct dst_entry *dst;
|
struct dst_entry *dst;
|
||||||
struct rt6_info *rt;
|
struct rt6_info *rt;
|
||||||
struct pingfakehdr pfh;
|
struct pingfakehdr pfh;
|
||||||
struct sockcm_cookie junk = {0};
|
|
||||||
struct ipcm6_cookie ipc6;
|
struct ipcm6_cookie ipc6;
|
||||||
|
|
||||||
pr_debug("ping_v6_sendmsg(sk=%p,sk->num=%u)\n", inet, inet->inet_num);
|
pr_debug("ping_v6_sendmsg(sk=%p,sk->num=%u)\n", inet, inet->inet_num);
|
||||||
@@ -146,7 +145,7 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
|||||||
lock_sock(sk);
|
lock_sock(sk);
|
||||||
err = ip6_append_data(sk, ping_getfrag, &pfh, len,
|
err = ip6_append_data(sk, ping_getfrag, &pfh, len,
|
||||||
0, &ipc6, &fl6, rt,
|
0, &ipc6, &fl6, rt,
|
||||||
MSG_DONTWAIT, &junk);
|
MSG_DONTWAIT);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
ICMP6_INC_STATS(sock_net(sk), rt->rt6i_idev,
|
ICMP6_INC_STATS(sock_net(sk), rt->rt6i_idev,
|
||||||
|
|||||||
@@ -767,7 +767,6 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
|||||||
struct dst_entry *dst = NULL;
|
struct dst_entry *dst = NULL;
|
||||||
struct raw6_frag_vec rfv;
|
struct raw6_frag_vec rfv;
|
||||||
struct flowi6 fl6;
|
struct flowi6 fl6;
|
||||||
struct sockcm_cookie sockc;
|
|
||||||
struct ipcm6_cookie ipc6;
|
struct ipcm6_cookie ipc6;
|
||||||
int addr_len = msg->msg_namelen;
|
int addr_len = msg->msg_namelen;
|
||||||
u16 proto;
|
u16 proto;
|
||||||
@@ -792,6 +791,7 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
|||||||
fl6.flowi6_uid = sk->sk_uid;
|
fl6.flowi6_uid = sk->sk_uid;
|
||||||
|
|
||||||
ipcm6_init(&ipc6);
|
ipcm6_init(&ipc6);
|
||||||
|
ipc6.sockc.tsflags = sk->sk_tsflags;
|
||||||
|
|
||||||
if (sin6) {
|
if (sin6) {
|
||||||
if (addr_len < SIN6_LEN_RFC2133)
|
if (addr_len < SIN6_LEN_RFC2133)
|
||||||
@@ -845,15 +845,13 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
|||||||
if (fl6.flowi6_oif == 0)
|
if (fl6.flowi6_oif == 0)
|
||||||
fl6.flowi6_oif = sk->sk_bound_dev_if;
|
fl6.flowi6_oif = sk->sk_bound_dev_if;
|
||||||
|
|
||||||
sockc.tsflags = sk->sk_tsflags;
|
|
||||||
sockc.transmit_time = 0;
|
|
||||||
if (msg->msg_controllen) {
|
if (msg->msg_controllen) {
|
||||||
opt = &opt_space;
|
opt = &opt_space;
|
||||||
memset(opt, 0, sizeof(struct ipv6_txoptions));
|
memset(opt, 0, sizeof(struct ipv6_txoptions));
|
||||||
opt->tot_len = sizeof(struct ipv6_txoptions);
|
opt->tot_len = sizeof(struct ipv6_txoptions);
|
||||||
ipc6.opt = opt;
|
ipc6.opt = opt;
|
||||||
|
|
||||||
err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, &ipc6, &sockc);
|
err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, &ipc6);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
fl6_sock_release(flowlabel);
|
fl6_sock_release(flowlabel);
|
||||||
return err;
|
return err;
|
||||||
@@ -921,13 +919,13 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
|||||||
back_from_confirm:
|
back_from_confirm:
|
||||||
if (inet->hdrincl)
|
if (inet->hdrincl)
|
||||||
err = rawv6_send_hdrinc(sk, msg, len, &fl6, &dst,
|
err = rawv6_send_hdrinc(sk, msg, len, &fl6, &dst,
|
||||||
msg->msg_flags, &sockc);
|
msg->msg_flags, &ipc6.sockc);
|
||||||
else {
|
else {
|
||||||
ipc6.opt = opt;
|
ipc6.opt = opt;
|
||||||
lock_sock(sk);
|
lock_sock(sk);
|
||||||
err = ip6_append_data(sk, raw6_getfrag, &rfv,
|
err = ip6_append_data(sk, raw6_getfrag, &rfv,
|
||||||
len, 0, &ipc6, &fl6, (struct rt6_info *)dst,
|
len, 0, &ipc6, &fl6, (struct rt6_info *)dst,
|
||||||
msg->msg_flags, &sockc);
|
msg->msg_flags);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
ip6_flush_pending_frames(sk);
|
ip6_flush_pending_frames(sk);
|
||||||
|
|||||||
@@ -1141,12 +1141,10 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
|||||||
int err;
|
int err;
|
||||||
int is_udplite = IS_UDPLITE(sk);
|
int is_udplite = IS_UDPLITE(sk);
|
||||||
int (*getfrag)(void *, char *, int, int, int, struct sk_buff *);
|
int (*getfrag)(void *, char *, int, int, int, struct sk_buff *);
|
||||||
struct sockcm_cookie sockc;
|
|
||||||
|
|
||||||
ipcm6_init(&ipc6);
|
ipcm6_init(&ipc6);
|
||||||
ipc6.gso_size = up->gso_size;
|
ipc6.gso_size = up->gso_size;
|
||||||
sockc.tsflags = sk->sk_tsflags;
|
ipc6.sockc.tsflags = sk->sk_tsflags;
|
||||||
sockc.transmit_time = 0;
|
|
||||||
|
|
||||||
/* destination address check */
|
/* destination address check */
|
||||||
if (sin6) {
|
if (sin6) {
|
||||||
@@ -1281,7 +1279,7 @@ do_udp_sendmsg:
|
|||||||
err = udp_cmsg_send(sk, msg, &ipc6.gso_size);
|
err = udp_cmsg_send(sk, msg, &ipc6.gso_size);
|
||||||
if (err > 0)
|
if (err > 0)
|
||||||
err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6,
|
err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6,
|
||||||
&ipc6, &sockc);
|
&ipc6);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
fl6_sock_release(flowlabel);
|
fl6_sock_release(flowlabel);
|
||||||
return err;
|
return err;
|
||||||
@@ -1375,7 +1373,7 @@ back_from_confirm:
|
|||||||
skb = ip6_make_skb(sk, getfrag, msg, ulen,
|
skb = ip6_make_skb(sk, getfrag, msg, ulen,
|
||||||
sizeof(struct udphdr), &ipc6,
|
sizeof(struct udphdr), &ipc6,
|
||||||
&fl6, (struct rt6_info *)dst,
|
&fl6, (struct rt6_info *)dst,
|
||||||
msg->msg_flags, &cork, &sockc);
|
msg->msg_flags, &cork);
|
||||||
err = PTR_ERR(skb);
|
err = PTR_ERR(skb);
|
||||||
if (!IS_ERR_OR_NULL(skb))
|
if (!IS_ERR_OR_NULL(skb))
|
||||||
err = udp_v6_send_skb(skb, &fl6, &cork.base);
|
err = udp_v6_send_skb(skb, &fl6, &cork.base);
|
||||||
@@ -1401,7 +1399,7 @@ do_append_data:
|
|||||||
up->len += ulen;
|
up->len += ulen;
|
||||||
err = ip6_append_data(sk, getfrag, msg, ulen, sizeof(struct udphdr),
|
err = ip6_append_data(sk, getfrag, msg, ulen, sizeof(struct udphdr),
|
||||||
&ipc6, &fl6, (struct rt6_info *)dst,
|
&ipc6, &fl6, (struct rt6_info *)dst,
|
||||||
corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags, &sockc);
|
corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags);
|
||||||
if (err)
|
if (err)
|
||||||
udp_v6_flush_pending_frames(sk);
|
udp_v6_flush_pending_frames(sk);
|
||||||
else if (!corkreq)
|
else if (!corkreq)
|
||||||
|
|||||||
@@ -500,7 +500,6 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
|||||||
struct ip6_flowlabel *flowlabel = NULL;
|
struct ip6_flowlabel *flowlabel = NULL;
|
||||||
struct dst_entry *dst = NULL;
|
struct dst_entry *dst = NULL;
|
||||||
struct flowi6 fl6;
|
struct flowi6 fl6;
|
||||||
struct sockcm_cookie sockc_unused = {0};
|
|
||||||
struct ipcm6_cookie ipc6;
|
struct ipcm6_cookie ipc6;
|
||||||
int addr_len = msg->msg_namelen;
|
int addr_len = msg->msg_namelen;
|
||||||
int transhdrlen = 4; /* zero session-id */
|
int transhdrlen = 4; /* zero session-id */
|
||||||
@@ -573,8 +572,7 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
|||||||
opt->tot_len = sizeof(struct ipv6_txoptions);
|
opt->tot_len = sizeof(struct ipv6_txoptions);
|
||||||
ipc6.opt = opt;
|
ipc6.opt = opt;
|
||||||
|
|
||||||
err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, &ipc6,
|
err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, &ipc6);
|
||||||
&sockc_unused);
|
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
fl6_sock_release(flowlabel);
|
fl6_sock_release(flowlabel);
|
||||||
return err;
|
return err;
|
||||||
@@ -639,7 +637,7 @@ back_from_confirm:
|
|||||||
err = ip6_append_data(sk, ip_generic_getfrag, msg,
|
err = ip6_append_data(sk, ip_generic_getfrag, msg,
|
||||||
ulen, transhdrlen, &ipc6,
|
ulen, transhdrlen, &ipc6,
|
||||||
&fl6, (struct rt6_info *)dst,
|
&fl6, (struct rt6_info *)dst,
|
||||||
msg->msg_flags, &sockc_unused);
|
msg->msg_flags);
|
||||||
if (err)
|
if (err)
|
||||||
ip6_flush_pending_frames(sk);
|
ip6_flush_pending_frames(sk);
|
||||||
else if (!(msg->msg_flags & MSG_MORE))
|
else if (!(msg->msg_flags & MSG_MORE))
|
||||||
|
|||||||
Reference in New Issue
Block a user