aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2006-03-21 01:48:35 -0500
committerDavid S. Miller <davem@davemloft.net>2006-03-21 01:48:35 -0500
commit543d9cfeec4d58ad3fd974db5531b06b6b95deb4 (patch)
treeb5f79a92ec01b4a97f26d48cae11566498641822
parentf94691acf9df35d5cd828373e35391bdc4a3fde6 (diff)
[NET]: Identation & other cleanups related to compat_[gs]etsockopt cset
No code changes, just tidying up, in some cases moving EXPORT_SYMBOLs to just after the function exported, etc. Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/sock.c20
-rw-r--r--net/dccp/ipv4.c72
-rw-r--r--net/dccp/ipv6.c138
-rw-r--r--net/dccp/proto.c9
-rw-r--r--net/ipv4/af_inet.c120
-rw-r--r--net/ipv4/ip_sockglue.c35
-rw-r--r--net/ipv4/raw.c46
-rw-r--r--net/ipv4/tcp.c16
-rw-r--r--net/ipv4/tcp_ipv4.c34
-rw-r--r--net/ipv4/udp.c48
-rw-r--r--net/ipv6/af_inet6.c120
-rw-r--r--net/ipv6/ipv6_sockglue.c40
-rw-r--r--net/ipv6/ipv6_syms.c4
-rw-r--r--net/ipv6/raw.c94
-rw-r--r--net/ipv6/tcp_ipv6.c64
-rw-r--r--net/ipv6/udp.c48
-rw-r--r--net/netfilter/nf_sockopt.c2
-rw-r--r--net/sctp/ipv6.c92
-rw-r--r--net/sctp/protocol.c94
19 files changed, 540 insertions, 556 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index dd63cdea3fe7..1a7e6eac90b0 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1386,14 +1386,14 @@ int sock_common_getsockopt(struct socket *sock, int level, int optname,
1386EXPORT_SYMBOL(sock_common_getsockopt); 1386EXPORT_SYMBOL(sock_common_getsockopt);
1387 1387
1388#ifdef CONFIG_COMPAT 1388#ifdef CONFIG_COMPAT
1389int compat_sock_common_getsockopt(struct socket *sock, int level, 1389int compat_sock_common_getsockopt(struct socket *sock, int level, int optname,
1390 int optname, char __user *optval, int __user *optlen) 1390 char __user *optval, int __user *optlen)
1391{ 1391{
1392 struct sock *sk = sock->sk; 1392 struct sock *sk = sock->sk;
1393 1393
1394 if (sk->sk_prot->compat_setsockopt) 1394 if (sk->sk_prot->compat_setsockopt != NULL)
1395 return sk->sk_prot->compat_getsockopt(sk, level, 1395 return sk->sk_prot->compat_getsockopt(sk, level, optname,
1396 optname, optval, optlen); 1396 optval, optlen);
1397 return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen); 1397 return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen);
1398} 1398}
1399EXPORT_SYMBOL(compat_sock_common_getsockopt); 1399EXPORT_SYMBOL(compat_sock_common_getsockopt);
@@ -1429,14 +1429,14 @@ int sock_common_setsockopt(struct socket *sock, int level, int optname,
1429EXPORT_SYMBOL(sock_common_setsockopt); 1429EXPORT_SYMBOL(sock_common_setsockopt);
1430 1430
1431#ifdef CONFIG_COMPAT 1431#ifdef CONFIG_COMPAT
1432int compat_sock_common_setsockopt(struct socket *sock, 1432int compat_sock_common_setsockopt(struct socket *sock, int level, int optname,
1433 int level, int optname, char __user *optval, int optlen) 1433 char __user *optval, int optlen)
1434{ 1434{
1435 struct sock *sk = sock->sk; 1435 struct sock *sk = sock->sk;
1436 1436
1437 if (sk->sk_prot->compat_setsockopt) 1437 if (sk->sk_prot->compat_setsockopt != NULL)
1438 return sk->sk_prot->compat_setsockopt(sk, level, 1438 return sk->sk_prot->compat_setsockopt(sk, level, optname,
1439 optname, optval, optlen); 1439 optval, optlen);
1440 return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen); 1440 return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen);
1441} 1441}
1442EXPORT_SYMBOL(compat_sock_common_setsockopt); 1442EXPORT_SYMBOL(compat_sock_common_setsockopt);
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 8a33c8498d9c..29047995c695 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -986,20 +986,20 @@ do_time_wait:
986} 986}
987 987
988static struct inet_connection_sock_af_ops dccp_ipv4_af_ops = { 988static struct inet_connection_sock_af_ops dccp_ipv4_af_ops = {
989 .queue_xmit = ip_queue_xmit, 989 .queue_xmit = ip_queue_xmit,
990 .send_check = dccp_v4_send_check, 990 .send_check = dccp_v4_send_check,
991 .rebuild_header = inet_sk_rebuild_header, 991 .rebuild_header = inet_sk_rebuild_header,
992 .conn_request = dccp_v4_conn_request, 992 .conn_request = dccp_v4_conn_request,
993 .syn_recv_sock = dccp_v4_request_recv_sock, 993 .syn_recv_sock = dccp_v4_request_recv_sock,
994 .net_header_len = sizeof(struct iphdr), 994 .net_header_len = sizeof(struct iphdr),
995 .setsockopt = ip_setsockopt, 995 .setsockopt = ip_setsockopt,
996 .getsockopt = ip_getsockopt, 996 .getsockopt = ip_getsockopt,
997 .addr2sockaddr = inet_csk_addr2sockaddr,
998 .sockaddr_len = sizeof(struct sockaddr_in),
997#ifdef CONFIG_COMPAT 999#ifdef CONFIG_COMPAT
998 .compat_setsockopt = compat_ip_setsockopt, 1000 .compat_setsockopt = compat_ip_setsockopt,
999 .compat_getsockopt = compat_ip_getsockopt, 1001 .compat_getsockopt = compat_ip_getsockopt,
1000#endif 1002#endif
1001 .addr2sockaddr = inet_csk_addr2sockaddr,
1002 .sockaddr_len = sizeof(struct sockaddr_in),
1003}; 1003};
1004 1004
1005static int dccp_v4_init_sock(struct sock *sk) 1005static int dccp_v4_init_sock(struct sock *sk)
@@ -1044,10 +1044,6 @@ static struct proto dccp_v4_prot = {
1044 .init = dccp_v4_init_sock, 1044 .init = dccp_v4_init_sock,
1045 .setsockopt = dccp_setsockopt, 1045 .setsockopt = dccp_setsockopt,
1046 .getsockopt = dccp_getsockopt, 1046 .getsockopt = dccp_getsockopt,
1047#ifdef CONFIG_COMPAT
1048 .compat_setsockopt = compat_dccp_setsockopt,
1049 .compat_getsockopt = compat_dccp_getsockopt,
1050#endif
1051 .sendmsg = dccp_sendmsg, 1047 .sendmsg = dccp_sendmsg,
1052 .recvmsg = dccp_recvmsg, 1048 .recvmsg = dccp_recvmsg,
1053 .backlog_rcv = dccp_v4_do_rcv, 1049 .backlog_rcv = dccp_v4_do_rcv,
@@ -1062,6 +1058,10 @@ static struct proto dccp_v4_prot = {
1062 .obj_size = sizeof(struct dccp_sock), 1058 .obj_size = sizeof(struct dccp_sock),
1063 .rsk_prot = &dccp_request_sock_ops, 1059 .rsk_prot = &dccp_request_sock_ops,
1064 .twsk_prot = &dccp_timewait_sock_ops, 1060 .twsk_prot = &dccp_timewait_sock_ops,
1061#ifdef CONFIG_COMPAT
1062 .compat_setsockopt = compat_dccp_setsockopt,
1063 .compat_getsockopt = compat_dccp_getsockopt,
1064#endif
1065}; 1065};
1066 1066
1067static struct net_protocol dccp_v4_protocol = { 1067static struct net_protocol dccp_v4_protocol = {
@@ -1071,30 +1071,30 @@ static struct net_protocol dccp_v4_protocol = {
1071}; 1071};
1072 1072
1073static const struct proto_ops inet_dccp_ops = { 1073static const struct proto_ops inet_dccp_ops = {
1074 .family = PF_INET, 1074 .family = PF_INET,
1075 .owner = THIS_MODULE, 1075 .owner = THIS_MODULE,
1076 .release = inet_release, 1076 .release = inet_release,
1077 .bind = inet_bind, 1077 .bind = inet_bind,
1078 .connect = inet_stream_connect, 1078 .connect = inet_stream_connect,
1079 .socketpair = sock_no_socketpair, 1079 .socketpair = sock_no_socketpair,
1080 .accept = inet_accept, 1080 .accept = inet_accept,
1081 .getname = inet_getname, 1081 .getname = inet_getname,
1082 /* FIXME: work on tcp_poll to rename it to inet_csk_poll */ 1082 /* FIXME: work on tcp_poll to rename it to inet_csk_poll */
1083 .poll = dccp_poll, 1083 .poll = dccp_poll,
1084 .ioctl = inet_ioctl, 1084 .ioctl = inet_ioctl,
1085 /* FIXME: work on inet_listen to rename it to sock_common_listen */ 1085 /* FIXME: work on inet_listen to rename it to sock_common_listen */
1086 .listen = inet_dccp_listen, 1086 .listen = inet_dccp_listen,
1087 .shutdown = inet_shutdown, 1087 .shutdown = inet_shutdown,
1088 .setsockopt = sock_common_setsockopt, 1088 .setsockopt = sock_common_setsockopt,
1089 .getsockopt = sock_common_getsockopt, 1089 .getsockopt = sock_common_getsockopt,
1090 .sendmsg = inet_sendmsg,
1091 .recvmsg = sock_common_recvmsg,
1092 .mmap = sock_no_mmap,
1093 .sendpage = sock_no_sendpage,
1090#ifdef CONFIG_COMPAT 1094#ifdef CONFIG_COMPAT
1091 .compat_setsockopt = compat_sock_common_setsockopt, 1095 .compat_setsockopt = compat_sock_common_setsockopt,
1092 .compat_getsockopt = compat_sock_common_getsockopt, 1096 .compat_getsockopt = compat_sock_common_getsockopt,
1093#endif 1097#endif
1094 .sendmsg = inet_sendmsg,
1095 .recvmsg = sock_common_recvmsg,
1096 .mmap = sock_no_mmap,
1097 .sendpage = sock_no_sendpage,
1098}; 1098};
1099 1099
1100static struct inet_protosw dccp_v4_protosw = { 1100static struct inet_protosw dccp_v4_protosw = {
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 89106c7d3247..65e2ab0886e6 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -1106,40 +1106,40 @@ do_time_wait:
1106} 1106}
1107 1107
1108static struct inet_connection_sock_af_ops dccp_ipv6_af_ops = { 1108static struct inet_connection_sock_af_ops dccp_ipv6_af_ops = {
1109 .queue_xmit = inet6_csk_xmit, 1109 .queue_xmit = inet6_csk_xmit,
1110 .send_check = dccp_v6_send_check, 1110 .send_check = dccp_v6_send_check,
1111 .rebuild_header = inet6_sk_rebuild_header, 1111 .rebuild_header = inet6_sk_rebuild_header,
1112 .conn_request = dccp_v6_conn_request, 1112 .conn_request = dccp_v6_conn_request,
1113 .syn_recv_sock = dccp_v6_request_recv_sock, 1113 .syn_recv_sock = dccp_v6_request_recv_sock,
1114 .net_header_len = sizeof(struct ipv6hdr), 1114 .net_header_len = sizeof(struct ipv6hdr),
1115 .setsockopt = ipv6_setsockopt, 1115 .setsockopt = ipv6_setsockopt,
1116 .getsockopt = ipv6_getsockopt, 1116 .getsockopt = ipv6_getsockopt,
1117 .addr2sockaddr = inet6_csk_addr2sockaddr,
1118 .sockaddr_len = sizeof(struct sockaddr_in6),
1117#ifdef CONFIG_COMPAT 1119#ifdef CONFIG_COMPAT
1118 .compat_setsockopt = compat_ipv6_setsockopt, 1120 .compat_setsockopt = compat_ipv6_setsockopt,
1119 .compat_getsockopt = compat_ipv6_getsockopt, 1121 .compat_getsockopt = compat_ipv6_getsockopt,
1120#endif 1122#endif
1121 .addr2sockaddr = inet6_csk_addr2sockaddr,
1122 .sockaddr_len = sizeof(struct sockaddr_in6)
1123}; 1123};
1124 1124
1125/* 1125/*
1126 * DCCP over IPv4 via INET6 API 1126 * DCCP over IPv4 via INET6 API
1127 */ 1127 */
1128static struct inet_connection_sock_af_ops dccp_ipv6_mapped = { 1128static struct inet_connection_sock_af_ops dccp_ipv6_mapped = {
1129 .queue_xmit = ip_queue_xmit, 1129 .queue_xmit = ip_queue_xmit,
1130 .send_check = dccp_v4_send_check, 1130 .send_check = dccp_v4_send_check,
1131 .rebuild_header = inet_sk_rebuild_header, 1131 .rebuild_header = inet_sk_rebuild_header,
1132 .conn_request = dccp_v6_conn_request, 1132 .conn_request = dccp_v6_conn_request,
1133 .syn_recv_sock = dccp_v6_request_recv_sock, 1133 .syn_recv_sock = dccp_v6_request_recv_sock,
1134 .net_header_len = sizeof(struct iphdr), 1134 .net_header_len = sizeof(struct iphdr),
1135 .setsockopt = ipv6_setsockopt, 1135 .setsockopt = ipv6_setsockopt,
1136 .getsockopt = ipv6_getsockopt, 1136 .getsockopt = ipv6_getsockopt,
1137 .addr2sockaddr = inet6_csk_addr2sockaddr,
1138 .sockaddr_len = sizeof(struct sockaddr_in6),
1137#ifdef CONFIG_COMPAT 1139#ifdef CONFIG_COMPAT
1138 .compat_setsockopt = compat_ipv6_setsockopt, 1140 .compat_setsockopt = compat_ipv6_setsockopt,
1139 .compat_getsockopt = compat_ipv6_getsockopt, 1141 .compat_getsockopt = compat_ipv6_getsockopt,
1140#endif 1142#endif
1141 .addr2sockaddr = inet6_csk_addr2sockaddr,
1142 .sockaddr_len = sizeof(struct sockaddr_in6)
1143}; 1143};
1144 1144
1145/* NOTE: A lot of things set to zero explicitly by call to 1145/* NOTE: A lot of things set to zero explicitly by call to
@@ -1166,33 +1166,33 @@ static int dccp_v6_destroy_sock(struct sock *sk)
1166} 1166}
1167 1167
1168static struct proto dccp_v6_prot = { 1168static struct proto dccp_v6_prot = {
1169 .name = "DCCPv6", 1169 .name = "DCCPv6",
1170 .owner = THIS_MODULE, 1170 .owner = THIS_MODULE,
1171 .close = dccp_close, 1171 .close = dccp_close,
1172 .connect = dccp_v6_connect, 1172 .connect = dccp_v6_connect,
1173 .disconnect = dccp_disconnect, 1173 .disconnect = dccp_disconnect,
1174 .ioctl = dccp_ioctl, 1174 .ioctl = dccp_ioctl,
1175 .init = dccp_v6_init_sock, 1175 .init = dccp_v6_init_sock,
1176 .setsockopt = dccp_setsockopt, 1176 .setsockopt = dccp_setsockopt,
1177 .getsockopt = dccp_getsockopt, 1177 .getsockopt = dccp_getsockopt,
1178 .sendmsg = dccp_sendmsg,
1179 .recvmsg = dccp_recvmsg,
1180 .backlog_rcv = dccp_v6_do_rcv,
1181 .hash = dccp_v6_hash,
1182 .unhash = dccp_unhash,
1183 .accept = inet_csk_accept,
1184 .get_port = dccp_v6_get_port,
1185 .shutdown = dccp_shutdown,
1186 .destroy = dccp_v6_destroy_sock,
1187 .orphan_count = &dccp_orphan_count,
1188 .max_header = MAX_DCCP_HEADER,
1189 .obj_size = sizeof(struct dccp6_sock),
1190 .rsk_prot = &dccp6_request_sock_ops,
1191 .twsk_prot = &dccp6_timewait_sock_ops,
1178#ifdef CONFIG_COMPAT 1192#ifdef CONFIG_COMPAT
1179 .compat_setsockopt = compat_dccp_setsockopt, 1193 .compat_setsockopt = compat_dccp_setsockopt,
1180 .compat_getsockopt = compat_dccp_getsockopt, 1194 .compat_getsockopt = compat_dccp_getsockopt,
1181#endif 1195#endif
1182 .sendmsg = dccp_sendmsg,
1183 .recvmsg = dccp_recvmsg,
1184 .backlog_rcv = dccp_v6_do_rcv,
1185 .hash = dccp_v6_hash,
1186 .unhash = dccp_unhash,
1187 .accept = inet_csk_accept,
1188 .get_port = dccp_v6_get_port,
1189 .shutdown = dccp_shutdown,
1190 .destroy = dccp_v6_destroy_sock,
1191 .orphan_count = &dccp_orphan_count,
1192 .max_header = MAX_DCCP_HEADER,
1193 .obj_size = sizeof(struct dccp6_sock),
1194 .rsk_prot = &dccp6_request_sock_ops,
1195 .twsk_prot = &dccp6_timewait_sock_ops,
1196}; 1196};
1197 1197
1198static struct inet6_protocol dccp_v6_protocol = { 1198static struct inet6_protocol dccp_v6_protocol = {
@@ -1202,28 +1202,28 @@ static struct inet6_protocol dccp_v6_protocol = {
1202}; 1202};
1203 1203
1204static struct proto_ops inet6_dccp_ops = { 1204static struct proto_ops inet6_dccp_ops = {
1205 .family = PF_INET6, 1205 .family = PF_INET6,
1206 .owner = THIS_MODULE, 1206 .owner = THIS_MODULE,
1207 .release = inet6_release, 1207 .release = inet6_release,
1208 .bind = inet6_bind, 1208 .bind = inet6_bind,
1209 .connect = inet_stream_connect, 1209 .connect = inet_stream_connect,
1210 .socketpair = sock_no_socketpair, 1210 .socketpair = sock_no_socketpair,
1211 .accept = inet_accept, 1211 .accept = inet_accept,
1212 .getname = inet6_getname, 1212 .getname = inet6_getname,
1213 .poll = dccp_poll, 1213 .poll = dccp_poll,
1214 .ioctl = inet6_ioctl, 1214 .ioctl = inet6_ioctl,
1215 .listen = inet_dccp_listen, 1215 .listen = inet_dccp_listen,
1216 .shutdown = inet_shutdown, 1216 .shutdown = inet_shutdown,
1217 .setsockopt = sock_common_setsockopt, 1217 .setsockopt = sock_common_setsockopt,
1218 .getsockopt = sock_common_getsockopt, 1218 .getsockopt = sock_common_getsockopt,
1219 .sendmsg = inet_sendmsg,
1220 .recvmsg = sock_common_recvmsg,
1221 .mmap = sock_no_mmap,
1222 .sendpage = sock_no_sendpage,
1219#ifdef CONFIG_COMPAT 1223#ifdef CONFIG_COMPAT
1220 .compat_setsockopt = compat_sock_common_setsockopt, 1224 .compat_setsockopt = compat_sock_common_setsockopt,
1221 .compat_getsockopt = compat_sock_common_getsockopt, 1225 .compat_getsockopt = compat_sock_common_getsockopt,
1222#endif 1226#endif
1223 .sendmsg = inet_sendmsg,
1224 .recvmsg = sock_common_recvmsg,
1225 .mmap = sock_no_mmap,
1226 .sendpage = sock_no_sendpage,
1227}; 1227};
1228 1228
1229static struct inet_protosw dccp_v6_protosw = { 1229static struct inet_protosw dccp_v6_protosw = {
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 6d7aef9647de..8a6d0a83047c 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -516,18 +516,19 @@ int dccp_setsockopt(struct sock *sk, int level, int optname,
516 optlen); 516 optlen);
517 return do_dccp_setsockopt(sk, level, optname, optval, optlen); 517 return do_dccp_setsockopt(sk, level, optname, optval, optlen);
518} 518}
519
519EXPORT_SYMBOL_GPL(dccp_setsockopt); 520EXPORT_SYMBOL_GPL(dccp_setsockopt);
520 521
521#ifdef CONFIG_COMPAT 522#ifdef CONFIG_COMPAT
522int compat_dccp_setsockopt(struct sock *sk, int level, int optname, 523int compat_dccp_setsockopt(struct sock *sk, int level, int optname,
523 char __user *optval, int optlen) 524 char __user *optval, int optlen)
524{ 525{
525 if (level != SOL_DCCP) 526 if (level != SOL_DCCP)
526 return inet_csk_compat_setsockopt(sk, level, optname, 527 return inet_csk_compat_setsockopt(sk, level, optname,
527 optval, optlen); 528 optval, optlen);
528
529 return do_dccp_setsockopt(sk, level, optname, optval, optlen); 529 return do_dccp_setsockopt(sk, level, optname, optval, optlen);
530} 530}
531
531EXPORT_SYMBOL_GPL(compat_dccp_setsockopt); 532EXPORT_SYMBOL_GPL(compat_dccp_setsockopt);
532#endif 533#endif
533 534
@@ -609,17 +610,19 @@ int dccp_getsockopt(struct sock *sk, int level, int optname,
609 optlen); 610 optlen);
610 return do_dccp_getsockopt(sk, level, optname, optval, optlen); 611 return do_dccp_getsockopt(sk, level, optname, optval, optlen);
611} 612}
613
612EXPORT_SYMBOL_GPL(dccp_getsockopt); 614EXPORT_SYMBOL_GPL(dccp_getsockopt);
613 615
614#ifdef CONFIG_COMPAT 616#ifdef CONFIG_COMPAT
615int compat_dccp_getsockopt(struct sock *sk, int level, int optname, 617int compat_dccp_getsockopt(struct sock *sk, int level, int optname,
616 char __user *optval, int __user *optlen) 618 char __user *optval, int __user *optlen)
617{ 619{
618 if (level != SOL_DCCP) 620 if (level != SOL_DCCP)
619 return inet_csk_compat_getsockopt(sk, level, optname, 621 return inet_csk_compat_getsockopt(sk, level, optname,
620 optval, optlen); 622 optval, optlen);
621 return do_dccp_getsockopt(sk, level, optname, optval, optlen); 623 return do_dccp_getsockopt(sk, level, optname, optval, optlen);
622} 624}
625
623EXPORT_SYMBOL_GPL(compat_dccp_getsockopt); 626EXPORT_SYMBOL_GPL(compat_dccp_getsockopt);
624#endif 627#endif
625 628
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 454e523b506a..dc206f1f914f 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -788,53 +788,53 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
788} 788}
789 789
790const struct proto_ops inet_stream_ops = { 790const struct proto_ops inet_stream_ops = {
791 .family = PF_INET, 791 .family = PF_INET,
792 .owner = THIS_MODULE, 792 .owner = THIS_MODULE,
793 .release = inet_release, 793 .release = inet_release,
794 .bind = inet_bind, 794 .bind = inet_bind,
795 .connect = inet_stream_connect, 795 .connect = inet_stream_connect,
796 .socketpair = sock_no_socketpair, 796 .socketpair = sock_no_socketpair,
797 .accept = inet_accept, 797 .accept = inet_accept,
798 .getname = inet_getname, 798 .getname = inet_getname,
799 .poll = tcp_poll, 799 .poll = tcp_poll,
800 .ioctl = inet_ioctl, 800 .ioctl = inet_ioctl,
801 .listen = inet_listen, 801 .listen = inet_listen,
802 .shutdown = inet_shutdown, 802 .shutdown = inet_shutdown,
803 .setsockopt = sock_common_setsockopt, 803 .setsockopt = sock_common_setsockopt,
804 .getsockopt = sock_common_getsockopt, 804 .getsockopt = sock_common_getsockopt,
805 .sendmsg = inet_sendmsg,
806 .recvmsg = sock_common_recvmsg,
807 .mmap = sock_no_mmap,
808 .sendpage = tcp_sendpage,
805#ifdef CONFIG_COMPAT 809#ifdef CONFIG_COMPAT
806 .compat_setsockopt = compat_sock_common_setsockopt, 810 .compat_setsockopt = compat_sock_common_setsockopt,
807 .compat_getsockopt = compat_sock_common_getsockopt, 811 .compat_getsockopt = compat_sock_common_getsockopt,
808#endif 812#endif
809 .sendmsg = inet_sendmsg,
810 .recvmsg = sock_common_recvmsg,
811 .mmap = sock_no_mmap,
812 .sendpage = tcp_sendpage
813}; 813};
814 814
815const struct proto_ops inet_dgram_ops = { 815const struct proto_ops inet_dgram_ops = {
816 .family = PF_INET, 816 .family = PF_INET,
817 .owner = THIS_MODULE, 817 .owner = THIS_MODULE,
818 .release = inet_release, 818 .release = inet_release,
819 .bind = inet_bind, 819 .bind = inet_bind,
820 .connect = inet_dgram_connect, 820 .connect = inet_dgram_connect,
821 .socketpair = sock_no_socketpair, 821 .socketpair = sock_no_socketpair,
822 .accept = sock_no_accept, 822 .accept = sock_no_accept,
823 .getname = inet_getname, 823 .getname = inet_getname,
824 .poll = udp_poll, 824 .poll = udp_poll,
825 .ioctl = inet_ioctl, 825 .ioctl = inet_ioctl,
826 .listen = sock_no_listen, 826 .listen = sock_no_listen,
827 .shutdown = inet_shutdown, 827 .shutdown = inet_shutdown,
828 .setsockopt = sock_common_setsockopt, 828 .setsockopt = sock_common_setsockopt,
829 .getsockopt = sock_common_getsockopt, 829 .getsockopt = sock_common_getsockopt,
830 .sendmsg = inet_sendmsg,
831 .recvmsg = sock_common_recvmsg,
832 .mmap = sock_no_mmap,
833 .sendpage = inet_sendpage,
830#ifdef CONFIG_COMPAT 834#ifdef CONFIG_COMPAT
831 .compat_setsockopt = compat_sock_common_setsockopt, 835 .compat_setsockopt = compat_sock_common_setsockopt,
832 .compat_getsockopt = compat_sock_common_getsockopt, 836 .compat_getsockopt = compat_sock_common_getsockopt,
833#endif 837#endif
834 .sendmsg = inet_sendmsg,
835 .recvmsg = sock_common_recvmsg,
836 .mmap = sock_no_mmap,
837 .sendpage = inet_sendpage,
838}; 838};
839 839
840/* 840/*
@@ -842,28 +842,28 @@ const struct proto_ops inet_dgram_ops = {
842 * udp_poll 842 * udp_poll
843 */ 843 */
844static const struct proto_ops inet_sockraw_ops = { 844static const struct proto_ops inet_sockraw_ops = {
845 .family = PF_INET, 845 .family = PF_INET,
846 .owner = THIS_MODULE, 846 .owner = THIS_MODULE,
847 .release = inet_release, 847 .release = inet_release,
848 .bind = inet_bind, 848 .bind = inet_bind,
849 .connect = inet_dgram_connect, 849 .connect = inet_dgram_connect,
850 .socketpair = sock_no_socketpair, 850 .socketpair = sock_no_socketpair,
851 .accept = sock_no_accept, 851 .accept = sock_no_accept,
852 .getname = inet_getname, 852 .getname = inet_getname,
853 .poll = datagram_poll, 853 .poll = datagram_poll,
854 .ioctl = inet_ioctl, 854 .ioctl = inet_ioctl,
855 .listen = sock_no_listen, 855 .listen = sock_no_listen,
856 .shutdown = inet_shutdown, 856 .shutdown = inet_shutdown,
857 .setsockopt = sock_common_setsockopt, 857 .setsockopt = sock_common_setsockopt,
858 .getsockopt = sock_common_getsockopt, 858 .getsockopt = sock_common_getsockopt,
859 .sendmsg = inet_sendmsg,
860 .recvmsg = sock_common_recvmsg,
861 .mmap = sock_no_mmap,
862 .sendpage = inet_sendpage,
859#ifdef CONFIG_COMPAT 863#ifdef CONFIG_COMPAT
860 .compat_setsockopt = compat_sock_common_setsockopt, 864 .compat_setsockopt = compat_sock_common_setsockopt,
861 .compat_getsockopt = compat_sock_common_getsockopt, 865 .compat_getsockopt = compat_sock_common_getsockopt,
862#endif 866#endif
863 .sendmsg = inet_sendmsg,
864 .recvmsg = sock_common_recvmsg,
865 .mmap = sock_no_mmap,
866 .sendpage = inet_sendpage,
867}; 867};
868 868
869static struct net_proto_family inet_family_ops = { 869static struct net_proto_family inet_family_ops = {
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 49ff1cd4e1c9..12e0bf19f24a 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -910,8 +910,8 @@ int ip_setsockopt(struct sock *sk, int level,
910} 910}
911 911
912#ifdef CONFIG_COMPAT 912#ifdef CONFIG_COMPAT
913int compat_ip_setsockopt(struct sock *sk, int level, 913int compat_ip_setsockopt(struct sock *sk, int level, int optname,
914 int optname, char __user *optval, int optlen) 914 char __user *optval, int optlen)
915{ 915{
916 int err; 916 int err;
917 917
@@ -922,19 +922,21 @@ int compat_ip_setsockopt(struct sock *sk, int level,
922#ifdef CONFIG_NETFILTER 922#ifdef CONFIG_NETFILTER
923 /* we need to exclude all possible ENOPROTOOPTs except default case */ 923 /* we need to exclude all possible ENOPROTOOPTs except default case */
924 if (err == -ENOPROTOOPT && optname != IP_HDRINCL && 924 if (err == -ENOPROTOOPT && optname != IP_HDRINCL &&
925 optname != IP_IPSEC_POLICY && optname != IP_XFRM_POLICY 925 optname != IP_IPSEC_POLICY && optname != IP_XFRM_POLICY
926#ifdef CONFIG_IP_MROUTE 926#ifdef CONFIG_IP_MROUTE
927 && (optname < MRT_BASE || optname > (MRT_BASE + 10)) 927 && (optname < MRT_BASE || optname > (MRT_BASE + 10))
928#endif 928#endif
929 ) { 929 ) {
930 lock_sock(sk); 930 lock_sock(sk);
931 err = compat_nf_setsockopt(sk, PF_INET, 931 err = compat_nf_setsockopt(sk, PF_INET, optname,
932 optname, optval, optlen); 932 optval, optlen);
933 release_sock(sk); 933 release_sock(sk);
934 } 934 }
935#endif 935#endif
936 return err; 936 return err;
937} 937}
938
939EXPORT_SYMBOL(compat_ip_setsockopt);
938#endif 940#endif
939 941
940/* 942/*
@@ -1180,27 +1182,24 @@ int ip_getsockopt(struct sock *sk, int level,
1180} 1182}
1181 1183
1182#ifdef CONFIG_COMPAT 1184#ifdef CONFIG_COMPAT
1183int compat_ip_getsockopt(struct sock *sk, int level, 1185int compat_ip_getsockopt(struct sock *sk, int level, int optname,
1184 int optname, char __user *optval, int __user *optlen) 1186 char __user *optval, int __user *optlen)
1185{ 1187{
1186 int err; 1188 int err = do_ip_getsockopt(sk, level, optname, optval, optlen);
1187
1188 err = do_ip_getsockopt(sk, level, optname, optval, optlen);
1189#ifdef CONFIG_NETFILTER 1189#ifdef CONFIG_NETFILTER
1190 /* we need to exclude all possible ENOPROTOOPTs except default case */ 1190 /* we need to exclude all possible ENOPROTOOPTs except default case */
1191 if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS 1191 if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS
1192#ifdef CONFIG_IP_MROUTE 1192#ifdef CONFIG_IP_MROUTE
1193 && (optname < MRT_BASE || optname > MRT_BASE+10) 1193 && (optname < MRT_BASE || optname > MRT_BASE+10)
1194#endif 1194#endif
1195 ) { 1195 ) {
1196 int len; 1196 int len;
1197 1197
1198 if(get_user(len,optlen)) 1198 if (get_user(len, optlen))
1199 return -EFAULT; 1199 return -EFAULT;
1200 1200
1201 lock_sock(sk); 1201 lock_sock(sk);
1202 err = compat_nf_getsockopt(sk, PF_INET, 1202 err = compat_nf_getsockopt(sk, PF_INET, optname, optval, &len);
1203 optname, optval, &len);
1204 release_sock(sk); 1203 release_sock(sk);
1205 if (err >= 0) 1204 if (err >= 0)
1206 err = put_user(len, optlen); 1205 err = put_user(len, optlen);
@@ -1209,13 +1208,11 @@ int compat_ip_getsockopt(struct sock *sk, int level,
1209#endif 1208#endif
1210 return err; 1209 return err;
1211} 1210}
1211
1212EXPORT_SYMBOL(compat_ip_getsockopt);
1212#endif 1213#endif
1213 1214
1214EXPORT_SYMBOL(ip_cmsg_recv); 1215EXPORT_SYMBOL(ip_cmsg_recv);
1215 1216
1216EXPORT_SYMBOL(ip_getsockopt); 1217EXPORT_SYMBOL(ip_getsockopt);
1217EXPORT_SYMBOL(ip_setsockopt); 1218EXPORT_SYMBOL(ip_setsockopt);
1218#ifdef CONFIG_COMPAT
1219EXPORT_SYMBOL(compat_ip_getsockopt);
1220EXPORT_SYMBOL(compat_ip_setsockopt);
1221#endif
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index f1b02b34fc0a..fc2562415555 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -682,11 +682,10 @@ static int raw_setsockopt(struct sock *sk, int level, int optname,
682 682
683#ifdef CONFIG_COMPAT 683#ifdef CONFIG_COMPAT
684static int compat_raw_setsockopt(struct sock *sk, int level, int optname, 684static int compat_raw_setsockopt(struct sock *sk, int level, int optname,
685 char __user *optval, int optlen) 685 char __user *optval, int optlen)
686{ 686{
687 if (level != SOL_RAW) 687 if (level != SOL_RAW)
688 return compat_ip_setsockopt(sk, level, 688 return compat_ip_setsockopt(sk, level, optname, optval, optlen);
689 optname, optval, optlen);
690 return do_raw_setsockopt(sk, level, optname, optval, optlen); 689 return do_raw_setsockopt(sk, level, optname, optval, optlen);
691} 690}
692#endif 691#endif
@@ -713,11 +712,10 @@ static int raw_getsockopt(struct sock *sk, int level, int optname,
713 712
714#ifdef CONFIG_COMPAT 713#ifdef CONFIG_COMPAT
715static int compat_raw_getsockopt(struct sock *sk, int level, int optname, 714static int compat_raw_getsockopt(struct sock *sk, int level, int optname,
716 char __user *optval, int __user *optlen) 715 char __user *optval, int __user *optlen)
717{ 716{
718 if (level != SOL_RAW) 717 if (level != SOL_RAW)
719 return compat_ip_getsockopt(sk, level, 718 return compat_ip_getsockopt(sk, level, optname, optval, optlen);
720 optname, optval, optlen);
721 return do_raw_getsockopt(sk, level, optname, optval, optlen); 719 return do_raw_getsockopt(sk, level, optname, optval, optlen);
722} 720}
723#endif 721#endif
@@ -751,26 +749,26 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg)
751} 749}
752 750
753struct proto raw_prot = { 751struct proto raw_prot = {
754 .name = "RAW", 752 .name = "RAW",
755 .owner = THIS_MODULE, 753 .owner = THIS_MODULE,
756 .close = raw_close, 754 .close = raw_close,
757 .connect = ip4_datagram_connect, 755 .connect = ip4_datagram_connect,
758 .disconnect = udp_disconnect, 756 .disconnect = udp_disconnect,
759 .ioctl = raw_ioctl, 757 .ioctl = raw_ioctl,
760 .init = raw_init, 758 .init = raw_init,
761 .setsockopt = raw_setsockopt, 759 .setsockopt = raw_setsockopt,
762 .getsockopt = raw_getsockopt, 760 .getsockopt = raw_getsockopt,
761 .sendmsg = raw_sendmsg,
762 .recvmsg = raw_recvmsg,
763 .bind = raw_bind,
764 .backlog_rcv = raw_rcv_skb,
765 .hash = raw_v4_hash,
766 .unhash = raw_v4_unhash,
767 .obj_size = sizeof(struct raw_sock),
763#ifdef CONFIG_COMPAT 768#ifdef CONFIG_COMPAT
764 .compat_setsockopt = compat_raw_setsockopt, 769 .compat_setsockopt = compat_raw_setsockopt,
765 .compat_getsockopt = compat_raw_getsockopt, 770 .compat_getsockopt = compat_raw_getsockopt,
766#endif 771#endif
767 .sendmsg = raw_sendmsg,
768 .recvmsg = raw_recvmsg,
769 .bind = raw_bind,
770 .backlog_rcv = raw_rcv_skb,
771 .hash = raw_v4_hash,
772 .unhash = raw_v4_unhash,
773 .obj_size = sizeof(struct raw_sock),
774}; 772};
775 773
776#ifdef CONFIG_PROC_FS 774#ifdef CONFIG_PROC_FS
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 89da253e33f0..4b0272c92d66 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1879,14 +1879,16 @@ int tcp_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
1879} 1879}
1880 1880
1881#ifdef CONFIG_COMPAT 1881#ifdef CONFIG_COMPAT
1882int compat_tcp_setsockopt(struct sock *sk, int level, 1882int compat_tcp_setsockopt(struct sock *sk, int level, int optname,
1883 int optname, char __user *optval, int optlen) 1883 char __user *optval, int optlen)
1884{ 1884{
1885 if (level != SOL_TCP) 1885 if (level != SOL_TCP)
1886 return inet_csk_compat_setsockopt(sk, level, optname, 1886 return inet_csk_compat_setsockopt(sk, level, optname,
1887 optval, optlen); 1887 optval, optlen);
1888 return do_tcp_setsockopt(sk, level, optname, optval, optlen); 1888 return do_tcp_setsockopt(sk, level, optname, optval, optlen);
1889} 1889}
1890
1891EXPORT_SYMBOL(compat_tcp_setsockopt);
1890#endif 1892#endif
1891 1893
1892/* Return information about state of tcp endpoint in API format. */ 1894/* Return information about state of tcp endpoint in API format. */
@@ -2051,14 +2053,16 @@ int tcp_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
2051} 2053}
2052 2054
2053#ifdef CONFIG_COMPAT 2055#ifdef CONFIG_COMPAT
2054int compat_tcp_getsockopt(struct sock *sk, int level, 2056int compat_tcp_getsockopt(struct sock *sk, int level, int optname,
2055 int optname, char __user *optval, int __user *optlen) 2057 char __user *optval, int __user *optlen)
2056{ 2058{
2057 if (level != SOL_TCP) 2059 if (level != SOL_TCP)
2058 return inet_csk_compat_getsockopt(sk, level, optname, 2060 return inet_csk_compat_getsockopt(sk, level, optname,
2059 optval, optlen); 2061 optval, optlen);
2060 return do_tcp_getsockopt(sk, level, optname, optval, optlen); 2062 return do_tcp_getsockopt(sk, level, optname, optval, optlen);
2061} 2063}
2064
2065EXPORT_SYMBOL(compat_tcp_getsockopt);
2062#endif 2066#endif
2063 2067
2064extern void __skb_cb_too_small_for_tcp(int, int); 2068extern void __skb_cb_too_small_for_tcp(int, int);
@@ -2177,7 +2181,3 @@ EXPORT_SYMBOL(tcp_sendpage);
2177EXPORT_SYMBOL(tcp_setsockopt); 2181EXPORT_SYMBOL(tcp_setsockopt);
2178EXPORT_SYMBOL(tcp_shutdown); 2182EXPORT_SYMBOL(tcp_shutdown);
2179EXPORT_SYMBOL(tcp_statistics); 2183EXPORT_SYMBOL(tcp_statistics);
2180#ifdef CONFIG_COMPAT
2181EXPORT_SYMBOL(compat_tcp_setsockopt);
2182EXPORT_SYMBOL(compat_tcp_getsockopt);
2183#endif
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 249ef6c88959..9e85c0416109 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1217,21 +1217,21 @@ int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw)
1217} 1217}
1218 1218
1219struct inet_connection_sock_af_ops ipv4_specific = { 1219struct inet_connection_sock_af_ops ipv4_specific = {
1220 .queue_xmit = ip_queue_xmit, 1220 .queue_xmit = ip_queue_xmit,
1221 .send_check = tcp_v4_send_check, 1221 .send_check = tcp_v4_send_check,
1222 .rebuild_header = inet_sk_rebuild_header, 1222 .rebuild_header = inet_sk_rebuild_header,
1223 .conn_request = tcp_v4_conn_request, 1223 .conn_request = tcp_v4_conn_request,
1224 .syn_recv_sock = tcp_v4_syn_recv_sock, 1224 .syn_recv_sock = tcp_v4_syn_recv_sock,
1225 .remember_stamp = tcp_v4_remember_stamp, 1225 .remember_stamp = tcp_v4_remember_stamp,
1226 .net_header_len = sizeof(struct iphdr), 1226 .net_header_len = sizeof(struct iphdr),
1227 .setsockopt = ip_setsockopt, 1227 .setsockopt = ip_setsockopt,
1228 .getsockopt = ip_getsockopt, 1228 .getsockopt = ip_getsockopt,
1229 .addr2sockaddr = inet_csk_addr2sockaddr,
1230 .sockaddr_len = sizeof(struct sockaddr_in),
1229#ifdef CONFIG_COMPAT 1231#ifdef CONFIG_COMPAT
1230 .compat_setsockopt = compat_ip_setsockopt, 1232 .compat_setsockopt = compat_ip_setsockopt,
1231 .compat_getsockopt = compat_ip_getsockopt, 1233 .compat_getsockopt = compat_ip_getsockopt,
1232#endif 1234#endif
1233 .addr2sockaddr = inet_csk_addr2sockaddr,
1234 .sockaddr_len = sizeof(struct sockaddr_in),
1235}; 1235};
1236 1236
1237/* NOTE: A lot of things set to zero explicitly by call to 1237/* NOTE: A lot of things set to zero explicitly by call to
@@ -1812,10 +1812,6 @@ struct proto tcp_prot = {
1812 .shutdown = tcp_shutdown, 1812 .shutdown = tcp_shutdown,
1813 .setsockopt = tcp_setsockopt, 1813 .setsockopt = tcp_setsockopt,
1814 .getsockopt = tcp_getsockopt, 1814 .getsockopt = tcp_getsockopt,
1815#ifdef CONFIG_COMPAT
1816 .compat_setsockopt = compat_tcp_setsockopt,
1817 .compat_getsockopt = compat_tcp_getsockopt,
1818#endif
1819 .sendmsg = tcp_sendmsg, 1815 .sendmsg = tcp_sendmsg,
1820 .recvmsg = tcp_recvmsg, 1816 .recvmsg = tcp_recvmsg,
1821 .backlog_rcv = tcp_v4_do_rcv, 1817 .backlog_rcv = tcp_v4_do_rcv,
@@ -1834,6 +1830,10 @@ struct proto tcp_prot = {
1834 .obj_size = sizeof(struct tcp_sock), 1830 .obj_size = sizeof(struct tcp_sock),
1835 .twsk_prot = &tcp_timewait_sock_ops, 1831 .twsk_prot = &tcp_timewait_sock_ops,
1836 .rsk_prot = &tcp_request_sock_ops, 1832 .rsk_prot = &tcp_request_sock_ops,
1833#ifdef CONFIG_COMPAT
1834 .compat_setsockopt = compat_tcp_setsockopt,
1835 .compat_getsockopt = compat_tcp_getsockopt,
1836#endif
1837}; 1837};
1838 1838
1839void __init tcp_v4_init(struct net_proto_family *ops) 1839void __init tcp_v4_init(struct net_proto_family *ops)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 0b0721bd45c6..3f93292b0ad8 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1263,11 +1263,10 @@ static int udp_setsockopt(struct sock *sk, int level, int optname,
1263 1263
1264#ifdef CONFIG_COMPAT 1264#ifdef CONFIG_COMPAT
1265static int compat_udp_setsockopt(struct sock *sk, int level, int optname, 1265static int compat_udp_setsockopt(struct sock *sk, int level, int optname,
1266 char __user *optval, int optlen) 1266 char __user *optval, int optlen)
1267{ 1267{
1268 if (level != SOL_UDP) 1268 if (level != SOL_UDP)
1269 return compat_ip_setsockopt(sk, level, 1269 return compat_ip_setsockopt(sk, level, optname, optval, optlen);
1270 optname, optval, optlen);
1271 return do_udp_setsockopt(sk, level, optname, optval, optlen); 1270 return do_udp_setsockopt(sk, level, optname, optval, optlen);
1272} 1271}
1273#endif 1272#endif
@@ -1316,11 +1315,10 @@ static int udp_getsockopt(struct sock *sk, int level, int optname,
1316 1315
1317#ifdef CONFIG_COMPAT 1316#ifdef CONFIG_COMPAT
1318static int compat_udp_getsockopt(struct sock *sk, int level, int optname, 1317static int compat_udp_getsockopt(struct sock *sk, int level, int optname,
1319 char __user *optval, int __user *optlen) 1318 char __user *optval, int __user *optlen)
1320{ 1319{
1321 if (level != SOL_UDP) 1320 if (level != SOL_UDP)
1322 return compat_ip_getsockopt(sk, level, 1321 return compat_ip_getsockopt(sk, level, optname, optval, optlen);
1323 optname, optval, optlen);
1324 return do_udp_getsockopt(sk, level, optname, optval, optlen); 1322 return do_udp_getsockopt(sk, level, optname, optval, optlen);
1325} 1323}
1326#endif 1324#endif
@@ -1372,27 +1370,27 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
1372} 1370}
1373 1371
1374struct proto udp_prot = { 1372struct proto udp_prot = {
1375 .name = "UDP", 1373 .name = "UDP",
1376 .owner = THIS_MODULE, 1374 .owner = THIS_MODULE,
1377 .close = udp_close, 1375 .close = udp_close,
1378 .connect = ip4_datagram_connect, 1376 .connect = ip4_datagram_connect,
1379 .disconnect = udp_disconnect, 1377 .disconnect = udp_disconnect,
1380 .ioctl = udp_ioctl, 1378 .ioctl = udp_ioctl,
1381 .destroy = udp_destroy_sock, 1379 .destroy = udp_destroy_sock,
1382 .setsockopt = udp_setsockopt, 1380 .setsockopt = udp_setsockopt,
1383 .getsockopt = udp_getsockopt, 1381 .getsockopt = udp_getsockopt,
1382 .sendmsg = udp_sendmsg,
1383 .recvmsg = udp_recvmsg,
1384 .sendpage = udp_sendpage,
1385 .backlog_rcv = udp_queue_rcv_skb,
1386 .hash = udp_v4_hash,
1387 .unhash = udp_v4_unhash,
1388 .get_port = udp_v4_get_port,
1389 .obj_size = sizeof(struct udp_sock),
1384#ifdef CONFIG_COMPAT 1390#ifdef CONFIG_COMPAT
1385 .compat_setsockopt = compat_udp_setsockopt, 1391 .compat_setsockopt = compat_udp_setsockopt,
1386 .compat_getsockopt = compat_udp_getsockopt, 1392 .compat_getsockopt = compat_udp_getsockopt,
1387#endif 1393#endif
1388 .sendmsg = udp_sendmsg,
1389 .recvmsg = udp_recvmsg,
1390 .sendpage = udp_sendpage,
1391 .backlog_rcv = udp_queue_rcv_skb,
1392 .hash = udp_v4_hash,
1393 .unhash = udp_v4_unhash,
1394 .get_port = udp_v4_get_port,
1395 .obj_size = sizeof(struct udp_sock),
1396}; 1394};
1397 1395
1398/* ------------------------------------------------------------------------ */ 1396/* ------------------------------------------------------------------------ */
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 97844c4cd9b1..e19457fe4f6e 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -456,53 +456,53 @@ int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
456} 456}
457 457
458const struct proto_ops inet6_stream_ops = { 458const struct proto_ops inet6_stream_ops = {
459 .family = PF_INET6, 459 .family = PF_INET6,
460 .owner = THIS_MODULE, 460 .owner = THIS_MODULE,
461 .release = inet6_release, 461 .release = inet6_release,
462 .bind = inet6_bind, 462 .bind = inet6_bind,
463 .connect = inet_stream_connect, /* ok */ 463 .connect = inet_stream_connect, /* ok */
464 .socketpair = sock_no_socketpair, /* a do nothing */ 464 .socketpair = sock_no_socketpair, /* a do nothing */
465 .accept = inet_accept, /* ok */ 465 .accept = inet_accept, /* ok */
466 .getname = inet6_getname, 466 .getname = inet6_getname,
467 .poll = tcp_poll, /* ok */ 467 .poll = tcp_poll, /* ok */
468 .ioctl = inet6_ioctl, /* must change */ 468 .ioctl = inet6_ioctl, /* must change */
469 .listen = inet_listen, /* ok */ 469 .listen = inet_listen, /* ok */
470 .shutdown = inet_shutdown, /* ok */ 470 .shutdown = inet_shutdown, /* ok */
471 .setsockopt = sock_common_setsockopt, /* ok */ 471 .setsockopt = sock_common_setsockopt, /* ok */
472 .getsockopt = sock_common_getsockopt, /* ok */ 472 .getsockopt = sock_common_getsockopt, /* ok */
473 .sendmsg = inet_sendmsg, /* ok */
474 .recvmsg = sock_common_recvmsg, /* ok */
475 .mmap = sock_no_mmap,
476 .sendpage = tcp_sendpage,
473#ifdef CONFIG_COMPAT 477#ifdef CONFIG_COMPAT
474 .compat_setsockopt = compat_sock_common_setsockopt, 478 .compat_setsockopt = compat_sock_common_setsockopt,
475 .compat_getsockopt = compat_sock_common_getsockopt, 479 .compat_getsockopt = compat_sock_common_getsockopt,
476#endif 480#endif
477 .sendmsg = inet_sendmsg, /* ok */
478 .recvmsg = sock_common_recvmsg, /* ok */
479 .mmap = sock_no_mmap,
480 .sendpage = tcp_sendpage
481}; 481};
482 482
483const struct proto_ops inet6_dgram_ops = { 483const struct proto_ops inet6_dgram_ops = {
484 .family = PF_INET6, 484 .family = PF_INET6,
485 .owner = THIS_MODULE, 485 .owner = THIS_MODULE,
486 .release = inet6_release, 486 .release = inet6_release,
487 .bind = inet6_bind, 487 .bind = inet6_bind,
488 .connect = inet_dgram_connect, /* ok */ 488 .connect = inet_dgram_connect, /* ok */
489 .socketpair = sock_no_socketpair, /* a do nothing */ 489 .socketpair = sock_no_socketpair, /* a do nothing */
490 .accept = sock_no_accept, /* a do nothing */ 490 .accept = sock_no_accept, /* a do nothing */
491 .getname = inet6_getname, 491 .getname = inet6_getname,
492 .poll = udp_poll, /* ok */ 492 .poll = udp_poll, /* ok */
493 .ioctl = inet6_ioctl, /* must change */ 493 .ioctl = inet6_ioctl, /* must change */
494 .listen = sock_no_listen, /* ok */ 494 .listen = sock_no_listen, /* ok */
495 .shutdown = inet_shutdown, /* ok */ 495 .shutdown = inet_shutdown, /* ok */
496 .setsockopt = sock_common_setsockopt, /* ok */ 496 .setsockopt = sock_common_setsockopt, /* ok */
497 .getsockopt = sock_common_getsockopt, /* ok */ 497 .getsockopt = sock_common_getsockopt, /* ok */
498 .sendmsg = inet_sendmsg, /* ok */
499 .recvmsg = sock_common_recvmsg, /* ok */
500 .mmap = sock_no_mmap,
501 .sendpage = sock_no_sendpage,
498#ifdef CONFIG_COMPAT 502#ifdef CONFIG_COMPAT
499 .compat_setsockopt = compat_sock_common_setsockopt, 503 .compat_setsockopt = compat_sock_common_setsockopt,
500 .compat_getsockopt = compat_sock_common_getsockopt, 504 .compat_getsockopt = compat_sock_common_getsockopt,
501#endif 505#endif
502 .sendmsg = inet_sendmsg, /* ok */
503 .recvmsg = sock_common_recvmsg, /* ok */
504 .mmap = sock_no_mmap,
505 .sendpage = sock_no_sendpage,
506}; 506};
507 507
508static struct net_proto_family inet6_family_ops = { 508static struct net_proto_family inet6_family_ops = {
@@ -513,28 +513,28 @@ static struct net_proto_family inet6_family_ops = {
513 513
514/* Same as inet6_dgram_ops, sans udp_poll. */ 514/* Same as inet6_dgram_ops, sans udp_poll. */
515static const struct proto_ops inet6_sockraw_ops = { 515static const struct proto_ops inet6_sockraw_ops = {
516 .family = PF_INET6, 516 .family = PF_INET6,
517 .owner = THIS_MODULE, 517 .owner = THIS_MODULE,
518 .release = inet6_release, 518 .release = inet6_release,
519 .bind = inet6_bind, 519 .bind = inet6_bind,
520 .connect = inet_dgram_connect, /* ok */ 520 .connect = inet_dgram_connect, /* ok */
521 .socketpair = sock_no_socketpair, /* a do nothing */ 521 .socketpair = sock_no_socketpair, /* a do nothing */
522 .accept = sock_no_accept, /* a do nothing */ 522 .accept = sock_no_accept, /* a do nothing */
523 .getname = inet6_getname, 523 .getname = inet6_getname,
524 .poll = datagram_poll, /* ok */ 524 .poll = datagram_poll, /* ok */
525 .ioctl = inet6_ioctl, /* must change */ 525 .ioctl = inet6_ioctl, /* must change */
526 .listen = sock_no_listen, /* ok */ 526 .listen = sock_no_listen, /* ok */
527 .shutdown = inet_shutdown, /* ok */ 527 .shutdown = inet_shutdown, /* ok */
528 .setsockopt = sock_common_setsockopt, /* ok */ 528 .setsockopt = sock_common_setsockopt, /* ok */
529 .getsockopt = sock_common_getsockopt, /* ok */ 529 .getsockopt = sock_common_getsockopt, /* ok */
530 .sendmsg = inet_sendmsg, /* ok */
531 .recvmsg = sock_common_recvmsg, /* ok */
532 .mmap = sock_no_mmap,
533 .sendpage = sock_no_sendpage,
530#ifdef CONFIG_COMPAT 534#ifdef CONFIG_COMPAT
531 .compat_setsockopt = compat_sock_common_setsockopt, 535 .compat_setsockopt = compat_sock_common_setsockopt,
532 .compat_getsockopt = compat_sock_common_getsockopt, 536 .compat_getsockopt = compat_sock_common_getsockopt,
533#endif 537#endif
534 .sendmsg = inet_sendmsg, /* ok */
535 .recvmsg = sock_common_recvmsg, /* ok */
536 .mmap = sock_no_mmap,
537 .sendpage = sock_no_sendpage,
538}; 538};
539 539
540static struct inet_protosw rawv6_protosw = { 540static struct inet_protosw rawv6_protosw = {
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 988eac58e9d1..602feec47738 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -645,17 +645,15 @@ int ipv6_setsockopt(struct sock *sk, int level, int optname,
645 645
646#ifdef CONFIG_COMPAT 646#ifdef CONFIG_COMPAT
647int compat_ipv6_setsockopt(struct sock *sk, int level, int optname, 647int compat_ipv6_setsockopt(struct sock *sk, int level, int optname,
648 char __user *optval, int optlen) 648 char __user *optval, int optlen)
649{ 649{
650 int err; 650 int err;
651 651
652 if (level == SOL_IP && sk->sk_type != SOCK_RAW) { 652 if (level == SOL_IP && sk->sk_type != SOCK_RAW) {
653 if (udp_prot.compat_setsockopt) 653 if (udp_prot.compat_setsockopt != NULL)
654 return udp_prot.compat_setsockopt(sk, level, 654 return udp_prot.compat_setsockopt(sk, level, optname,
655 optname, optval, optlen); 655 optval, optlen);
656 else 656 return udp_prot.setsockopt(sk, level, optname, optval, optlen);
657 return udp_prot.setsockopt(sk, level,
658 optname, optval, optlen);
659 } 657 }
660 658
661 if (level != SOL_IPV6) 659 if (level != SOL_IPV6)
@@ -665,15 +663,17 @@ int compat_ipv6_setsockopt(struct sock *sk, int level, int optname,
665#ifdef CONFIG_NETFILTER 663#ifdef CONFIG_NETFILTER
666 /* we need to exclude all possible ENOPROTOOPTs except default case */ 664 /* we need to exclude all possible ENOPROTOOPTs except default case */
667 if (err == -ENOPROTOOPT && optname != IPV6_IPSEC_POLICY && 665 if (err == -ENOPROTOOPT && optname != IPV6_IPSEC_POLICY &&
668 optname != IPV6_XFRM_POLICY) { 666 optname != IPV6_XFRM_POLICY) {
669 lock_sock(sk); 667 lock_sock(sk);
670 err = compat_nf_setsockopt(sk, PF_INET6, optname, optval, 668 err = compat_nf_setsockopt(sk, PF_INET6, optname,
671 optlen); 669 optval, optlen);
672 release_sock(sk); 670 release_sock(sk);
673 } 671 }
674#endif 672#endif
675 return err; 673 return err;
676} 674}
675
676EXPORT_SYMBOL(compat_ipv6_setsockopt);
677#endif 677#endif
678 678
679static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_opt_hdr *hdr, 679static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_opt_hdr *hdr,
@@ -927,20 +927,18 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname,
927 927
928#ifdef CONFIG_COMPAT 928#ifdef CONFIG_COMPAT
929int compat_ipv6_getsockopt(struct sock *sk, int level, int optname, 929int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
930 char __user *optval, int __user *optlen) 930 char __user *optval, int __user *optlen)
931{ 931{
932 int err; 932 int err;
933 933
934 if (level == SOL_IP && sk->sk_type != SOCK_RAW) { 934 if (level == SOL_IP && sk->sk_type != SOCK_RAW) {
935 if (udp_prot.compat_getsockopt) 935 if (udp_prot.compat_getsockopt != NULL)
936 return udp_prot.compat_getsockopt(sk, level, 936 return udp_prot.compat_getsockopt(sk, level, optname,
937 optname, optval, optlen); 937 optval, optlen);
938 else 938 return udp_prot.getsockopt(sk, level, optname, optval, optlen);
939 return udp_prot.getsockopt(sk, level,
940 optname, optval, optlen);
941 } 939 }
942 940
943 if(level != SOL_IPV6) 941 if (level != SOL_IPV6)
944 return -ENOPROTOOPT; 942 return -ENOPROTOOPT;
945 943
946 err = do_ipv6_getsockopt(sk, level, optname, optval, optlen); 944 err = do_ipv6_getsockopt(sk, level, optname, optval, optlen);
@@ -954,8 +952,8 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
954 return -EFAULT; 952 return -EFAULT;
955 953
956 lock_sock(sk); 954 lock_sock(sk);
957 err = compat_nf_getsockopt(sk, PF_INET6, optname, optval, 955 err = compat_nf_getsockopt(sk, PF_INET6,
958 &len); 956 optname, optval, &len);
959 release_sock(sk); 957 release_sock(sk);
960 if (err >= 0) 958 if (err >= 0)
961 err = put_user(len, optlen); 959 err = put_user(len, optlen);
@@ -963,6 +961,8 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
963#endif 961#endif
964 return err; 962 return err;
965} 963}
964
965EXPORT_SYMBOL(compat_ipv6_getsockopt);
966#endif 966#endif
967 967
968void __init ipv6_packet_init(void) 968void __init ipv6_packet_init(void)
diff --git a/net/ipv6/ipv6_syms.c b/net/ipv6/ipv6_syms.c
index 61419e11e35d..16482785bdfd 100644
--- a/net/ipv6/ipv6_syms.c
+++ b/net/ipv6/ipv6_syms.c
@@ -18,10 +18,6 @@ EXPORT_SYMBOL(ip6_route_output);
18EXPORT_SYMBOL(addrconf_lock); 18EXPORT_SYMBOL(addrconf_lock);
19EXPORT_SYMBOL(ipv6_setsockopt); 19EXPORT_SYMBOL(ipv6_setsockopt);
20EXPORT_SYMBOL(ipv6_getsockopt); 20EXPORT_SYMBOL(ipv6_getsockopt);
21#ifdef CONFIG_COMPAT
22EXPORT_SYMBOL(compat_ipv6_setsockopt);
23EXPORT_SYMBOL(compat_ipv6_getsockopt);
24#endif
25EXPORT_SYMBOL(inet6_register_protosw); 21EXPORT_SYMBOL(inet6_register_protosw);
26EXPORT_SYMBOL(inet6_unregister_protosw); 22EXPORT_SYMBOL(inet6_unregister_protosw);
27EXPORT_SYMBOL(inet6_add_protocol); 23EXPORT_SYMBOL(inet6_add_protocol);
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 8de5a8e59149..0f63078af41f 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -913,23 +913,21 @@ static int rawv6_setsockopt(struct sock *sk, int level, int optname,
913 913
914#ifdef CONFIG_COMPAT 914#ifdef CONFIG_COMPAT
915static int compat_rawv6_setsockopt(struct sock *sk, int level, int optname, 915static int compat_rawv6_setsockopt(struct sock *sk, int level, int optname,
916 char __user *optval, int optlen) 916 char __user *optval, int optlen)
917{ 917{
918 switch(level) { 918 switch (level) {
919 case SOL_RAW: 919 case SOL_RAW:
920 break;
921 case SOL_ICMPV6:
922 if (inet_sk(sk)->num != IPPROTO_ICMPV6)
923 return -EOPNOTSUPP;
924 return rawv6_seticmpfilter(sk, level, optname, optval, optlen);
925 case SOL_IPV6:
926 if (optname == IPV6_CHECKSUM)
920 break; 927 break;
921 928 default:
922 case SOL_ICMPV6: 929 return compat_ipv6_setsockopt(sk, level, optname,
923 if (inet_sk(sk)->num != IPPROTO_ICMPV6) 930 optval, optlen);
924 return -EOPNOTSUPP;
925 return rawv6_seticmpfilter(sk, level, optname, optval,
926 optlen);
927 case SOL_IPV6:
928 if (optname == IPV6_CHECKSUM)
929 break;
930 default:
931 return compat_ipv6_setsockopt(sk, level,
932 optname, optval, optlen);
933 }; 931 };
934 return do_rawv6_setsockopt(sk, level, optname, optval, optlen); 932 return do_rawv6_setsockopt(sk, level, optname, optval, optlen);
935} 933}
@@ -989,23 +987,21 @@ static int rawv6_getsockopt(struct sock *sk, int level, int optname,
989 987
990#ifdef CONFIG_COMPAT 988#ifdef CONFIG_COMPAT
991static int compat_rawv6_getsockopt(struct sock *sk, int level, int optname, 989static int compat_rawv6_getsockopt(struct sock *sk, int level, int optname,
992 char __user *optval, int __user *optlen) 990 char __user *optval, int __user *optlen)
993{ 991{
994 switch(level) { 992 switch (level) {
995 case SOL_RAW: 993 case SOL_RAW:
994 break;
995 case SOL_ICMPV6:
996 if (inet_sk(sk)->num != IPPROTO_ICMPV6)
997 return -EOPNOTSUPP;
998 return rawv6_geticmpfilter(sk, level, optname, optval, optlen);
999 case SOL_IPV6:
1000 if (optname == IPV6_CHECKSUM)
996 break; 1001 break;
997 1002 default:
998 case SOL_ICMPV6: 1003 return compat_ipv6_getsockopt(sk, level, optname,
999 if (inet_sk(sk)->num != IPPROTO_ICMPV6) 1004 optval, optlen);
1000 return -EOPNOTSUPP;
1001 return rawv6_geticmpfilter(sk, level, optname, optval,
1002 optlen);
1003 case SOL_IPV6:
1004 if (optname == IPV6_CHECKSUM)
1005 break;
1006 default:
1007 return compat_ipv6_getsockopt(sk, level,
1008 optname, optval, optlen);
1009 }; 1005 };
1010 return do_rawv6_getsockopt(sk, level, optname, optval, optlen); 1006 return do_rawv6_getsockopt(sk, level, optname, optval, optlen);
1011} 1007}
@@ -1056,27 +1052,27 @@ static int rawv6_init_sk(struct sock *sk)
1056} 1052}
1057 1053
1058struct proto rawv6_prot = { 1054struct proto rawv6_prot = {
1059 .name = "RAWv6", 1055 .name = "RAWv6",
1060 .owner = THIS_MODULE, 1056 .owner = THIS_MODULE,
1061 .close = rawv6_close, 1057 .close = rawv6_close,
1062 .connect = ip6_datagram_connect, 1058 .connect = ip6_datagram_connect,
1063 .disconnect = udp_disconnect, 1059 .disconnect = udp_disconnect,
1064 .ioctl = rawv6_ioctl, 1060 .ioctl = rawv6_ioctl,
1065 .init = rawv6_init_sk, 1061 .init = rawv6_init_sk,
1066 .destroy = inet6_destroy_sock, 1062 .destroy = inet6_destroy_sock,
1067 .setsockopt = rawv6_setsockopt, 1063 .setsockopt = rawv6_setsockopt,
1068 .getsockopt = rawv6_getsockopt, 1064 .getsockopt = rawv6_getsockopt,
1065 .sendmsg = rawv6_sendmsg,
1066 .recvmsg = rawv6_recvmsg,
1067 .bind = rawv6_bind,
1068 .backlog_rcv = rawv6_rcv_skb,
1069 .hash = raw_v6_hash,
1070 .unhash = raw_v6_unhash,
1071 .obj_size = sizeof(struct raw6_sock),
1069#ifdef CONFIG_COMPAT 1072#ifdef CONFIG_COMPAT
1070 .compat_setsockopt = compat_rawv6_setsockopt, 1073 .compat_setsockopt = compat_rawv6_setsockopt,
1071 .compat_getsockopt = compat_rawv6_getsockopt, 1074 .compat_getsockopt = compat_rawv6_getsockopt,
1072#endif 1075#endif
1073 .sendmsg = rawv6_sendmsg,
1074 .recvmsg = rawv6_recvmsg,
1075 .bind = rawv6_bind,
1076 .backlog_rcv = rawv6_rcv_skb,
1077 .hash = raw_v6_hash,
1078 .unhash = raw_v6_unhash,
1079 .obj_size = sizeof(struct raw6_sock),
1080}; 1076};
1081 1077
1082#ifdef CONFIG_PROC_FS 1078#ifdef CONFIG_PROC_FS
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 2f8975e0150a..301eee726b0f 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1298,22 +1298,21 @@ static int tcp_v6_remember_stamp(struct sock *sk)
1298} 1298}
1299 1299
1300static struct inet_connection_sock_af_ops ipv6_specific = { 1300static struct inet_connection_sock_af_ops ipv6_specific = {
1301 .queue_xmit = inet6_csk_xmit, 1301 .queue_xmit = inet6_csk_xmit,
1302 .send_check = tcp_v6_send_check, 1302 .send_check = tcp_v6_send_check,
1303 .rebuild_header = inet6_sk_rebuild_header, 1303 .rebuild_header = inet6_sk_rebuild_header,
1304 .conn_request = tcp_v6_conn_request, 1304 .conn_request = tcp_v6_conn_request,
1305 .syn_recv_sock = tcp_v6_syn_recv_sock, 1305 .syn_recv_sock = tcp_v6_syn_recv_sock,
1306 .remember_stamp = tcp_v6_remember_stamp, 1306 .remember_stamp = tcp_v6_remember_stamp,
1307 .net_header_len = sizeof(struct ipv6hdr), 1307 .net_header_len = sizeof(struct ipv6hdr),
1308 1308 .setsockopt = ipv6_setsockopt,
1309 .setsockopt = ipv6_setsockopt, 1309 .getsockopt = ipv6_getsockopt,
1310 .getsockopt = ipv6_getsockopt, 1310 .addr2sockaddr = inet6_csk_addr2sockaddr,
1311 .sockaddr_len = sizeof(struct sockaddr_in6),
1311#ifdef CONFIG_COMPAT 1312#ifdef CONFIG_COMPAT
1312 .compat_setsockopt = compat_ipv6_setsockopt, 1313 .compat_setsockopt = compat_ipv6_setsockopt,
1313 .compat_getsockopt = compat_ipv6_getsockopt, 1314 .compat_getsockopt = compat_ipv6_getsockopt,
1314#endif 1315#endif
1315 .addr2sockaddr = inet6_csk_addr2sockaddr,
1316 .sockaddr_len = sizeof(struct sockaddr_in6)
1317}; 1316};
1318 1317
1319/* 1318/*
@@ -1321,26 +1320,23 @@ static struct inet_connection_sock_af_ops ipv6_specific = {
1321 */ 1320 */
1322 1321
1323static struct inet_connection_sock_af_ops ipv6_mapped = { 1322static struct inet_connection_sock_af_ops ipv6_mapped = {
1324 .queue_xmit = ip_queue_xmit, 1323 .queue_xmit = ip_queue_xmit,
1325 .send_check = tcp_v4_send_check, 1324 .send_check = tcp_v4_send_check,
1326 .rebuild_header = inet_sk_rebuild_header, 1325 .rebuild_header = inet_sk_rebuild_header,
1327 .conn_request = tcp_v6_conn_request, 1326 .conn_request = tcp_v6_conn_request,
1328 .syn_recv_sock = tcp_v6_syn_recv_sock, 1327 .syn_recv_sock = tcp_v6_syn_recv_sock,
1329 .remember_stamp = tcp_v4_remember_stamp, 1328 .remember_stamp = tcp_v4_remember_stamp,
1330 .net_header_len = sizeof(struct iphdr), 1329 .net_header_len = sizeof(struct iphdr),
1331 1330 .setsockopt = ipv6_setsockopt,
1332 .setsockopt = ipv6_setsockopt, 1331 .getsockopt = ipv6_getsockopt,
1333 .getsockopt = ipv6_getsockopt, 1332 .addr2sockaddr = inet6_csk_addr2sockaddr,
1333 .sockaddr_len = sizeof(struct sockaddr_in6),
1334#ifdef CONFIG_COMPAT 1334#ifdef CONFIG_COMPAT
1335 .compat_setsockopt = compat_ipv6_setsockopt, 1335 .compat_setsockopt = compat_ipv6_setsockopt,
1336 .compat_getsockopt = compat_ipv6_getsockopt, 1336 .compat_getsockopt = compat_ipv6_getsockopt,
1337#endif 1337#endif
1338 .addr2sockaddr = inet6_csk_addr2sockaddr,
1339 .sockaddr_len = sizeof(struct sockaddr_in6)
1340}; 1338};
1341 1339
1342
1343
1344/* NOTE: A lot of things set to zero explicitly by call to 1340/* NOTE: A lot of things set to zero explicitly by call to
1345 * sk_alloc() so need not be done here. 1341 * sk_alloc() so need not be done here.
1346 */ 1342 */
@@ -1574,10 +1570,6 @@ struct proto tcpv6_prot = {
1574 .shutdown = tcp_shutdown, 1570 .shutdown = tcp_shutdown,
1575 .setsockopt = tcp_setsockopt, 1571 .setsockopt = tcp_setsockopt,
1576 .getsockopt = tcp_getsockopt, 1572 .getsockopt = tcp_getsockopt,
1577#ifdef CONFIG_COMPAT
1578 .compat_setsockopt = compat_tcp_setsockopt,
1579 .compat_getsockopt = compat_tcp_getsockopt,
1580#endif
1581 .sendmsg = tcp_sendmsg, 1573 .sendmsg = tcp_sendmsg,
1582 .recvmsg = tcp_recvmsg, 1574 .recvmsg = tcp_recvmsg,
1583 .backlog_rcv = tcp_v6_do_rcv, 1575 .backlog_rcv = tcp_v6_do_rcv,
@@ -1596,6 +1588,10 @@ struct proto tcpv6_prot = {
1596 .obj_size = sizeof(struct tcp6_sock), 1588 .obj_size = sizeof(struct tcp6_sock),
1597 .twsk_prot = &tcp6_timewait_sock_ops, 1589 .twsk_prot = &tcp6_timewait_sock_ops,
1598 .rsk_prot = &tcp6_request_sock_ops, 1590 .rsk_prot = &tcp6_request_sock_ops,
1591#ifdef CONFIG_COMPAT
1592 .compat_setsockopt = compat_tcp_setsockopt,
1593 .compat_getsockopt = compat_tcp_getsockopt,
1594#endif
1599}; 1595};
1600 1596
1601static struct inet6_protocol tcpv6_protocol = { 1597static struct inet6_protocol tcpv6_protocol = {
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 538ada00646a..8d3432a70f3a 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -934,11 +934,11 @@ static int udpv6_setsockopt(struct sock *sk, int level, int optname,
934 934
935#ifdef CONFIG_COMPAT 935#ifdef CONFIG_COMPAT
936static int compat_udpv6_setsockopt(struct sock *sk, int level, int optname, 936static int compat_udpv6_setsockopt(struct sock *sk, int level, int optname,
937 char __user *optval, int optlen) 937 char __user *optval, int optlen)
938{ 938{
939 if (level != SOL_UDP) 939 if (level != SOL_UDP)
940 return compat_ipv6_setsockopt(sk, level, 940 return compat_ipv6_setsockopt(sk, level, optname,
941 optname, optval, optlen); 941 optval, optlen);
942 return do_udpv6_setsockopt(sk, level, optname, optval, optlen); 942 return do_udpv6_setsockopt(sk, level, optname, optval, optlen);
943} 943}
944#endif 944#endif
@@ -987,11 +987,11 @@ static int udpv6_getsockopt(struct sock *sk, int level, int optname,
987 987
988#ifdef CONFIG_COMPAT 988#ifdef CONFIG_COMPAT
989static int compat_udpv6_getsockopt(struct sock *sk, int level, int optname, 989static int compat_udpv6_getsockopt(struct sock *sk, int level, int optname,
990 char __user *optval, int __user *optlen) 990 char __user *optval, int __user *optlen)
991{ 991{
992 if (level != SOL_UDP) 992 if (level != SOL_UDP)
993 return compat_ipv6_getsockopt(sk, level, 993 return compat_ipv6_getsockopt(sk, level, optname,
994 optname, optval, optlen); 994 optval, optlen);
995 return do_udpv6_getsockopt(sk, level, optname, optval, optlen); 995 return do_udpv6_getsockopt(sk, level, optname, optval, optlen);
996} 996}
997#endif 997#endif
@@ -1069,26 +1069,26 @@ void udp6_proc_exit(void) {
1069/* ------------------------------------------------------------------------ */ 1069/* ------------------------------------------------------------------------ */
1070 1070
1071struct proto udpv6_prot = { 1071struct proto udpv6_prot = {
1072 .name = "UDPv6", 1072 .name = "UDPv6",
1073 .owner = THIS_MODULE, 1073 .owner = THIS_MODULE,
1074 .close = udpv6_close, 1074 .close = udpv6_close,
1075 .connect = ip6_datagram_connect, 1075 .connect = ip6_datagram_connect,
1076 .disconnect = udp_disconnect, 1076 .disconnect = udp_disconnect,
1077 .ioctl = udp_ioctl, 1077 .ioctl = udp_ioctl,
1078 .destroy = udpv6_destroy_sock, 1078 .destroy = udpv6_destroy_sock,
1079 .setsockopt = udpv6_setsockopt, 1079 .setsockopt = udpv6_setsockopt,
1080 .getsockopt = udpv6_getsockopt, 1080 .getsockopt = udpv6_getsockopt,
1081 .sendmsg = udpv6_sendmsg,
1082 .recvmsg = udpv6_recvmsg,
1083 .backlog_rcv = udpv6_queue_rcv_skb,
1084 .hash = udp_v6_hash,
1085 .unhash = udp_v6_unhash,
1086 .get_port = udp_v6_get_port,
1087 .obj_size = sizeof(struct udp6_sock),
1081#ifdef CONFIG_COMPAT 1088#ifdef CONFIG_COMPAT
1082 .compat_setsockopt = compat_udpv6_setsockopt, 1089 .compat_setsockopt = compat_udpv6_setsockopt,
1083 .compat_getsockopt = compat_udpv6_getsockopt, 1090 .compat_getsockopt = compat_udpv6_getsockopt,
1084#endif 1091#endif
1085 .sendmsg = udpv6_sendmsg,
1086 .recvmsg = udpv6_recvmsg,
1087 .backlog_rcv = udpv6_queue_rcv_skb,
1088 .hash = udp_v6_hash,
1089 .unhash = udp_v6_unhash,
1090 .get_port = udp_v6_get_port,
1091 .obj_size = sizeof(struct udp6_sock),
1092}; 1092};
1093 1093
1094static struct inet_protosw udpv6_protosw = { 1094static struct inet_protosw udpv6_protosw = {
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c
index da1cd48de216..0a63d7dac7be 100644
--- a/net/netfilter/nf_sockopt.c
+++ b/net/netfilter/nf_sockopt.c
@@ -133,7 +133,7 @@ EXPORT_SYMBOL(nf_getsockopt);
133 133
134#ifdef CONFIG_COMPAT 134#ifdef CONFIG_COMPAT
135static int compat_nf_sockopt(struct sock *sk, int pf, int val, 135static int compat_nf_sockopt(struct sock *sk, int pf, int val,
136 char __user *opt, int *len, int get) 136 char __user *opt, int *len, int get)
137{ 137{
138 struct list_head *i; 138 struct list_head *i;
139 struct nf_sockopt_ops *ops; 139 struct nf_sockopt_ops *ops;
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index bbee14d01c9b..c20d282fac06 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -861,27 +861,27 @@ static int sctp_inet6_supported_addrs(const struct sctp_sock *opt,
861} 861}
862 862
863static const struct proto_ops inet6_seqpacket_ops = { 863static const struct proto_ops inet6_seqpacket_ops = {
864 .family = PF_INET6, 864 .family = PF_INET6,
865 .owner = THIS_MODULE, 865 .owner = THIS_MODULE,
866 .release = inet6_release, 866 .release = inet6_release,
867 .bind = inet6_bind, 867 .bind = inet6_bind,
868 .connect = inet_dgram_connect, 868 .connect = inet_dgram_connect,
869 .socketpair = sock_no_socketpair, 869 .socketpair = sock_no_socketpair,
870 .accept = inet_accept, 870 .accept = inet_accept,
871 .getname = inet6_getname, 871 .getname = inet6_getname,
872 .poll = sctp_poll, 872 .poll = sctp_poll,
873 .ioctl = inet6_ioctl, 873 .ioctl = inet6_ioctl,
874 .listen = sctp_inet_listen, 874 .listen = sctp_inet_listen,
875 .shutdown = inet_shutdown, 875 .shutdown = inet_shutdown,
876 .setsockopt = sock_common_setsockopt, 876 .setsockopt = sock_common_setsockopt,
877 .getsockopt = sock_common_getsockopt, 877 .getsockopt = sock_common_getsockopt,
878 .sendmsg = inet_sendmsg,
879 .recvmsg = sock_common_recvmsg,
880 .mmap = sock_no_mmap,
878#ifdef CONFIG_COMPAT 881#ifdef CONFIG_COMPAT
879 .compat_setsockopt = compat_sock_common_setsockopt, 882 .compat_setsockopt = compat_sock_common_setsockopt,
880 .compat_getsockopt = compat_sock_common_getsockopt, 883 .compat_getsockopt = compat_sock_common_getsockopt,
881#endif 884#endif
882 .sendmsg = inet_sendmsg,
883 .recvmsg = sock_common_recvmsg,
884 .mmap = sock_no_mmap,
885}; 885};
886 886
887static struct inet_protosw sctpv6_seqpacket_protosw = { 887static struct inet_protosw sctpv6_seqpacket_protosw = {
@@ -915,35 +915,35 @@ static struct inet6_protocol sctpv6_protocol = {
915}; 915};
916 916
917static struct sctp_af sctp_ipv6_specific = { 917static struct sctp_af sctp_ipv6_specific = {
918 .sctp_xmit = sctp_v6_xmit, 918 .sa_family = AF_INET6,
919 .setsockopt = ipv6_setsockopt, 919 .sctp_xmit = sctp_v6_xmit,
920 .getsockopt = ipv6_getsockopt, 920 .setsockopt = ipv6_setsockopt,
921 .getsockopt = ipv6_getsockopt,
922 .get_dst = sctp_v6_get_dst,
923 .get_saddr = sctp_v6_get_saddr,
924 .copy_addrlist = sctp_v6_copy_addrlist,
925 .from_skb = sctp_v6_from_skb,
926 .from_sk = sctp_v6_from_sk,
927 .to_sk_saddr = sctp_v6_to_sk_saddr,
928 .to_sk_daddr = sctp_v6_to_sk_daddr,
929 .from_addr_param = sctp_v6_from_addr_param,
930 .to_addr_param = sctp_v6_to_addr_param,
931 .dst_saddr = sctp_v6_dst_saddr,
932 .cmp_addr = sctp_v6_cmp_addr,
933 .scope = sctp_v6_scope,
934 .addr_valid = sctp_v6_addr_valid,
935 .inaddr_any = sctp_v6_inaddr_any,
936 .is_any = sctp_v6_is_any,
937 .available = sctp_v6_available,
938 .skb_iif = sctp_v6_skb_iif,
939 .is_ce = sctp_v6_is_ce,
940 .seq_dump_addr = sctp_v6_seq_dump_addr,
941 .net_header_len = sizeof(struct ipv6hdr),
942 .sockaddr_len = sizeof(struct sockaddr_in6),
921#ifdef CONFIG_COMPAT 943#ifdef CONFIG_COMPAT
922 .compat_setsockopt = compat_ipv6_setsockopt, 944 .compat_setsockopt = compat_ipv6_setsockopt,
923 .compat_getsockopt = compat_ipv6_getsockopt, 945 .compat_getsockopt = compat_ipv6_getsockopt,
924#endif 946#endif
925 .get_dst = sctp_v6_get_dst,
926 .get_saddr = sctp_v6_get_saddr,
927 .copy_addrlist = sctp_v6_copy_addrlist,
928 .from_skb = sctp_v6_from_skb,
929 .from_sk = sctp_v6_from_sk,
930 .to_sk_saddr = sctp_v6_to_sk_saddr,
931 .to_sk_daddr = sctp_v6_to_sk_daddr,
932 .from_addr_param = sctp_v6_from_addr_param,
933 .to_addr_param = sctp_v6_to_addr_param,
934 .dst_saddr = sctp_v6_dst_saddr,
935 .cmp_addr = sctp_v6_cmp_addr,
936 .scope = sctp_v6_scope,
937 .addr_valid = sctp_v6_addr_valid,
938 .inaddr_any = sctp_v6_inaddr_any,
939 .is_any = sctp_v6_is_any,
940 .available = sctp_v6_available,
941 .skb_iif = sctp_v6_skb_iif,
942 .is_ce = sctp_v6_is_ce,
943 .seq_dump_addr = sctp_v6_seq_dump_addr,
944 .net_header_len = sizeof(struct ipv6hdr),
945 .sockaddr_len = sizeof(struct sockaddr_in6),
946 .sa_family = AF_INET6,
947}; 947};
948 948
949static struct sctp_pf sctp_pf_inet6_specific = { 949static struct sctp_pf sctp_pf_inet6_specific = {
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index d90f5491870f..2088aa992b7a 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -831,28 +831,28 @@ static struct notifier_block sctp_inetaddr_notifier = {
831 831
832/* Socket operations. */ 832/* Socket operations. */
833static const struct proto_ops inet_seqpacket_ops = { 833static const struct proto_ops inet_seqpacket_ops = {
834 .family = PF_INET, 834 .family = PF_INET,
835 .owner = THIS_MODULE, 835 .owner = THIS_MODULE,
836 .release = inet_release, /* Needs to be wrapped... */ 836 .release = inet_release, /* Needs to be wrapped... */
837 .bind = inet_bind, 837 .bind = inet_bind,
838 .connect = inet_dgram_connect, 838 .connect = inet_dgram_connect,
839 .socketpair = sock_no_socketpair, 839 .socketpair = sock_no_socketpair,
840 .accept = inet_accept, 840 .accept = inet_accept,
841 .getname = inet_getname, /* Semantics are different. */ 841 .getname = inet_getname, /* Semantics are different. */
842 .poll = sctp_poll, 842 .poll = sctp_poll,
843 .ioctl = inet_ioctl, 843 .ioctl = inet_ioctl,
844 .listen = sctp_inet_listen, 844 .listen = sctp_inet_listen,
845 .shutdown = inet_shutdown, /* Looks harmless. */ 845 .shutdown = inet_shutdown, /* Looks harmless. */
846 .setsockopt = sock_common_setsockopt, /* IP_SOL IP_OPTION is a problem. */ 846 .setsockopt = sock_common_setsockopt, /* IP_SOL IP_OPTION is a problem */
847 .getsockopt = sock_common_getsockopt, 847 .getsockopt = sock_common_getsockopt,
848 .sendmsg = inet_sendmsg,
849 .recvmsg = sock_common_recvmsg,
850 .mmap = sock_no_mmap,
851 .sendpage = sock_no_sendpage,
848#ifdef CONFIG_COMPAT 852#ifdef CONFIG_COMPAT
849 .compat_setsockopt = compat_sock_common_setsockopt, 853 .compat_setsockopt = compat_sock_common_setsockopt,
850 .compat_getsockopt = compat_sock_common_getsockopt, 854 .compat_getsockopt = compat_sock_common_getsockopt,
851#endif 855#endif
852 .sendmsg = inet_sendmsg,
853 .recvmsg = sock_common_recvmsg,
854 .mmap = sock_no_mmap,
855 .sendpage = sock_no_sendpage,
856}; 856};
857 857
858/* Registration with AF_INET family. */ 858/* Registration with AF_INET family. */
@@ -884,35 +884,35 @@ static struct net_protocol sctp_protocol = {
884 884
885/* IPv4 address related functions. */ 885/* IPv4 address related functions. */
886static struct sctp_af sctp_ipv4_specific = { 886static struct sctp_af sctp_ipv4_specific = {
887 .sctp_xmit = sctp_v4_xmit, 887 .sa_family = AF_INET,
888 .setsockopt = ip_setsockopt, 888 .sctp_xmit = sctp_v4_xmit,
889 .getsockopt = ip_getsockopt, 889 .setsockopt = ip_setsockopt,
890 .getsockopt = ip_getsockopt,
891 .get_dst = sctp_v4_get_dst,
892 .get_saddr = sctp_v4_get_saddr,
893 .copy_addrlist = sctp_v4_copy_addrlist,
894 .from_skb = sctp_v4_from_skb,
895 .from_sk = sctp_v4_from_sk,
896 .to_sk_saddr = sctp_v4_to_sk_saddr,
897 .to_sk_daddr = sctp_v4_to_sk_daddr,
898 .from_addr_param = sctp_v4_from_addr_param,
899 .to_addr_param = sctp_v4_to_addr_param,
900 .dst_saddr = sctp_v4_dst_saddr,
901 .cmp_addr = sctp_v4_cmp_addr,
902 .addr_valid = sctp_v4_addr_valid,
903 .inaddr_any = sctp_v4_inaddr_any,
904 .is_any = sctp_v4_is_any,
905 .available = sctp_v4_available,
906 .scope = sctp_v4_scope,
907 .skb_iif = sctp_v4_skb_iif,
908 .is_ce = sctp_v4_is_ce,
909 .seq_dump_addr = sctp_v4_seq_dump_addr,
910 .net_header_len = sizeof(struct iphdr),
911 .sockaddr_len = sizeof(struct sockaddr_in),
890#ifdef CONFIG_COMPAT 912#ifdef CONFIG_COMPAT
891 .compat_setsockopt = compat_ip_setsockopt, 913 .compat_setsockopt = compat_ip_setsockopt,
892 .compat_getsockopt = compat_ip_getsockopt, 914 .compat_getsockopt = compat_ip_getsockopt,
893#endif 915#endif
894 .get_dst = sctp_v4_get_dst,
895 .get_saddr = sctp_v4_get_saddr,
896 .copy_addrlist = sctp_v4_copy_addrlist,
897 .from_skb = sctp_v4_from_skb,
898 .from_sk = sctp_v4_from_sk,
899 .to_sk_saddr = sctp_v4_to_sk_saddr,
900 .to_sk_daddr = sctp_v4_to_sk_daddr,
901 .from_addr_param= sctp_v4_from_addr_param,
902 .to_addr_param = sctp_v4_to_addr_param,
903 .dst_saddr = sctp_v4_dst_saddr,
904 .cmp_addr = sctp_v4_cmp_addr,
905 .addr_valid = sctp_v4_addr_valid,
906 .inaddr_any = sctp_v4_inaddr_any,
907 .is_any = sctp_v4_is_any,
908 .available = sctp_v4_available,
909 .scope = sctp_v4_scope,
910 .skb_iif = sctp_v4_skb_iif,
911 .is_ce = sctp_v4_is_ce,
912 .seq_dump_addr = sctp_v4_seq_dump_addr,
913 .net_header_len = sizeof(struct iphdr),
914 .sockaddr_len = sizeof(struct sockaddr_in),
915 .sa_family = AF_INET,
916}; 916};
917 917
918struct sctp_pf *sctp_get_pf_specific(sa_family_t family) { 918struct sctp_pf *sctp_get_pf_specific(sa_family_t family) {