mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 11:16:11 +00:00
[NETFILTER]: nf_conntrack_h323: constify and annotate H.323 helper
Constify data tables (predominantly in nf_conntrack_h323_types.c, but also a few in nf_conntrack_h323_asn1.c) and use const qualifiers on variables where possible in the h323 sources. Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
3cb609d57c
commit
905e3e8ec5
4 changed files with 230 additions and 216 deletions
|
@ -32,7 +32,8 @@ static int set_addr(struct sk_buff *skb,
|
|||
__be32 ip;
|
||||
__be16 port;
|
||||
} __attribute__ ((__packed__)) buf;
|
||||
struct tcphdr _tcph, *th;
|
||||
const struct tcphdr *th;
|
||||
struct tcphdr _tcph;
|
||||
|
||||
buf.ip = ip;
|
||||
buf.port = port;
|
||||
|
@ -99,7 +100,7 @@ static int set_sig_addr(struct sk_buff *skb, struct nf_conn *ct,
|
|||
unsigned char **data,
|
||||
TransportAddress *taddr, int count)
|
||||
{
|
||||
struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
|
||||
const struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
|
||||
int dir = CTINFO2DIR(ctinfo);
|
||||
int i;
|
||||
__be16 port;
|
||||
|
|
|
@ -87,7 +87,7 @@ typedef struct field_t {
|
|||
unsigned char ub;
|
||||
unsigned short attr;
|
||||
unsigned short offset;
|
||||
struct field_t *fields;
|
||||
const struct field_t *fields;
|
||||
} field_t;
|
||||
|
||||
/* Bit Stream */
|
||||
|
@ -111,21 +111,21 @@ static unsigned int get_bitmap(bitstr_t *bs, unsigned int b);
|
|||
static unsigned int get_uint(bitstr_t *bs, int b);
|
||||
|
||||
/* Decoder Functions */
|
||||
static int decode_nul(bitstr_t *bs, field_t *f, char *base, int level);
|
||||
static int decode_bool(bitstr_t *bs, field_t *f, char *base, int level);
|
||||
static int decode_oid(bitstr_t *bs, field_t *f, char *base, int level);
|
||||
static int decode_int(bitstr_t *bs, field_t *f, char *base, int level);
|
||||
static int decode_enum(bitstr_t *bs, field_t *f, char *base, int level);
|
||||
static int decode_bitstr(bitstr_t *bs, field_t *f, char *base, int level);
|
||||
static int decode_numstr(bitstr_t *bs, field_t *f, char *base, int level);
|
||||
static int decode_octstr(bitstr_t *bs, field_t *f, char *base, int level);
|
||||
static int decode_bmpstr(bitstr_t *bs, field_t *f, char *base, int level);
|
||||
static int decode_seq(bitstr_t *bs, field_t *f, char *base, int level);
|
||||
static int decode_seqof(bitstr_t *bs, field_t *f, char *base, int level);
|
||||
static int decode_choice(bitstr_t *bs, field_t *f, char *base, int level);
|
||||
static int decode_nul(bitstr_t *bs, const struct field_t *f, char *base, int level);
|
||||
static int decode_bool(bitstr_t *bs, const struct field_t *f, char *base, int level);
|
||||
static int decode_oid(bitstr_t *bs, const struct field_t *f, char *base, int level);
|
||||
static int decode_int(bitstr_t *bs, const struct field_t *f, char *base, int level);
|
||||
static int decode_enum(bitstr_t *bs, const struct field_t *f, char *base, int level);
|
||||
static int decode_bitstr(bitstr_t *bs, const struct field_t *f, char *base, int level);
|
||||
static int decode_numstr(bitstr_t *bs, const struct field_t *f, char *base, int level);
|
||||
static int decode_octstr(bitstr_t *bs, const struct field_t *f, char *base, int level);
|
||||
static int decode_bmpstr(bitstr_t *bs, const struct field_t *f, char *base, int level);
|
||||
static int decode_seq(bitstr_t *bs, const struct field_t *f, char *base, int level);
|
||||
static int decode_seqof(bitstr_t *bs, const struct field_t *f, char *base, int level);
|
||||
static int decode_choice(bitstr_t *bs, const struct field_t *f, char *base, int level);
|
||||
|
||||
/* Decoder Functions Vector */
|
||||
typedef int (*decoder_t)(bitstr_t *, field_t *, char *, int);
|
||||
typedef int (*decoder_t)(bitstr_t *, const struct field_t *, char *, int);
|
||||
static const decoder_t Decoders[] = {
|
||||
decode_nul,
|
||||
decode_bool,
|
||||
|
@ -264,7 +264,8 @@ static unsigned int get_uint(bitstr_t *bs, int b)
|
|||
}
|
||||
|
||||
/****************************************************************************/
|
||||
static int decode_nul(bitstr_t *bs, field_t *f, char *base, int level)
|
||||
static int decode_nul(bitstr_t *bs, const struct field_t *f,
|
||||
char *base, int level)
|
||||
{
|
||||
PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
|
||||
|
||||
|
@ -272,7 +273,8 @@ static int decode_nul(bitstr_t *bs, field_t *f, char *base, int level)
|
|||
}
|
||||
|
||||
/****************************************************************************/
|
||||
static int decode_bool(bitstr_t *bs, field_t *f, char *base, int level)
|
||||
static int decode_bool(bitstr_t *bs, const struct field_t *f,
|
||||
char *base, int level)
|
||||
{
|
||||
PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
|
||||
|
||||
|
@ -283,7 +285,8 @@ static int decode_bool(bitstr_t *bs, field_t *f, char *base, int level)
|
|||
}
|
||||
|
||||
/****************************************************************************/
|
||||
static int decode_oid(bitstr_t *bs, field_t *f, char *base, int level)
|
||||
static int decode_oid(bitstr_t *bs, const struct field_t *f,
|
||||
char *base, int level)
|
||||
{
|
||||
int len;
|
||||
|
||||
|
@ -299,7 +302,8 @@ static int decode_oid(bitstr_t *bs, field_t *f, char *base, int level)
|
|||
}
|
||||
|
||||
/****************************************************************************/
|
||||
static int decode_int(bitstr_t *bs, field_t *f, char *base, int level)
|
||||
static int decode_int(bitstr_t *bs, const struct field_t *f,
|
||||
char *base, int level)
|
||||
{
|
||||
unsigned int len;
|
||||
|
||||
|
@ -342,7 +346,8 @@ static int decode_int(bitstr_t *bs, field_t *f, char *base, int level)
|
|||
}
|
||||
|
||||
/****************************************************************************/
|
||||
static int decode_enum(bitstr_t *bs, field_t *f, char *base, int level)
|
||||
static int decode_enum(bitstr_t *bs, const struct field_t *f,
|
||||
char *base, int level)
|
||||
{
|
||||
PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
|
||||
|
||||
|
@ -357,7 +362,8 @@ static int decode_enum(bitstr_t *bs, field_t *f, char *base, int level)
|
|||
}
|
||||
|
||||
/****************************************************************************/
|
||||
static int decode_bitstr(bitstr_t *bs, field_t *f, char *base, int level)
|
||||
static int decode_bitstr(bitstr_t *bs, const struct field_t *f,
|
||||
char *base, int level)
|
||||
{
|
||||
unsigned int len;
|
||||
|
||||
|
@ -390,7 +396,8 @@ static int decode_bitstr(bitstr_t *bs, field_t *f, char *base, int level)
|
|||
}
|
||||
|
||||
/****************************************************************************/
|
||||
static int decode_numstr(bitstr_t *bs, field_t *f, char *base, int level)
|
||||
static int decode_numstr(bitstr_t *bs, const struct field_t *f,
|
||||
char *base, int level)
|
||||
{
|
||||
unsigned int len;
|
||||
|
||||
|
@ -407,7 +414,8 @@ static int decode_numstr(bitstr_t *bs, field_t *f, char *base, int level)
|
|||
}
|
||||
|
||||
/****************************************************************************/
|
||||
static int decode_octstr(bitstr_t *bs, field_t *f, char *base, int level)
|
||||
static int decode_octstr(bitstr_t *bs, const struct field_t *f,
|
||||
char *base, int level)
|
||||
{
|
||||
unsigned int len;
|
||||
|
||||
|
@ -455,7 +463,8 @@ static int decode_octstr(bitstr_t *bs, field_t *f, char *base, int level)
|
|||
}
|
||||
|
||||
/****************************************************************************/
|
||||
static int decode_bmpstr(bitstr_t *bs, field_t *f, char *base, int level)
|
||||
static int decode_bmpstr(bitstr_t *bs, const struct field_t *f,
|
||||
char *base, int level)
|
||||
{
|
||||
unsigned int len;
|
||||
|
||||
|
@ -480,11 +489,12 @@ static int decode_bmpstr(bitstr_t *bs, field_t *f, char *base, int level)
|
|||
}
|
||||
|
||||
/****************************************************************************/
|
||||
static int decode_seq(bitstr_t *bs, field_t *f, char *base, int level)
|
||||
static int decode_seq(bitstr_t *bs, const struct field_t *f,
|
||||
char *base, int level)
|
||||
{
|
||||
unsigned int ext, bmp, i, opt, len = 0, bmp2, bmp2_len;
|
||||
int err;
|
||||
field_t *son;
|
||||
const struct field_t *son;
|
||||
unsigned char *beg = NULL;
|
||||
|
||||
PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
|
||||
|
@ -596,11 +606,12 @@ static int decode_seq(bitstr_t *bs, field_t *f, char *base, int level)
|
|||
}
|
||||
|
||||
/****************************************************************************/
|
||||
static int decode_seqof(bitstr_t *bs, field_t *f, char *base, int level)
|
||||
static int decode_seqof(bitstr_t *bs, const struct field_t *f,
|
||||
char *base, int level)
|
||||
{
|
||||
unsigned int count, effective_count = 0, i, len = 0;
|
||||
int err;
|
||||
field_t *son;
|
||||
const struct field_t *son;
|
||||
unsigned char *beg = NULL;
|
||||
|
||||
PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
|
||||
|
@ -685,11 +696,12 @@ static int decode_seqof(bitstr_t *bs, field_t *f, char *base, int level)
|
|||
|
||||
|
||||
/****************************************************************************/
|
||||
static int decode_choice(bitstr_t *bs, field_t *f, char *base, int level)
|
||||
static int decode_choice(bitstr_t *bs, const struct field_t *f,
|
||||
char *base, int level)
|
||||
{
|
||||
unsigned int type, ext, len = 0;
|
||||
int err;
|
||||
field_t *son;
|
||||
const struct field_t *son;
|
||||
unsigned char *beg = NULL;
|
||||
|
||||
PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
|
||||
|
@ -756,7 +768,7 @@ static int decode_choice(bitstr_t *bs, field_t *f, char *base, int level)
|
|||
/****************************************************************************/
|
||||
int DecodeRasMessage(unsigned char *buf, size_t sz, RasMessage *ras)
|
||||
{
|
||||
static field_t ras_message = {
|
||||
static const struct field_t ras_message = {
|
||||
FNAME("RasMessage") CHOICE, 5, 24, 32, DECODE | EXT,
|
||||
0, _RasMessage
|
||||
};
|
||||
|
@ -773,7 +785,7 @@ int DecodeRasMessage(unsigned char *buf, size_t sz, RasMessage *ras)
|
|||
static int DecodeH323_UserInformation(unsigned char *buf, unsigned char *beg,
|
||||
size_t sz, H323_UserInformation *uuie)
|
||||
{
|
||||
static field_t h323_userinformation = {
|
||||
static const struct field_t h323_userinformation = {
|
||||
FNAME("H323-UserInformation") SEQ, 1, 2, 2, DECODE | EXT,
|
||||
0, _H323_UserInformation
|
||||
};
|
||||
|
@ -792,7 +804,7 @@ int DecodeMultimediaSystemControlMessage(unsigned char *buf, size_t sz,
|
|||
MultimediaSystemControlMessage *
|
||||
mscm)
|
||||
{
|
||||
static field_t multimediasystemcontrolmessage = {
|
||||
static const struct field_t multimediasystemcontrolmessage = {
|
||||
FNAME("MultimediaSystemControlMessage") CHOICE, 2, 4, 4,
|
||||
DECODE | EXT, 0, _MultimediaSystemControlMessage
|
||||
};
|
||||
|
|
|
@ -114,7 +114,8 @@ static int get_tpkt_data(struct sk_buff *skb, unsigned int protoff,
|
|||
{
|
||||
struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
|
||||
int dir = CTINFO2DIR(ctinfo);
|
||||
struct tcphdr _tcph, *th;
|
||||
const struct tcphdr *th;
|
||||
struct tcphdr _tcph;
|
||||
int tcpdatalen;
|
||||
int tcpdataoff;
|
||||
unsigned char *tpkt;
|
||||
|
@ -212,11 +213,11 @@ static int get_tpkt_data(struct sk_buff *skb, unsigned int protoff,
|
|||
}
|
||||
|
||||
/****************************************************************************/
|
||||
static int get_h245_addr(struct nf_conn *ct, unsigned char *data,
|
||||
static int get_h245_addr(struct nf_conn *ct, const unsigned char *data,
|
||||
H245_TransportAddress *taddr,
|
||||
union nf_inet_addr *addr, __be16 *port)
|
||||
{
|
||||
unsigned char *p;
|
||||
const unsigned char *p;
|
||||
int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num;
|
||||
int len;
|
||||
|
||||
|
@ -625,7 +626,7 @@ int get_h225_addr(struct nf_conn *ct, unsigned char *data,
|
|||
TransportAddress *taddr,
|
||||
union nf_inet_addr *addr, __be16 *port)
|
||||
{
|
||||
unsigned char *p;
|
||||
const unsigned char *p;
|
||||
int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num;
|
||||
int len;
|
||||
|
||||
|
@ -704,9 +705,8 @@ static int expect_h245(struct sk_buff *skb, struct nf_conn *ct,
|
|||
|
||||
/* If the calling party is on the same side of the forward-to party,
|
||||
* we don't need to track the second call */
|
||||
static int callforward_do_filter(union nf_inet_addr *src,
|
||||
union nf_inet_addr *dst,
|
||||
int family)
|
||||
static int callforward_do_filter(const union nf_inet_addr *src,
|
||||
const union nf_inet_addr *dst, int family)
|
||||
{
|
||||
const struct nf_afinfo *afinfo;
|
||||
struct flowi fl1, fl2;
|
||||
|
@ -1185,7 +1185,8 @@ static struct nf_conntrack_helper nf_conntrack_helper_q931[] __read_mostly = {
|
|||
static unsigned char *get_udp_data(struct sk_buff *skb, unsigned int protoff,
|
||||
int *datalen)
|
||||
{
|
||||
struct udphdr _uh, *uh;
|
||||
const struct udphdr *uh;
|
||||
struct udphdr _uh;
|
||||
int dataoff;
|
||||
|
||||
uh = skb_header_pointer(skb, protoff, sizeof(_uh), &_uh);
|
||||
|
@ -1468,7 +1469,7 @@ static int process_arq(struct sk_buff *skb, struct nf_conn *ct,
|
|||
enum ip_conntrack_info ctinfo,
|
||||
unsigned char **data, AdmissionRequest *arq)
|
||||
{
|
||||
struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
|
||||
const struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
|
||||
int dir = CTINFO2DIR(ctinfo);
|
||||
__be16 port;
|
||||
union nf_inet_addr addr;
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue