diff options
Diffstat (limited to 'net/core/sock.c')
-rw-r--r-- | net/core/sock.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 76334228ed1c..30d5446512f9 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -142,7 +142,7 @@ static struct lock_class_key af_family_slock_keys[AF_MAX]; | |||
142 | * strings build-time, so that runtime initialization of socket | 142 | * strings build-time, so that runtime initialization of socket |
143 | * locks is fast): | 143 | * locks is fast): |
144 | */ | 144 | */ |
145 | static const char *af_family_key_strings[AF_MAX+1] = { | 145 | static const char *const af_family_key_strings[AF_MAX+1] = { |
146 | "sk_lock-AF_UNSPEC", "sk_lock-AF_UNIX" , "sk_lock-AF_INET" , | 146 | "sk_lock-AF_UNSPEC", "sk_lock-AF_UNIX" , "sk_lock-AF_INET" , |
147 | "sk_lock-AF_AX25" , "sk_lock-AF_IPX" , "sk_lock-AF_APPLETALK", | 147 | "sk_lock-AF_AX25" , "sk_lock-AF_IPX" , "sk_lock-AF_APPLETALK", |
148 | "sk_lock-AF_NETROM", "sk_lock-AF_BRIDGE" , "sk_lock-AF_ATMPVC" , | 148 | "sk_lock-AF_NETROM", "sk_lock-AF_BRIDGE" , "sk_lock-AF_ATMPVC" , |
@@ -158,7 +158,7 @@ static const char *af_family_key_strings[AF_MAX+1] = { | |||
158 | "sk_lock-AF_IEEE802154", | 158 | "sk_lock-AF_IEEE802154", |
159 | "sk_lock-AF_MAX" | 159 | "sk_lock-AF_MAX" |
160 | }; | 160 | }; |
161 | static const char *af_family_slock_key_strings[AF_MAX+1] = { | 161 | static const char *const af_family_slock_key_strings[AF_MAX+1] = { |
162 | "slock-AF_UNSPEC", "slock-AF_UNIX" , "slock-AF_INET" , | 162 | "slock-AF_UNSPEC", "slock-AF_UNIX" , "slock-AF_INET" , |
163 | "slock-AF_AX25" , "slock-AF_IPX" , "slock-AF_APPLETALK", | 163 | "slock-AF_AX25" , "slock-AF_IPX" , "slock-AF_APPLETALK", |
164 | "slock-AF_NETROM", "slock-AF_BRIDGE" , "slock-AF_ATMPVC" , | 164 | "slock-AF_NETROM", "slock-AF_BRIDGE" , "slock-AF_ATMPVC" , |
@@ -174,7 +174,7 @@ static const char *af_family_slock_key_strings[AF_MAX+1] = { | |||
174 | "slock-AF_IEEE802154", | 174 | "slock-AF_IEEE802154", |
175 | "slock-AF_MAX" | 175 | "slock-AF_MAX" |
176 | }; | 176 | }; |
177 | static const char *af_family_clock_key_strings[AF_MAX+1] = { | 177 | static const char *const af_family_clock_key_strings[AF_MAX+1] = { |
178 | "clock-AF_UNSPEC", "clock-AF_UNIX" , "clock-AF_INET" , | 178 | "clock-AF_UNSPEC", "clock-AF_UNIX" , "clock-AF_INET" , |
179 | "clock-AF_AX25" , "clock-AF_IPX" , "clock-AF_APPLETALK", | 179 | "clock-AF_AX25" , "clock-AF_IPX" , "clock-AF_APPLETALK", |
180 | "clock-AF_NETROM", "clock-AF_BRIDGE" , "clock-AF_ATMPVC" , | 180 | "clock-AF_NETROM", "clock-AF_BRIDGE" , "clock-AF_ATMPVC" , |
@@ -482,6 +482,8 @@ int sock_setsockopt(struct socket *sock, int level, int optname, | |||
482 | sk->sk_reuse = valbool; | 482 | sk->sk_reuse = valbool; |
483 | break; | 483 | break; |
484 | case SO_TYPE: | 484 | case SO_TYPE: |
485 | case SO_PROTOCOL: | ||
486 | case SO_DOMAIN: | ||
485 | case SO_ERROR: | 487 | case SO_ERROR: |
486 | ret = -ENOPROTOOPT; | 488 | ret = -ENOPROTOOPT; |
487 | break; | 489 | break; |
@@ -764,6 +766,14 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
764 | v.val = sk->sk_type; | 766 | v.val = sk->sk_type; |
765 | break; | 767 | break; |
766 | 768 | ||
769 | case SO_PROTOCOL: | ||
770 | v.val = sk->sk_protocol; | ||
771 | break; | ||
772 | |||
773 | case SO_DOMAIN: | ||
774 | v.val = sk->sk_family; | ||
775 | break; | ||
776 | |||
767 | case SO_ERROR: | 777 | case SO_ERROR: |
768 | v.val = -sock_error(sk); | 778 | v.val = -sock_error(sk); |
769 | if (v.val == 0) | 779 | if (v.val == 0) |