ipv4: Use flowi4 in public route lookup interfaces.
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -402,7 +402,7 @@ error:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
|
||||
static int raw_probe_proto_opt(struct flowi4 *fl4, struct msghdr *msg)
|
||||
{
|
||||
struct iovec *iov;
|
||||
u8 __user *type = NULL;
|
||||
@@ -418,7 +418,7 @@ static int raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
|
||||
if (!iov)
|
||||
continue;
|
||||
|
||||
switch (fl->flowi_proto) {
|
||||
switch (fl4->flowi4_proto) {
|
||||
case IPPROTO_ICMP:
|
||||
/* check if one-byte field is readable or not. */
|
||||
if (iov->iov_base && iov->iov_len < 1)
|
||||
@@ -433,8 +433,8 @@ static int raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
|
||||
code = iov->iov_base;
|
||||
|
||||
if (type && code) {
|
||||
if (get_user(fl->fl4_icmp_type, type) ||
|
||||
get_user(fl->fl4_icmp_code, code))
|
||||
if (get_user(fl4->uli.icmpt.type, type) ||
|
||||
get_user(fl4->uli.icmpt.code, code))
|
||||
return -EFAULT;
|
||||
probed = 1;
|
||||
}
|
||||
@@ -548,23 +548,25 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
||||
}
|
||||
|
||||
{
|
||||
struct flowi fl = { .flowi_oif = ipc.oif,
|
||||
.flowi_mark = sk->sk_mark,
|
||||
.fl4_dst = daddr,
|
||||
.fl4_src = saddr,
|
||||
.fl4_tos = tos,
|
||||
.flowi_proto = inet->hdrincl ? IPPROTO_RAW :
|
||||
sk->sk_protocol,
|
||||
.flowi_flags = FLOWI_FLAG_CAN_SLEEP,
|
||||
struct flowi4 fl4 = {
|
||||
.flowi4_oif = ipc.oif,
|
||||
.flowi4_mark = sk->sk_mark,
|
||||
.daddr = daddr,
|
||||
.saddr = saddr,
|
||||
.flowi4_tos = tos,
|
||||
.flowi4_proto = (inet->hdrincl ?
|
||||
IPPROTO_RAW :
|
||||
sk->sk_protocol),
|
||||
.flowi4_flags = FLOWI_FLAG_CAN_SLEEP,
|
||||
};
|
||||
if (!inet->hdrincl) {
|
||||
err = raw_probe_proto_opt(&fl, msg);
|
||||
err = raw_probe_proto_opt(&fl4, msg);
|
||||
if (err)
|
||||
goto done;
|
||||
}
|
||||
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
rt = ip_route_output_flow(sock_net(sk), &fl, sk);
|
||||
security_sk_classify_flow(sk, flowi4_to_flowi(&fl4));
|
||||
rt = ip_route_output_flow(sock_net(sk), &fl4, sk);
|
||||
if (IS_ERR(rt)) {
|
||||
err = PTR_ERR(rt);
|
||||
goto done;
|
||||
|
Reference in New Issue
Block a user