diff options
author | Remi Denis-Courmont <remi.denis-courmont@nokia.com> | 2008-09-22 23:09:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-09-22 23:09:13 -0400 |
commit | be0c52bfed7f7828494fa00060efd5d758e92580 (patch) | |
tree | 1261d101dee4c1d440d1d90c974c62339a556843 /include | |
parent | 87ab4e20b445c6d2d2727ab4f96fa17f7259511e (diff) |
Phonet: emit errors when a packet cannot be delivered locally
When there is no listener socket for a received packet, send an error
back to the sender.
Signed-off-by: Remi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/phonet.h | 32 | ||||
-rw-r--r-- | include/net/phonet/phonet.h | 5 |
2 files changed, 37 insertions, 0 deletions
diff --git a/include/linux/phonet.h b/include/linux/phonet.h index 001c0e679099..3a027f588a4a 100644 --- a/include/linux/phonet.h +++ b/include/linux/phonet.h | |||
@@ -45,6 +45,38 @@ struct phonethdr { | |||
45 | __u8 pn_sobj; | 45 | __u8 pn_sobj; |
46 | } __attribute__((packed)); | 46 | } __attribute__((packed)); |
47 | 47 | ||
48 | /* Common Phonet payload header */ | ||
49 | struct phonetmsg { | ||
50 | __u8 pn_trans_id; /* transaction ID */ | ||
51 | __u8 pn_msg_id; /* message type */ | ||
52 | union { | ||
53 | struct { | ||
54 | __u8 pn_submsg_id; /* message subtype */ | ||
55 | __u8 pn_data[5]; | ||
56 | } base; | ||
57 | struct { | ||
58 | __u16 pn_e_res_id; /* extended resource ID */ | ||
59 | __u8 pn_e_submsg_id; /* message subtype */ | ||
60 | __u8 pn_e_data[3]; | ||
61 | } ext; | ||
62 | } pn_msg_u; | ||
63 | }; | ||
64 | #define PN_COMMON_MESSAGE 0xF0 | ||
65 | #define PN_PREFIX 0xE0 /* resource for extended messages */ | ||
66 | #define pn_submsg_id pn_msg_u.base.pn_submsg_id | ||
67 | #define pn_e_submsg_id pn_msg_u.ext.pn_e_submsg_id | ||
68 | #define pn_e_res_id pn_msg_u.ext.pn_e_res_id | ||
69 | #define pn_data pn_msg_u.base.pn_data | ||
70 | #define pn_e_data pn_msg_u.ext.pn_e_data | ||
71 | |||
72 | /* data for unreachable errors */ | ||
73 | #define PN_COMM_SERVICE_NOT_IDENTIFIED_RESP 0x01 | ||
74 | #define PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP 0x14 | ||
75 | #define pn_orig_msg_id pn_data[0] | ||
76 | #define pn_status pn_data[1] | ||
77 | #define pn_e_orig_msg_id pn_e_data[0] | ||
78 | #define pn_e_status pn_e_data[1] | ||
79 | |||
48 | /* Phonet socket address structure */ | 80 | /* Phonet socket address structure */ |
49 | struct sockaddr_pn { | 81 | struct sockaddr_pn { |
50 | sa_family_t spn_family; | 82 | sa_family_t spn_family; |
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h index 1c6f7e7d5fea..d4e72508e145 100644 --- a/include/net/phonet/phonet.h +++ b/include/net/phonet/phonet.h | |||
@@ -60,6 +60,11 @@ static inline struct phonethdr *pn_hdr(struct sk_buff *skb) | |||
60 | return (struct phonethdr *)skb_network_header(skb); | 60 | return (struct phonethdr *)skb_network_header(skb); |
61 | } | 61 | } |
62 | 62 | ||
63 | static inline struct phonetmsg *pn_msg(struct sk_buff *skb) | ||
64 | { | ||
65 | return (struct phonetmsg *)skb_transport_header(skb); | ||
66 | } | ||
67 | |||
63 | /* | 68 | /* |
64 | * Get the other party's sockaddr from received skb. The skb begins | 69 | * Get the other party's sockaddr from received skb. The skb begins |
65 | * with a Phonet header. | 70 | * with a Phonet header. |