aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/raw.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/raw.c')
-rw-r--r--net/ipv4/raw.c42
1 files changed, 15 insertions, 27 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 85c08696abbe..a3002fe65b7f 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -352,6 +352,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
352 skb_reserve(skb, hh_len); 352 skb_reserve(skb, hh_len);
353 353
354 skb->priority = sk->sk_priority; 354 skb->priority = sk->sk_priority;
355 skb->mark = sk->sk_mark;
355 skb->dst = dst_clone(&rt->u.dst); 356 skb->dst = dst_clone(&rt->u.dst);
356 357
357 skb_reset_network_header(skb); 358 skb_reset_network_header(skb);
@@ -544,6 +545,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
544 545
545 { 546 {
546 struct flowi fl = { .oif = ipc.oif, 547 struct flowi fl = { .oif = ipc.oif,
548 .mark = sk->sk_mark,
547 .nl_u = { .ip4_u = 549 .nl_u = { .ip4_u =
548 { .daddr = daddr, 550 { .daddr = daddr,
549 .saddr = saddr, 551 .saddr = saddr,
@@ -860,8 +862,7 @@ static struct sock *raw_get_first(struct seq_file *seq)
860 struct hlist_node *node; 862 struct hlist_node *node;
861 863
862 sk_for_each(sk, node, &state->h->ht[state->bucket]) 864 sk_for_each(sk, node, &state->h->ht[state->bucket])
863 if (sk->sk_net == state->p.net && 865 if (sk->sk_net == state->p.net)
864 sk->sk_family == state->family)
865 goto found; 866 goto found;
866 } 867 }
867 sk = NULL; 868 sk = NULL;
@@ -877,8 +878,7 @@ static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk)
877 sk = sk_next(sk); 878 sk = sk_next(sk);
878try_again: 879try_again:
879 ; 880 ;
880 } while (sk && sk->sk_net != state->p.net && 881 } while (sk && sk->sk_net != state->p.net);
881 sk->sk_family != state->family);
882 882
883 if (!sk && ++state->bucket < RAW_HTABLE_SIZE) { 883 if (!sk && ++state->bucket < RAW_HTABLE_SIZE) {
884 sk = sk_head(&state->h->ht[state->bucket]); 884 sk = sk_head(&state->h->ht[state->bucket]);
@@ -927,7 +927,7 @@ void raw_seq_stop(struct seq_file *seq, void *v)
927} 927}
928EXPORT_SYMBOL_GPL(raw_seq_stop); 928EXPORT_SYMBOL_GPL(raw_seq_stop);
929 929
930static __inline__ char *get_raw_sock(struct sock *sp, char *tmpbuf, int i) 930static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i)
931{ 931{
932 struct inet_sock *inet = inet_sk(sp); 932 struct inet_sock *inet = inet_sk(sp);
933 __be32 dest = inet->daddr, 933 __be32 dest = inet->daddr,
@@ -935,33 +935,23 @@ static __inline__ char *get_raw_sock(struct sock *sp, char *tmpbuf, int i)
935 __u16 destp = 0, 935 __u16 destp = 0,
936 srcp = inet->num; 936 srcp = inet->num;
937 937
938 sprintf(tmpbuf, "%4d: %08X:%04X %08X:%04X" 938 seq_printf(seq, "%4d: %08X:%04X %08X:%04X"
939 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d", 939 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d",
940 i, src, srcp, dest, destp, sp->sk_state, 940 i, src, srcp, dest, destp, sp->sk_state,
941 atomic_read(&sp->sk_wmem_alloc), 941 atomic_read(&sp->sk_wmem_alloc),
942 atomic_read(&sp->sk_rmem_alloc), 942 atomic_read(&sp->sk_rmem_alloc),
943 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), 943 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp),
944 atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops)); 944 atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops));
945 return tmpbuf;
946} 945}
947 946
948#define TMPSZ 128
949
950static int raw_seq_show(struct seq_file *seq, void *v) 947static int raw_seq_show(struct seq_file *seq, void *v)
951{ 948{
952 char tmpbuf[TMPSZ+1];
953
954 if (v == SEQ_START_TOKEN) 949 if (v == SEQ_START_TOKEN)
955 seq_printf(seq, "%-*s\n", TMPSZ-1, 950 seq_printf(seq, " sl local_address rem_address st tx_queue "
956 " sl local_address rem_address st tx_queue " 951 "rx_queue tr tm->when retrnsmt uid timeout "
957 "rx_queue tr tm->when retrnsmt uid timeout " 952 "inode drops\n");
958 "inode drops"); 953 else
959 else { 954 raw_sock_seq_show(seq, v, raw_seq_private(seq)->bucket);
960 struct raw_iter_state *state = raw_seq_private(seq);
961
962 seq_printf(seq, "%-*s\n", TMPSZ-1,
963 get_raw_sock(v, tmpbuf, state->bucket));
964 }
965 return 0; 955 return 0;
966} 956}
967 957
@@ -972,27 +962,25 @@ static const struct seq_operations raw_seq_ops = {
972 .show = raw_seq_show, 962 .show = raw_seq_show,
973}; 963};
974 964
975int raw_seq_open(struct inode *ino, struct file *file, struct raw_hashinfo *h, 965int raw_seq_open(struct inode *ino, struct file *file,
976 unsigned short family) 966 struct raw_hashinfo *h, const struct seq_operations *ops)
977{ 967{
978 int err; 968 int err;
979 struct raw_iter_state *i; 969 struct raw_iter_state *i;
980 970
981 err = seq_open_net(ino, file, &raw_seq_ops, 971 err = seq_open_net(ino, file, ops, sizeof(struct raw_iter_state));
982 sizeof(struct raw_iter_state));
983 if (err < 0) 972 if (err < 0)
984 return err; 973 return err;
985 974
986 i = raw_seq_private((struct seq_file *)file->private_data); 975 i = raw_seq_private((struct seq_file *)file->private_data);
987 i->h = h; 976 i->h = h;
988 i->family = family;
989 return 0; 977 return 0;
990} 978}
991EXPORT_SYMBOL_GPL(raw_seq_open); 979EXPORT_SYMBOL_GPL(raw_seq_open);
992 980
993static int raw_v4_seq_open(struct inode *inode, struct file *file) 981static int raw_v4_seq_open(struct inode *inode, struct file *file)
994{ 982{
995 return raw_seq_open(inode, file, &raw_v4_hashinfo, PF_INET); 983 return raw_seq_open(inode, file, &raw_v4_hashinfo, &raw_seq_ops);
996} 984}
997 985
998static const struct file_operations raw_seq_fops = { 986static const struct file_operations raw_seq_fops = {