提交 67497205 编写于 作者: A Alexey Dobriyan 提交者: David S. Miller

[NETFILTER] Fix sparse endian warnings in pptp helper

Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: NHarald Welte <laforge@netfilter.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0ae5d253
...@@ -60,8 +60,8 @@ struct ip_ct_pptp_expect { ...@@ -60,8 +60,8 @@ struct ip_ct_pptp_expect {
struct pptp_pkt_hdr { struct pptp_pkt_hdr {
__u16 packetLength; __u16 packetLength;
__u16 packetType; __be16 packetType;
__u32 magicCookie; __be32 magicCookie;
}; };
/* PptpControlMessageType values */ /* PptpControlMessageType values */
...@@ -93,7 +93,7 @@ struct pptp_pkt_hdr { ...@@ -93,7 +93,7 @@ struct pptp_pkt_hdr {
#define PPTP_REMOVE_DEVICE_ERROR 6 #define PPTP_REMOVE_DEVICE_ERROR 6
struct PptpControlHeader { struct PptpControlHeader {
__u16 messageType; __be16 messageType;
__u16 reserved; __u16 reserved;
}; };
...@@ -106,13 +106,13 @@ struct PptpControlHeader { ...@@ -106,13 +106,13 @@ struct PptpControlHeader {
#define PPTP_BEARER_CAP_DIGITAL 0x2 #define PPTP_BEARER_CAP_DIGITAL 0x2
struct PptpStartSessionRequest { struct PptpStartSessionRequest {
__u16 protocolVersion; __be16 protocolVersion;
__u8 reserved1; __u8 reserved1;
__u8 reserved2; __u8 reserved2;
__u32 framingCapability; __be32 framingCapability;
__u32 bearerCapability; __be32 bearerCapability;
__u16 maxChannels; __be16 maxChannels;
__u16 firmwareRevision; __be16 firmwareRevision;
__u8 hostName[64]; __u8 hostName[64];
__u8 vendorString[64]; __u8 vendorString[64];
}; };
...@@ -125,13 +125,13 @@ struct PptpStartSessionRequest { ...@@ -125,13 +125,13 @@ struct PptpStartSessionRequest {
#define PPTP_START_UNKNOWN_PROTOCOL 5 #define PPTP_START_UNKNOWN_PROTOCOL 5
struct PptpStartSessionReply { struct PptpStartSessionReply {
__u16 protocolVersion; __be16 protocolVersion;
__u8 resultCode; __u8 resultCode;
__u8 generalErrorCode; __u8 generalErrorCode;
__u32 framingCapability; __be32 framingCapability;
__u32 bearerCapability; __be32 bearerCapability;
__u16 maxChannels; __be16 maxChannels;
__u16 firmwareRevision; __be16 firmwareRevision;
__u8 hostName[64]; __u8 hostName[64];
__u8 vendorString[64]; __u8 vendorString[64];
}; };
...@@ -155,7 +155,7 @@ struct PptpStopSessionReply { ...@@ -155,7 +155,7 @@ struct PptpStopSessionReply {
}; };
struct PptpEchoRequest { struct PptpEchoRequest {
__u32 identNumber; __be32 identNumber;
}; };
/* PptpEchoReplyResultCode */ /* PptpEchoReplyResultCode */
...@@ -163,7 +163,7 @@ struct PptpEchoRequest { ...@@ -163,7 +163,7 @@ struct PptpEchoRequest {
#define PPTP_ECHO_GENERAL_ERROR 2 #define PPTP_ECHO_GENERAL_ERROR 2
struct PptpEchoReply { struct PptpEchoReply {
__u32 identNumber; __be32 identNumber;
__u8 resultCode; __u8 resultCode;
__u8 generalErrorCode; __u8 generalErrorCode;
__u16 reserved; __u16 reserved;
...@@ -180,16 +180,16 @@ struct PptpEchoReply { ...@@ -180,16 +180,16 @@ struct PptpEchoReply {
#define PPTP_DONT_CARE_BEARER_TYPE 3 #define PPTP_DONT_CARE_BEARER_TYPE 3
struct PptpOutCallRequest { struct PptpOutCallRequest {
__u16 callID; __be16 callID;
__u16 callSerialNumber; __be16 callSerialNumber;
__u32 minBPS; __be32 minBPS;
__u32 maxBPS; __be32 maxBPS;
__u32 bearerType; __be32 bearerType;
__u32 framingType; __be32 framingType;
__u16 packetWindow; __be16 packetWindow;
__u16 packetProcDelay; __be16 packetProcDelay;
__u16 reserved1; __u16 reserved1;
__u16 phoneNumberLength; __be16 phoneNumberLength;
__u16 reserved2; __u16 reserved2;
__u8 phoneNumber[64]; __u8 phoneNumber[64];
__u8 subAddress[64]; __u8 subAddress[64];
...@@ -205,24 +205,24 @@ struct PptpOutCallRequest { ...@@ -205,24 +205,24 @@ struct PptpOutCallRequest {
#define PPTP_OUTCALL_DONT_ACCEPT 7 #define PPTP_OUTCALL_DONT_ACCEPT 7
struct PptpOutCallReply { struct PptpOutCallReply {
__u16 callID; __be16 callID;
__u16 peersCallID; __be16 peersCallID;
__u8 resultCode; __u8 resultCode;
__u8 generalErrorCode; __u8 generalErrorCode;
__u16 causeCode; __be16 causeCode;
__u32 connectSpeed; __be32 connectSpeed;
__u16 packetWindow; __be16 packetWindow;
__u16 packetProcDelay; __be16 packetProcDelay;
__u32 physChannelID; __be32 physChannelID;
}; };
struct PptpInCallRequest { struct PptpInCallRequest {
__u16 callID; __be16 callID;
__u16 callSerialNumber; __be16 callSerialNumber;
__u32 callBearerType; __be32 callBearerType;
__u32 physChannelID; __be32 physChannelID;
__u16 dialedNumberLength; __be16 dialedNumberLength;
__u16 dialingNumberLength; __be16 dialingNumberLength;
__u8 dialedNumber[64]; __u8 dialedNumber[64];
__u8 dialingNumber[64]; __u8 dialingNumber[64];
__u8 subAddress[64]; __u8 subAddress[64];
...@@ -234,54 +234,54 @@ struct PptpInCallRequest { ...@@ -234,54 +234,54 @@ struct PptpInCallRequest {
#define PPTP_INCALL_DONT_ACCEPT 3 #define PPTP_INCALL_DONT_ACCEPT 3
struct PptpInCallReply { struct PptpInCallReply {
__u16 callID; __be16 callID;
__u16 peersCallID; __be16 peersCallID;
__u8 resultCode; __u8 resultCode;
__u8 generalErrorCode; __u8 generalErrorCode;
__u16 packetWindow; __be16 packetWindow;
__u16 packetProcDelay; __be16 packetProcDelay;
__u16 reserved; __u16 reserved;
}; };
struct PptpInCallConnected { struct PptpInCallConnected {
__u16 peersCallID; __be16 peersCallID;
__u16 reserved; __u16 reserved;
__u32 connectSpeed; __be32 connectSpeed;
__u16 packetWindow; __be16 packetWindow;
__u16 packetProcDelay; __be16 packetProcDelay;
__u32 callFramingType; __be32 callFramingType;
}; };
struct PptpClearCallRequest { struct PptpClearCallRequest {
__u16 callID; __be16 callID;
__u16 reserved; __u16 reserved;
}; };
struct PptpCallDisconnectNotify { struct PptpCallDisconnectNotify {
__u16 callID; __be16 callID;
__u8 resultCode; __u8 resultCode;
__u8 generalErrorCode; __u8 generalErrorCode;
__u16 causeCode; __be16 causeCode;
__u16 reserved; __u16 reserved;
__u8 callStatistics[128]; __u8 callStatistics[128];
}; };
struct PptpWanErrorNotify { struct PptpWanErrorNotify {
__u16 peersCallID; __be16 peersCallID;
__u16 reserved; __u16 reserved;
__u32 crcErrors; __be32 crcErrors;
__u32 framingErrors; __be32 framingErrors;
__u32 hardwareOverRuns; __be32 hardwareOverRuns;
__u32 bufferOverRuns; __be32 bufferOverRuns;
__u32 timeoutErrors; __be32 timeoutErrors;
__u32 alignmentErrors; __be32 alignmentErrors;
}; };
struct PptpSetLinkInfo { struct PptpSetLinkInfo {
__u16 peersCallID; __be16 peersCallID;
__u16 reserved; __u16 reserved;
__u32 sendAccm; __be32 sendAccm;
__u32 recvAccm; __be32 recvAccm;
}; };
......
...@@ -17,7 +17,7 @@ union ip_conntrack_manip_proto ...@@ -17,7 +17,7 @@ union ip_conntrack_manip_proto
u_int16_t all; u_int16_t all;
struct { struct {
u_int16_t port; __be16 port;
} tcp; } tcp;
struct { struct {
u_int16_t port; u_int16_t port;
...@@ -29,7 +29,7 @@ union ip_conntrack_manip_proto ...@@ -29,7 +29,7 @@ union ip_conntrack_manip_proto
u_int16_t port; u_int16_t port;
} sctp; } sctp;
struct { struct {
u_int16_t key; /* key is 32bit, pptp only uses 16 */ __be16 key; /* key is 32bit, pptp only uses 16 */
} gre; } gre;
}; };
...@@ -65,7 +65,7 @@ struct ip_conntrack_tuple ...@@ -65,7 +65,7 @@ struct ip_conntrack_tuple
u_int16_t port; u_int16_t port;
} sctp; } sctp;
struct { struct {
u_int16_t key; /* key is 32bit, __be16 key; /* key is 32bit,
* pptp only uses 16 */ * pptp only uses 16 */
} gre; } gre;
} u; } u;
......
...@@ -223,8 +223,8 @@ static void pptp_destroy_siblings(struct ip_conntrack *ct) ...@@ -223,8 +223,8 @@ static void pptp_destroy_siblings(struct ip_conntrack *ct)
static inline int static inline int
exp_gre(struct ip_conntrack *master, exp_gre(struct ip_conntrack *master,
u_int32_t seq, u_int32_t seq,
u_int16_t callid, __be16 callid,
u_int16_t peer_callid) __be16 peer_callid)
{ {
struct ip_conntrack_tuple inv_tuple; struct ip_conntrack_tuple inv_tuple;
struct ip_conntrack_tuple exp_tuples[] = { struct ip_conntrack_tuple exp_tuples[] = {
...@@ -263,7 +263,7 @@ exp_gre(struct ip_conntrack *master, ...@@ -263,7 +263,7 @@ exp_gre(struct ip_conntrack *master,
exp_orig->mask.src.ip = 0xffffffff; exp_orig->mask.src.ip = 0xffffffff;
exp_orig->mask.src.u.all = 0; exp_orig->mask.src.u.all = 0;
exp_orig->mask.dst.u.all = 0; exp_orig->mask.dst.u.all = 0;
exp_orig->mask.dst.u.gre.key = 0xffff; exp_orig->mask.dst.u.gre.key = htons(0xffff);
exp_orig->mask.dst.ip = 0xffffffff; exp_orig->mask.dst.ip = 0xffffffff;
exp_orig->mask.dst.protonum = 0xff; exp_orig->mask.dst.protonum = 0xff;
...@@ -340,7 +340,8 @@ pptp_inbound_pkt(struct sk_buff **pskb, ...@@ -340,7 +340,8 @@ pptp_inbound_pkt(struct sk_buff **pskb,
unsigned int reqlen; unsigned int reqlen;
union pptp_ctrl_union _pptpReq, *pptpReq; union pptp_ctrl_union _pptpReq, *pptpReq;
struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info; struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info;
u_int16_t msg, *cid, *pcid; u_int16_t msg;
__be16 *cid, *pcid;
u_int32_t seq; u_int32_t seq;
ctlh = skb_header_pointer(*pskb, nexthdr_off, sizeof(_ctlh), &_ctlh); ctlh = skb_header_pointer(*pskb, nexthdr_off, sizeof(_ctlh), &_ctlh);
...@@ -551,7 +552,8 @@ pptp_outbound_pkt(struct sk_buff **pskb, ...@@ -551,7 +552,8 @@ pptp_outbound_pkt(struct sk_buff **pskb,
unsigned int reqlen; unsigned int reqlen;
union pptp_ctrl_union _pptpReq, *pptpReq; union pptp_ctrl_union _pptpReq, *pptpReq;
struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info; struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info;
u_int16_t msg, *cid, *pcid; u_int16_t msg;
__be16 *cid, *pcid;
ctlh = skb_header_pointer(*pskb, nexthdr_off, sizeof(_ctlh), &_ctlh); ctlh = skb_header_pointer(*pskb, nexthdr_off, sizeof(_ctlh), &_ctlh);
if (!ctlh) if (!ctlh)
...@@ -755,7 +757,7 @@ static struct ip_conntrack_helper pptp = { ...@@ -755,7 +757,7 @@ static struct ip_conntrack_helper pptp = {
} }
}, },
.mask = { .src = { .ip = 0, .mask = { .src = { .ip = 0,
.u = { .tcp = { .port = 0xffff } } .u = { .tcp = { .port = __constant_htons(0xffff) } }
}, },
.dst = { .ip = 0, .dst = { .ip = 0,
.u = { .all = 0 }, .u = { .all = 0 },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册