diff options
-rw-r--r-- | Documentation/networking/phonet.txt | 7 | ||||
-rw-r--r-- | include/linux/phonet.h | 2 | ||||
-rw-r--r-- | net/phonet/pep.c | 15 |
3 files changed, 12 insertions, 12 deletions
diff --git a/Documentation/networking/phonet.txt b/Documentation/networking/phonet.txt index 24ad2adba6e5..cacac968c1c3 100644 --- a/Documentation/networking/phonet.txt +++ b/Documentation/networking/phonet.txt | |||
@@ -181,6 +181,10 @@ The pipe protocol provides two socket options at the SOL_PNPIPE level: | |||
181 | interface index of the network interface created by PNPIPE_ENCAP, | 181 | interface index of the network interface created by PNPIPE_ENCAP, |
182 | or zero if encapsulation is off. | 182 | or zero if encapsulation is off. |
183 | 183 | ||
184 | PNPIPE_HANDLE is a read-only integer value. It contains the underlying | ||
185 | identifier ("pipe handle") of the pipe. This is only defined for | ||
186 | socket descriptors that are already connected or being connected. | ||
187 | |||
184 | 188 | ||
185 | Phonet Pipe-controller Implementation | 189 | Phonet Pipe-controller Implementation |
186 | ------------------------------------- | 190 | ------------------------------------- |
@@ -199,9 +203,6 @@ between itself and a remote pipe-end point (e.g. modem). | |||
199 | 203 | ||
200 | The implementation adds socket options at SOL_PNPIPE level: | 204 | The implementation adds socket options at SOL_PNPIPE level: |
201 | 205 | ||
202 | PNPIPE_PIPE_HANDLE | ||
203 | It accepts an integer argument for setting value of pipe handle. | ||
204 | |||
205 | PNPIPE_ENABLE accepts one integer value (int). If set to zero, the pipe | 206 | PNPIPE_ENABLE accepts one integer value (int). If set to zero, the pipe |
206 | is disabled. If the value is non-zero, the pipe is enabled. If the pipe | 207 | is disabled. If the value is non-zero, the pipe is enabled. If the pipe |
207 | is not (yet) connected, ENOTCONN is error is returned. | 208 | is not (yet) connected, ENOTCONN is error is returned. |
diff --git a/include/linux/phonet.h b/include/linux/phonet.h index 26c8df786918..32a0965da953 100644 --- a/include/linux/phonet.h +++ b/include/linux/phonet.h | |||
@@ -36,7 +36,7 @@ | |||
36 | /* Socket options for SOL_PNPIPE level */ | 36 | /* Socket options for SOL_PNPIPE level */ |
37 | #define PNPIPE_ENCAP 1 | 37 | #define PNPIPE_ENCAP 1 |
38 | #define PNPIPE_IFINDEX 2 | 38 | #define PNPIPE_IFINDEX 2 |
39 | #define PNPIPE_PIPE_HANDLE 3 | 39 | #define PNPIPE_HANDLE 3 |
40 | #define PNPIPE_ENABLE 4 | 40 | #define PNPIPE_ENABLE 4 |
41 | /* unused slot */ | 41 | /* unused slot */ |
42 | 42 | ||
diff --git a/net/phonet/pep.c b/net/phonet/pep.c index c0fab4cfcef7..abfb795af142 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c | |||
@@ -853,6 +853,7 @@ static int pep_sock_connect(struct sock *sk, struct sockaddr *addr, int len) | |||
853 | 853 | ||
854 | pn->pn_sk.dobject = pn_sockaddr_get_object(spn); | 854 | pn->pn_sk.dobject = pn_sockaddr_get_object(spn); |
855 | pn->pn_sk.resource = pn_sockaddr_get_resource(spn); | 855 | pn->pn_sk.resource = pn_sockaddr_get_resource(spn); |
856 | pn->pipe_handle = 1; /* anything but INVALID_HANDLE */ | ||
856 | return pipe_handler_request(sk, PNS_PEP_CONNECT_REQ, | 857 | return pipe_handler_request(sk, PNS_PEP_CONNECT_REQ, |
857 | PN_PIPE_DISABLE, data, 4); | 858 | PN_PIPE_DISABLE, data, 4); |
858 | } | 859 | } |
@@ -909,14 +910,6 @@ static int pep_setsockopt(struct sock *sk, int level, int optname, | |||
909 | 910 | ||
910 | lock_sock(sk); | 911 | lock_sock(sk); |
911 | switch (optname) { | 912 | switch (optname) { |
912 | #ifdef CONFIG_PHONET_PIPECTRLR | ||
913 | case PNPIPE_PIPE_HANDLE: | ||
914 | if (val) { | ||
915 | pn->pipe_handle = val; | ||
916 | break; | ||
917 | } | ||
918 | #endif | ||
919 | |||
920 | case PNPIPE_ENCAP: | 913 | case PNPIPE_ENCAP: |
921 | if (val && val != PNPIPE_ENCAP_IP) { | 914 | if (val && val != PNPIPE_ENCAP_IP) { |
922 | err = -EINVAL; | 915 | err = -EINVAL; |
@@ -982,6 +975,12 @@ static int pep_getsockopt(struct sock *sk, int level, int optname, | |||
982 | val = pn->ifindex; | 975 | val = pn->ifindex; |
983 | break; | 976 | break; |
984 | 977 | ||
978 | case PNPIPE_HANDLE: | ||
979 | val = pn->pipe_handle; | ||
980 | if (val == PN_PIPE_INVALID_HANDLE) | ||
981 | return -EINVAL; | ||
982 | break; | ||
983 | |||
985 | #ifdef CONFIG_PHONET_PIPECTRLR | 984 | #ifdef CONFIG_PHONET_PIPECTRLR |
986 | case PNPIPE_ENABLE: | 985 | case PNPIPE_ENABLE: |
987 | val = sk->sk_state == TCP_ESTABLISHED; | 986 | val = sk->sk_state == TCP_ESTABLISHED; |