diff options
| author | Alexey Dobriyan <adobriyan@gmail.com> | 2005-09-23 02:45:24 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2005-09-23 02:45:24 -0400 |
| commit | 67497205b12e3cb408259cc09b50c3a9d12cd935 (patch) | |
| tree | b06cc4b76736ca7df03717f30ff57cab8848ab2a | |
| parent | 0ae5d253adcc467b1c52b512bbca9419eb438409 (diff) | |
[NETFILTER] Fix sparse endian warnings in pptp helper
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | include/linux/netfilter_ipv4/ip_conntrack_pptp.h | 118 | ||||
| -rw-r--r-- | include/linux/netfilter_ipv4/ip_conntrack_tuple.h | 6 | ||||
| -rw-r--r-- | net/ipv4/netfilter/ip_conntrack_helper_pptp.c | 14 |
3 files changed, 70 insertions, 68 deletions
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h index 389e3851d52f..50a761db5a04 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h | |||
| @@ -60,8 +60,8 @@ struct ip_ct_pptp_expect { | |||
| 60 | 60 | ||
| 61 | struct pptp_pkt_hdr { | 61 | struct pptp_pkt_hdr { |
| 62 | __u16 packetLength; | 62 | __u16 packetLength; |
| 63 | __u16 packetType; | 63 | __be16 packetType; |
| 64 | __u32 magicCookie; | 64 | __be32 magicCookie; |
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | /* PptpControlMessageType values */ | 67 | /* PptpControlMessageType values */ |
| @@ -93,7 +93,7 @@ struct pptp_pkt_hdr { | |||
| 93 | #define PPTP_REMOVE_DEVICE_ERROR 6 | 93 | #define PPTP_REMOVE_DEVICE_ERROR 6 |
| 94 | 94 | ||
| 95 | struct PptpControlHeader { | 95 | struct PptpControlHeader { |
| 96 | __u16 messageType; | 96 | __be16 messageType; |
| 97 | __u16 reserved; | 97 | __u16 reserved; |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| @@ -106,13 +106,13 @@ struct PptpControlHeader { | |||
| 106 | #define PPTP_BEARER_CAP_DIGITAL 0x2 | 106 | #define PPTP_BEARER_CAP_DIGITAL 0x2 |
| 107 | 107 | ||
| 108 | struct PptpStartSessionRequest { | 108 | struct PptpStartSessionRequest { |
| 109 | __u16 protocolVersion; | 109 | __be16 protocolVersion; |
| 110 | __u8 reserved1; | 110 | __u8 reserved1; |
| 111 | __u8 reserved2; | 111 | __u8 reserved2; |
| 112 | __u32 framingCapability; | 112 | __be32 framingCapability; |
| 113 | __u32 bearerCapability; | 113 | __be32 bearerCapability; |
| 114 | __u16 maxChannels; | 114 | __be16 maxChannels; |
| 115 | __u16 firmwareRevision; | 115 | __be16 firmwareRevision; |
| 116 | __u8 hostName[64]; | 116 | __u8 hostName[64]; |
| 117 | __u8 vendorString[64]; | 117 | __u8 vendorString[64]; |
| 118 | }; | 118 | }; |
| @@ -125,13 +125,13 @@ struct PptpStartSessionRequest { | |||
| 125 | #define PPTP_START_UNKNOWN_PROTOCOL 5 | 125 | #define PPTP_START_UNKNOWN_PROTOCOL 5 |
| 126 | 126 | ||
| 127 | struct PptpStartSessionReply { | 127 | struct PptpStartSessionReply { |
| 128 | __u16 protocolVersion; | 128 | __be16 protocolVersion; |
| 129 | __u8 resultCode; | 129 | __u8 resultCode; |
| 130 | __u8 generalErrorCode; | 130 | __u8 generalErrorCode; |
| 131 | __u32 framingCapability; | 131 | __be32 framingCapability; |
| 132 | __u32 bearerCapability; | 132 | __be32 bearerCapability; |
| 133 | __u16 maxChannels; | 133 | __be16 maxChannels; |
| 134 | __u16 firmwareRevision; | 134 | __be16 firmwareRevision; |
| 135 | __u8 hostName[64]; | 135 | __u8 hostName[64]; |
| 136 | __u8 vendorString[64]; | 136 | __u8 vendorString[64]; |
| 137 | }; | 137 | }; |
| @@ -155,7 +155,7 @@ struct PptpStopSessionReply { | |||
| 155 | }; | 155 | }; |
| 156 | 156 | ||
| 157 | struct PptpEchoRequest { | 157 | struct PptpEchoRequest { |
| 158 | __u32 identNumber; | 158 | __be32 identNumber; |
| 159 | }; | 159 | }; |
| 160 | 160 | ||
| 161 | /* PptpEchoReplyResultCode */ | 161 | /* PptpEchoReplyResultCode */ |
| @@ -163,7 +163,7 @@ struct PptpEchoRequest { | |||
| 163 | #define PPTP_ECHO_GENERAL_ERROR 2 | 163 | #define PPTP_ECHO_GENERAL_ERROR 2 |
| 164 | 164 | ||
| 165 | struct PptpEchoReply { | 165 | struct PptpEchoReply { |
| 166 | __u32 identNumber; | 166 | __be32 identNumber; |
| 167 | __u8 resultCode; | 167 | __u8 resultCode; |
| 168 | __u8 generalErrorCode; | 168 | __u8 generalErrorCode; |
| 169 | __u16 reserved; | 169 | __u16 reserved; |
| @@ -180,16 +180,16 @@ struct PptpEchoReply { | |||
| 180 | #define PPTP_DONT_CARE_BEARER_TYPE 3 | 180 | #define PPTP_DONT_CARE_BEARER_TYPE 3 |
| 181 | 181 | ||
| 182 | struct PptpOutCallRequest { | 182 | struct PptpOutCallRequest { |
| 183 | __u16 callID; | 183 | __be16 callID; |
| 184 | __u16 callSerialNumber; | 184 | __be16 callSerialNumber; |
| 185 | __u32 minBPS; | 185 | __be32 minBPS; |
| 186 | __u32 maxBPS; | 186 | __be32 maxBPS; |
| 187 | __u32 bearerType; | 187 | __be32 bearerType; |
| 188 | __u32 framingType; | 188 | __be32 framingType; |
| 189 | __u16 packetWindow; | 189 | __be16 packetWindow; |
| 190 | __u16 packetProcDelay; | 190 | __be16 packetProcDelay; |
| 191 | __u16 reserved1; | 191 | __u16 reserved1; |
| 192 | __u16 phoneNumberLength; | 192 | __be16 phoneNumberLength; |
| 193 | __u16 reserved2; | 193 | __u16 reserved2; |
| 194 | __u8 phoneNumber[64]; | 194 | __u8 phoneNumber[64]; |
| 195 | __u8 subAddress[64]; | 195 | __u8 subAddress[64]; |
| @@ -205,24 +205,24 @@ struct PptpOutCallRequest { | |||
| 205 | #define PPTP_OUTCALL_DONT_ACCEPT 7 | 205 | #define PPTP_OUTCALL_DONT_ACCEPT 7 |
| 206 | 206 | ||
| 207 | struct PptpOutCallReply { | 207 | struct PptpOutCallReply { |
| 208 | __u16 callID; | 208 | __be16 callID; |
| 209 | __u16 peersCallID; | 209 | __be16 peersCallID; |
| 210 | __u8 resultCode; | 210 | __u8 resultCode; |
| 211 | __u8 generalErrorCode; | 211 | __u8 generalErrorCode; |
| 212 | __u16 causeCode; | 212 | __be16 causeCode; |
| 213 | __u32 connectSpeed; | 213 | __be32 connectSpeed; |
| 214 | __u16 packetWindow; | 214 | __be16 packetWindow; |
| 215 | __u16 packetProcDelay; | 215 | __be16 packetProcDelay; |
| 216 | __u32 physChannelID; | 216 | __be32 physChannelID; |
| 217 | }; | 217 | }; |
| 218 | 218 | ||
| 219 | struct PptpInCallRequest { | 219 | struct PptpInCallRequest { |
| 220 | __u16 callID; | 220 | __be16 callID; |
| 221 | __u16 callSerialNumber; | 221 | __be16 callSerialNumber; |
| 222 | __u32 callBearerType; | 222 | __be32 callBearerType; |
| 223 | __u32 physChannelID; | 223 | __be32 physChannelID; |
| 224 | __u16 dialedNumberLength; | 224 | __be16 dialedNumberLength; |
| 225 | __u16 dialingNumberLength; | 225 | __be16 dialingNumberLength; |
| 226 | __u8 dialedNumber[64]; | 226 | __u8 dialedNumber[64]; |
| 227 | __u8 dialingNumber[64]; | 227 | __u8 dialingNumber[64]; |
| 228 | __u8 subAddress[64]; | 228 | __u8 subAddress[64]; |
| @@ -234,54 +234,54 @@ struct PptpInCallRequest { | |||
| 234 | #define PPTP_INCALL_DONT_ACCEPT 3 | 234 | #define PPTP_INCALL_DONT_ACCEPT 3 |
| 235 | 235 | ||
| 236 | struct PptpInCallReply { | 236 | struct PptpInCallReply { |
| 237 | __u16 callID; | 237 | __be16 callID; |
| 238 | __u16 peersCallID; | 238 | __be16 peersCallID; |
| 239 | __u8 resultCode; | 239 | __u8 resultCode; |
| 240 | __u8 generalErrorCode; | 240 | __u8 generalErrorCode; |
| 241 | __u16 packetWindow; | 241 | __be16 packetWindow; |
| 242 | __u16 packetProcDelay; | 242 | __be16 packetProcDelay; |
| 243 | __u16 reserved; | 243 | __u16 reserved; |
| 244 | }; | 244 | }; |
| 245 | 245 | ||
| 246 | struct PptpInCallConnected { | 246 | struct PptpInCallConnected { |
| 247 | __u16 peersCallID; | 247 | __be16 peersCallID; |
| 248 | __u16 reserved; | 248 | __u16 reserved; |
| 249 | __u32 connectSpeed; | 249 | __be32 connectSpeed; |
| 250 | __u16 packetWindow; | 250 | __be16 packetWindow; |
| 251 | __u16 packetProcDelay; | 251 | __be16 packetProcDelay; |
| 252 | __u32 callFramingType; | 252 | __be32 callFramingType; |
| 253 | }; | 253 | }; |
| 254 | 254 | ||
| 255 | struct PptpClearCallRequest { | 255 | struct PptpClearCallRequest { |
| 256 | __u16 callID; | 256 | __be16 callID; |
| 257 | __u16 reserved; | 257 | __u16 reserved; |
| 258 | }; | 258 | }; |
| 259 | 259 | ||
| 260 | struct PptpCallDisconnectNotify { | 260 | struct PptpCallDisconnectNotify { |
| 261 | __u16 callID; | 261 | __be16 callID; |
| 262 | __u8 resultCode; | 262 | __u8 resultCode; |
| 263 | __u8 generalErrorCode; | 263 | __u8 generalErrorCode; |
| 264 | __u16 causeCode; | 264 | __be16 causeCode; |
| 265 | __u16 reserved; | 265 | __u16 reserved; |
| 266 | __u8 callStatistics[128]; | 266 | __u8 callStatistics[128]; |
| 267 | }; | 267 | }; |
| 268 | 268 | ||
| 269 | struct PptpWanErrorNotify { | 269 | struct PptpWanErrorNotify { |
| 270 | __u16 peersCallID; | 270 | __be16 peersCallID; |
| 271 | __u16 reserved; | 271 | __u16 reserved; |
| 272 | __u32 crcErrors; | 272 | __be32 crcErrors; |
| 273 | __u32 framingErrors; | 273 | __be32 framingErrors; |
| 274 | __u32 hardwareOverRuns; | 274 | __be32 hardwareOverRuns; |
| 275 | __u32 bufferOverRuns; | 275 | __be32 bufferOverRuns; |
| 276 | __u32 timeoutErrors; | 276 | __be32 timeoutErrors; |
| 277 | __u32 alignmentErrors; | 277 | __be32 alignmentErrors; |
| 278 | }; | 278 | }; |
| 279 | 279 | ||
| 280 | struct PptpSetLinkInfo { | 280 | struct PptpSetLinkInfo { |
| 281 | __u16 peersCallID; | 281 | __be16 peersCallID; |
| 282 | __u16 reserved; | 282 | __u16 reserved; |
| 283 | __u32 sendAccm; | 283 | __be32 sendAccm; |
| 284 | __u32 recvAccm; | 284 | __be32 recvAccm; |
| 285 | }; | 285 | }; |
| 286 | 286 | ||
| 287 | 287 | ||
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h index 14dc0f7b6556..20e43f018b7c 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h | |||
| @@ -17,7 +17,7 @@ union ip_conntrack_manip_proto | |||
| 17 | u_int16_t all; | 17 | u_int16_t all; |
| 18 | 18 | ||
| 19 | struct { | 19 | struct { |
| 20 | u_int16_t port; | 20 | __be16 port; |
| 21 | } tcp; | 21 | } tcp; |
| 22 | struct { | 22 | struct { |
| 23 | u_int16_t port; | 23 | u_int16_t port; |
| @@ -29,7 +29,7 @@ union ip_conntrack_manip_proto | |||
| 29 | u_int16_t port; | 29 | u_int16_t port; |
| 30 | } sctp; | 30 | } sctp; |
| 31 | struct { | 31 | struct { |
| 32 | u_int16_t key; /* key is 32bit, pptp only uses 16 */ | 32 | __be16 key; /* key is 32bit, pptp only uses 16 */ |
| 33 | } gre; | 33 | } gre; |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| @@ -65,7 +65,7 @@ struct ip_conntrack_tuple | |||
| 65 | u_int16_t port; | 65 | u_int16_t port; |
| 66 | } sctp; | 66 | } sctp; |
| 67 | struct { | 67 | struct { |
| 68 | u_int16_t key; /* key is 32bit, | 68 | __be16 key; /* key is 32bit, |
| 69 | * pptp only uses 16 */ | 69 | * pptp only uses 16 */ |
| 70 | } gre; | 70 | } gre; |
| 71 | } u; | 71 | } u; |
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c index 117587978700..8236ee0fb090 100644 --- a/net/ipv4/netfilter/ip_conntrack_helper_pptp.c +++ b/net/ipv4/netfilter/ip_conntrack_helper_pptp.c | |||
| @@ -223,8 +223,8 @@ static void pptp_destroy_siblings(struct ip_conntrack *ct) | |||
| 223 | static inline int | 223 | static inline int |
| 224 | exp_gre(struct ip_conntrack *master, | 224 | exp_gre(struct ip_conntrack *master, |
| 225 | u_int32_t seq, | 225 | u_int32_t seq, |
| 226 | u_int16_t callid, | 226 | __be16 callid, |
| 227 | u_int16_t peer_callid) | 227 | __be16 peer_callid) |
| 228 | { | 228 | { |
| 229 | struct ip_conntrack_tuple inv_tuple; | 229 | struct ip_conntrack_tuple inv_tuple; |
| 230 | struct ip_conntrack_tuple exp_tuples[] = { | 230 | struct ip_conntrack_tuple exp_tuples[] = { |
| @@ -263,7 +263,7 @@ exp_gre(struct ip_conntrack *master, | |||
| 263 | exp_orig->mask.src.ip = 0xffffffff; | 263 | exp_orig->mask.src.ip = 0xffffffff; |
| 264 | exp_orig->mask.src.u.all = 0; | 264 | exp_orig->mask.src.u.all = 0; |
| 265 | exp_orig->mask.dst.u.all = 0; | 265 | exp_orig->mask.dst.u.all = 0; |
| 266 | exp_orig->mask.dst.u.gre.key = 0xffff; | 266 | exp_orig->mask.dst.u.gre.key = htons(0xffff); |
| 267 | exp_orig->mask.dst.ip = 0xffffffff; | 267 | exp_orig->mask.dst.ip = 0xffffffff; |
| 268 | exp_orig->mask.dst.protonum = 0xff; | 268 | exp_orig->mask.dst.protonum = 0xff; |
| 269 | 269 | ||
| @@ -340,7 +340,8 @@ pptp_inbound_pkt(struct sk_buff **pskb, | |||
| 340 | unsigned int reqlen; | 340 | unsigned int reqlen; |
| 341 | union pptp_ctrl_union _pptpReq, *pptpReq; | 341 | union pptp_ctrl_union _pptpReq, *pptpReq; |
| 342 | struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info; | 342 | struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info; |
| 343 | u_int16_t msg, *cid, *pcid; | 343 | u_int16_t msg; |
| 344 | __be16 *cid, *pcid; | ||
| 344 | u_int32_t seq; | 345 | u_int32_t seq; |
| 345 | 346 | ||
| 346 | ctlh = skb_header_pointer(*pskb, nexthdr_off, sizeof(_ctlh), &_ctlh); | 347 | ctlh = skb_header_pointer(*pskb, nexthdr_off, sizeof(_ctlh), &_ctlh); |
| @@ -551,7 +552,8 @@ pptp_outbound_pkt(struct sk_buff **pskb, | |||
| 551 | unsigned int reqlen; | 552 | unsigned int reqlen; |
| 552 | union pptp_ctrl_union _pptpReq, *pptpReq; | 553 | union pptp_ctrl_union _pptpReq, *pptpReq; |
| 553 | struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info; | 554 | struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info; |
| 554 | u_int16_t msg, *cid, *pcid; | 555 | u_int16_t msg; |
| 556 | __be16 *cid, *pcid; | ||
| 555 | 557 | ||
| 556 | ctlh = skb_header_pointer(*pskb, nexthdr_off, sizeof(_ctlh), &_ctlh); | 558 | ctlh = skb_header_pointer(*pskb, nexthdr_off, sizeof(_ctlh), &_ctlh); |
| 557 | if (!ctlh) | 559 | if (!ctlh) |
| @@ -755,7 +757,7 @@ static struct ip_conntrack_helper pptp = { | |||
| 755 | } | 757 | } |
| 756 | }, | 758 | }, |
| 757 | .mask = { .src = { .ip = 0, | 759 | .mask = { .src = { .ip = 0, |
| 758 | .u = { .tcp = { .port = 0xffff } } | 760 | .u = { .tcp = { .port = __constant_htons(0xffff) } } |
| 759 | }, | 761 | }, |
| 760 | .dst = { .ip = 0, | 762 | .dst = { .ip = 0, |
| 761 | .u = { .all = 0 }, | 763 | .u = { .all = 0 }, |
