summaryrefslogtreecommitdiffstats
path: root/net/ipv4/raw.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/raw.c')
-rw-r--r--net/ipv4/raw.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 5e570aa9e43b..7c509697ebc7 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -617,8 +617,21 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
617 ipc.oif = inet->mc_index; 617 ipc.oif = inet->mc_index;
618 if (!saddr) 618 if (!saddr)
619 saddr = inet->mc_addr; 619 saddr = inet->mc_addr;
620 } else if (!ipc.oif) 620 } else if (!ipc.oif) {
621 ipc.oif = inet->uc_index; 621 ipc.oif = inet->uc_index;
622 } else if (ipv4_is_lbcast(daddr) && inet->uc_index) {
623 /* oif is set, packet is to local broadcast and
624 * and uc_index is set. oif is most likely set
625 * by sk_bound_dev_if. If uc_index != oif check if the
626 * oif is an L3 master and uc_index is an L3 slave.
627 * If so, we want to allow the send using the uc_index.
628 */
629 if (ipc.oif != inet->uc_index &&
630 ipc.oif == l3mdev_master_ifindex_by_index(sock_net(sk),
631 inet->uc_index)) {
632 ipc.oif = inet->uc_index;
633 }
634 }
622 635
623 flowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos, 636 flowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos,
624 RT_SCOPE_UNIVERSE, 637 RT_SCOPE_UNIVERSE,
@@ -1119,7 +1132,6 @@ static int raw_v4_seq_open(struct inode *inode, struct file *file)
1119} 1132}
1120 1133
1121static const struct file_operations raw_seq_fops = { 1134static const struct file_operations raw_seq_fops = {
1122 .owner = THIS_MODULE,
1123 .open = raw_v4_seq_open, 1135 .open = raw_v4_seq_open,
1124 .read = seq_read, 1136 .read = seq_read,
1125 .llseek = seq_lseek, 1137 .llseek = seq_lseek,