Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
4a6a5161
Commit
4a6a5161
authored
Jul 24, 2003
by
Bart De Schuymer
Committed by
David S. Miller
Jul 24, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[EBTABLES]: Make it work on 32-on-64 platforms.
parent
bca415fe
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
36 additions
and
34 deletions
+36
-34
include/linux/netfilter_bridge/ebtables.h
include/linux/netfilter_bridge/ebtables.h
+24
-22
net/bridge/netfilter/ebt_arp.c
net/bridge/netfilter/ebt_arp.c
+1
-1
net/bridge/netfilter/ebt_dnat.c
net/bridge/netfilter/ebt_dnat.c
+1
-1
net/bridge/netfilter/ebt_ip.c
net/bridge/netfilter/ebt_ip.c
+1
-1
net/bridge/netfilter/ebt_log.c
net/bridge/netfilter/ebt_log.c
+1
-1
net/bridge/netfilter/ebt_mark.c
net/bridge/netfilter/ebt_mark.c
+1
-1
net/bridge/netfilter/ebt_mark_m.c
net/bridge/netfilter/ebt_mark_m.c
+1
-1
net/bridge/netfilter/ebt_pkttype.c
net/bridge/netfilter/ebt_pkttype.c
+1
-1
net/bridge/netfilter/ebt_redirect.c
net/bridge/netfilter/ebt_redirect.c
+1
-1
net/bridge/netfilter/ebt_snat.c
net/bridge/netfilter/ebt_snat.c
+1
-1
net/bridge/netfilter/ebt_stp.c
net/bridge/netfilter/ebt_stp.c
+1
-1
net/bridge/netfilter/ebt_vlan.c
net/bridge/netfilter/ebt_vlan.c
+2
-2
No files found.
include/linux/netfilter_bridge/ebtables.h
View file @
4a6a5161
...
@@ -33,6 +33,23 @@ struct ebt_counter
...
@@ -33,6 +33,23 @@ struct ebt_counter
uint64_t
bcnt
;
uint64_t
bcnt
;
};
};
struct
ebt_replace
{
char
name
[
EBT_TABLE_MAXNAMELEN
];
unsigned
int
valid_hooks
;
/* nr of rules in the table */
unsigned
int
nentries
;
/* total size of the entries */
unsigned
int
entries_size
;
/* start of the chains */
struct
ebt_entries
*
hook_entry
[
NF_BR_NUMHOOKS
];
/* nr of counters userspace expects back */
unsigned
int
num_counters
;
/* where the kernel will put the old counters */
struct
ebt_counter
*
counters
;
char
*
entries
;
};
struct
ebt_entries
{
struct
ebt_entries
{
/* this field is always set to zero
/* this field is always set to zero
* See EBT_ENTRY_OR_ENTRIES.
* See EBT_ENTRY_OR_ENTRIES.
...
@@ -47,7 +64,7 @@ struct ebt_entries {
...
@@ -47,7 +64,7 @@ struct ebt_entries {
/* nr. of entries */
/* nr. of entries */
unsigned
int
nentries
;
unsigned
int
nentries
;
/* entry list */
/* entry list */
char
data
[
0
];
char
data
[
0
]
__attribute__
((
aligned
(
__alignof__
(
struct
ebt_replace
))))
;
};
};
/* used for the bitmask of struct ebt_entry */
/* used for the bitmask of struct ebt_entry */
...
@@ -87,7 +104,7 @@ struct ebt_entry_match
...
@@ -87,7 +104,7 @@ struct ebt_entry_match
}
u
;
}
u
;
/* size of data */
/* size of data */
unsigned
int
match_size
;
unsigned
int
match_size
;
unsigned
char
data
[
0
];
unsigned
char
data
[
0
]
__attribute__
((
aligned
(
__alignof__
(
struct
ebt_replace
))))
;
};
};
struct
ebt_entry_watcher
struct
ebt_entry_watcher
...
@@ -98,7 +115,7 @@ struct ebt_entry_watcher
...
@@ -98,7 +115,7 @@ struct ebt_entry_watcher
}
u
;
}
u
;
/* size of data */
/* size of data */
unsigned
int
watcher_size
;
unsigned
int
watcher_size
;
unsigned
char
data
[
0
];
unsigned
char
data
[
0
]
__attribute__
((
aligned
(
__alignof__
(
struct
ebt_replace
))))
;
};
};
struct
ebt_entry_target
struct
ebt_entry_target
...
@@ -109,7 +126,7 @@ struct ebt_entry_target
...
@@ -109,7 +126,7 @@ struct ebt_entry_target
}
u
;
}
u
;
/* size of data */
/* size of data */
unsigned
int
target_size
;
unsigned
int
target_size
;
unsigned
char
data
[
0
];
unsigned
char
data
[
0
]
__attribute__
((
aligned
(
__alignof__
(
struct
ebt_replace
))))
;
};
};
#define EBT_STANDARD_TARGET "standard"
#define EBT_STANDARD_TARGET "standard"
...
@@ -143,24 +160,7 @@ struct ebt_entry {
...
@@ -143,24 +160,7 @@ struct ebt_entry {
unsigned
int
target_offset
;
unsigned
int
target_offset
;
/* sizeof ebt_entry + matches + watchers + target */
/* sizeof ebt_entry + matches + watchers + target */
unsigned
int
next_offset
;
unsigned
int
next_offset
;
unsigned
char
elems
[
0
];
unsigned
char
elems
[
0
]
__attribute__
((
aligned
(
__alignof__
(
struct
ebt_replace
))));
};
struct
ebt_replace
{
char
name
[
EBT_TABLE_MAXNAMELEN
];
unsigned
int
valid_hooks
;
/* nr of rules in the table */
unsigned
int
nentries
;
/* total size of the entries */
unsigned
int
entries_size
;
/* start of the chains */
struct
ebt_entries
*
hook_entry
[
NF_BR_NUMHOOKS
];
/* nr of counters userspace expects back */
unsigned
int
num_counters
;
/* where the kernel will put the old counters */
struct
ebt_counter
*
counters
;
char
*
entries
;
};
};
/* {g,s}etsockopt numbers */
/* {g,s}etsockopt numbers */
...
@@ -263,6 +263,8 @@ struct ebt_table
...
@@ -263,6 +263,8 @@ struct ebt_table
struct
module
*
me
;
struct
module
*
me
;
};
};
#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \
~(__alignof__(struct ebt_replace)-1))
extern
int
ebt_register_table
(
struct
ebt_table
*
table
);
extern
int
ebt_register_table
(
struct
ebt_table
*
table
);
extern
void
ebt_unregister_table
(
struct
ebt_table
*
table
);
extern
void
ebt_unregister_table
(
struct
ebt_table
*
table
);
extern
int
ebt_register_match
(
struct
ebt_match
*
match
);
extern
int
ebt_register_match
(
struct
ebt_match
*
match
);
...
...
net/bridge/netfilter/ebt_arp.c
View file @
4a6a5161
...
@@ -99,7 +99,7 @@ static int ebt_arp_check(const char *tablename, unsigned int hookmask,
...
@@ -99,7 +99,7 @@ static int ebt_arp_check(const char *tablename, unsigned int hookmask,
{
{
struct
ebt_arp_info
*
info
=
(
struct
ebt_arp_info
*
)
data
;
struct
ebt_arp_info
*
info
=
(
struct
ebt_arp_info
*
)
data
;
if
(
datalen
!=
sizeof
(
struct
ebt_arp_info
))
if
(
datalen
!=
EBT_ALIGN
(
sizeof
(
struct
ebt_arp_info
)
))
return
-
EINVAL
;
return
-
EINVAL
;
if
((
e
->
ethproto
!=
__constant_htons
(
ETH_P_ARP
)
&&
if
((
e
->
ethproto
!=
__constant_htons
(
ETH_P_ARP
)
&&
e
->
ethproto
!=
__constant_htons
(
ETH_P_RARP
))
||
e
->
ethproto
!=
__constant_htons
(
ETH_P_RARP
))
||
...
...
net/bridge/netfilter/ebt_dnat.c
View file @
4a6a5161
...
@@ -47,7 +47,7 @@ static int ebt_target_dnat_check(const char *tablename, unsigned int hookmask,
...
@@ -47,7 +47,7 @@ static int ebt_target_dnat_check(const char *tablename, unsigned int hookmask,
(
hookmask
&
~
((
1
<<
NF_BR_PRE_ROUTING
)
|
(
1
<<
NF_BR_LOCAL_OUT
))))
&&
(
hookmask
&
~
((
1
<<
NF_BR_PRE_ROUTING
)
|
(
1
<<
NF_BR_LOCAL_OUT
))))
&&
(
strcmp
(
tablename
,
"broute"
)
||
hookmask
&
~
(
1
<<
NF_BR_BROUTING
))
)
(
strcmp
(
tablename
,
"broute"
)
||
hookmask
&
~
(
1
<<
NF_BR_BROUTING
))
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
datalen
!=
sizeof
(
struct
ebt_nat_info
))
if
(
datalen
!=
EBT_ALIGN
(
sizeof
(
struct
ebt_nat_info
)
))
return
-
EINVAL
;
return
-
EINVAL
;
if
(
INVALID_TARGET
)
if
(
INVALID_TARGET
)
return
-
EINVAL
;
return
-
EINVAL
;
...
...
net/bridge/netfilter/ebt_ip.c
View file @
4a6a5161
...
@@ -75,7 +75,7 @@ static int ebt_ip_check(const char *tablename, unsigned int hookmask,
...
@@ -75,7 +75,7 @@ static int ebt_ip_check(const char *tablename, unsigned int hookmask,
{
{
struct
ebt_ip_info
*
info
=
(
struct
ebt_ip_info
*
)
data
;
struct
ebt_ip_info
*
info
=
(
struct
ebt_ip_info
*
)
data
;
if
(
datalen
!=
sizeof
(
struct
ebt_ip_info
))
if
(
datalen
!=
EBT_ALIGN
(
sizeof
(
struct
ebt_ip_info
)
))
return
-
EINVAL
;
return
-
EINVAL
;
if
(
e
->
ethproto
!=
__constant_htons
(
ETH_P_IP
)
||
if
(
e
->
ethproto
!=
__constant_htons
(
ETH_P_IP
)
||
e
->
invflags
&
EBT_IPROTO
)
e
->
invflags
&
EBT_IPROTO
)
...
...
net/bridge/netfilter/ebt_log.c
View file @
4a6a5161
...
@@ -22,7 +22,7 @@ static int ebt_log_check(const char *tablename, unsigned int hookmask,
...
@@ -22,7 +22,7 @@ static int ebt_log_check(const char *tablename, unsigned int hookmask,
{
{
struct
ebt_log_info
*
info
=
(
struct
ebt_log_info
*
)
data
;
struct
ebt_log_info
*
info
=
(
struct
ebt_log_info
*
)
data
;
if
(
datalen
!=
sizeof
(
struct
ebt_log_info
))
if
(
datalen
!=
EBT_ALIGN
(
sizeof
(
struct
ebt_log_info
)
))
return
-
EINVAL
;
return
-
EINVAL
;
if
(
info
->
bitmask
&
~
EBT_LOG_MASK
)
if
(
info
->
bitmask
&
~
EBT_LOG_MASK
)
return
-
EINVAL
;
return
-
EINVAL
;
...
...
net/bridge/netfilter/ebt_mark.c
View file @
4a6a5161
...
@@ -35,7 +35,7 @@ static int ebt_target_mark_check(const char *tablename, unsigned int hookmask,
...
@@ -35,7 +35,7 @@ static int ebt_target_mark_check(const char *tablename, unsigned int hookmask,
{
{
struct
ebt_mark_t_info
*
info
=
(
struct
ebt_mark_t_info
*
)
data
;
struct
ebt_mark_t_info
*
info
=
(
struct
ebt_mark_t_info
*
)
data
;
if
(
datalen
!=
sizeof
(
struct
ebt_mark_t_info
))
if
(
datalen
!=
EBT_ALIGN
(
sizeof
(
struct
ebt_mark_t_info
)
))
return
-
EINVAL
;
return
-
EINVAL
;
if
(
BASE_CHAIN
&&
info
->
target
==
EBT_RETURN
)
if
(
BASE_CHAIN
&&
info
->
target
==
EBT_RETURN
)
return
-
EINVAL
;
return
-
EINVAL
;
...
...
net/bridge/netfilter/ebt_mark_m.c
View file @
4a6a5161
...
@@ -28,7 +28,7 @@ static int ebt_mark_check(const char *tablename, unsigned int hookmask,
...
@@ -28,7 +28,7 @@ static int ebt_mark_check(const char *tablename, unsigned int hookmask,
{
{
struct
ebt_mark_m_info
*
info
=
(
struct
ebt_mark_m_info
*
)
data
;
struct
ebt_mark_m_info
*
info
=
(
struct
ebt_mark_m_info
*
)
data
;
if
(
datalen
!=
sizeof
(
struct
ebt_mark_m_info
))
if
(
datalen
!=
EBT_ALIGN
(
sizeof
(
struct
ebt_mark_m_info
)
))
return
-
EINVAL
;
return
-
EINVAL
;
if
(
info
->
bitmask
&
~
EBT_MARK_MASK
)
if
(
info
->
bitmask
&
~
EBT_MARK_MASK
)
return
-
EINVAL
;
return
-
EINVAL
;
...
...
net/bridge/netfilter/ebt_pkttype.c
View file @
4a6a5161
...
@@ -28,7 +28,7 @@ static int ebt_pkttype_check(const char *tablename, unsigned int hookmask,
...
@@ -28,7 +28,7 @@ static int ebt_pkttype_check(const char *tablename, unsigned int hookmask,
{
{
struct
ebt_pkttype_info
*
info
=
(
struct
ebt_pkttype_info
*
)
data
;
struct
ebt_pkttype_info
*
info
=
(
struct
ebt_pkttype_info
*
)
data
;
if
(
datalen
!=
sizeof
(
struct
ebt_pkttype_info
))
if
(
datalen
!=
EBT_ALIGN
(
sizeof
(
struct
ebt_pkttype_info
)
))
return
-
EINVAL
;
return
-
EINVAL
;
if
(
info
->
invert
!=
0
&&
info
->
invert
!=
1
)
if
(
info
->
invert
!=
0
&&
info
->
invert
!=
1
)
return
-
EINVAL
;
return
-
EINVAL
;
...
...
net/bridge/netfilter/ebt_redirect.c
View file @
4a6a5161
...
@@ -47,7 +47,7 @@ static int ebt_target_redirect_check(const char *tablename, unsigned int hookmas
...
@@ -47,7 +47,7 @@ static int ebt_target_redirect_check(const char *tablename, unsigned int hookmas
{
{
struct
ebt_redirect_info
*
info
=
(
struct
ebt_redirect_info
*
)
data
;
struct
ebt_redirect_info
*
info
=
(
struct
ebt_redirect_info
*
)
data
;
if
(
datalen
!=
sizeof
(
struct
ebt_redirect_info
))
if
(
datalen
!=
EBT_ALIGN
(
sizeof
(
struct
ebt_redirect_info
)
))
return
-
EINVAL
;
return
-
EINVAL
;
if
(
BASE_CHAIN
&&
info
->
target
==
EBT_RETURN
)
if
(
BASE_CHAIN
&&
info
->
target
==
EBT_RETURN
)
return
-
EINVAL
;
return
-
EINVAL
;
...
...
net/bridge/netfilter/ebt_snat.c
View file @
4a6a5161
...
@@ -40,7 +40,7 @@ static int ebt_target_snat_check(const char *tablename, unsigned int hookmask,
...
@@ -40,7 +40,7 @@ static int ebt_target_snat_check(const char *tablename, unsigned int hookmask,
{
{
struct
ebt_nat_info
*
info
=
(
struct
ebt_nat_info
*
)
data
;
struct
ebt_nat_info
*
info
=
(
struct
ebt_nat_info
*
)
data
;
if
(
datalen
!=
sizeof
(
struct
ebt_nat_info
))
if
(
datalen
!=
EBT_ALIGN
(
sizeof
(
struct
ebt_nat_info
)
))
return
-
EINVAL
;
return
-
EINVAL
;
if
(
BASE_CHAIN
&&
info
->
target
==
EBT_RETURN
)
if
(
BASE_CHAIN
&&
info
->
target
==
EBT_RETURN
)
return
-
EINVAL
;
return
-
EINVAL
;
...
...
net/bridge/netfilter/ebt_stp.c
View file @
4a6a5161
...
@@ -150,7 +150,7 @@ static int ebt_stp_check(const char *tablename, unsigned int hookmask,
...
@@ -150,7 +150,7 @@ static int ebt_stp_check(const char *tablename, unsigned int hookmask,
const
struct
ebt_entry
*
e
,
void
*
data
,
unsigned
int
datalen
)
const
struct
ebt_entry
*
e
,
void
*
data
,
unsigned
int
datalen
)
{
{
struct
ebt_stp_info
*
info
=
(
struct
ebt_stp_info
*
)
data
;
struct
ebt_stp_info
*
info
=
(
struct
ebt_stp_info
*
)
data
;
int
len
=
sizeof
(
struct
ebt_stp_info
);
int
len
=
EBT_ALIGN
(
sizeof
(
struct
ebt_stp_info
)
);
uint8_t
bridge_ula
[
6
]
=
{
0x01
,
0x80
,
0xc2
,
0x00
,
0x00
,
0x00
};
uint8_t
bridge_ula
[
6
]
=
{
0x01
,
0x80
,
0xc2
,
0x00
,
0x00
,
0x00
};
uint8_t
msk
[
6
]
=
{
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
};
uint8_t
msk
[
6
]
=
{
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
};
...
...
net/bridge/netfilter/ebt_vlan.c
View file @
4a6a5161
...
@@ -35,7 +35,7 @@ MODULE_DESCRIPTION("802.1Q match module (ebtables extension), v"
...
@@ -35,7 +35,7 @@ MODULE_DESCRIPTION("802.1Q match module (ebtables extension), v"
MODULE_LICENSE
(
"GPL"
);
MODULE_LICENSE
(
"GPL"
);
#define DEBUG_MSG(
...) if (debug) printk (KERN_DEBUG "ebt_vlan: " __VA_ARGS__
)
#define DEBUG_MSG(
args...) if (debug) printk (KERN_DEBUG "ebt_vlan: " args
)
#define INV_FLAG(_inv_flag_) (info->invflags & _inv_flag_) ? "!" : ""
#define INV_FLAG(_inv_flag_) (info->invflags & _inv_flag_) ? "!" : ""
#define GET_BITMASK(_BIT_MASK_) info->bitmask & _BIT_MASK_
#define GET_BITMASK(_BIT_MASK_) info->bitmask & _BIT_MASK_
#define SET_BITMASK(_BIT_MASK_) info->bitmask |= _BIT_MASK_
#define SET_BITMASK(_BIT_MASK_) info->bitmask |= _BIT_MASK_
...
@@ -94,7 +94,7 @@ ebt_check_vlan(const char *tablename,
...
@@ -94,7 +94,7 @@ ebt_check_vlan(const char *tablename,
struct
ebt_vlan_info
*
info
=
(
struct
ebt_vlan_info
*
)
data
;
struct
ebt_vlan_info
*
info
=
(
struct
ebt_vlan_info
*
)
data
;
/* Parameters buffer overflow check */
/* Parameters buffer overflow check */
if
(
datalen
!=
sizeof
(
struct
ebt_vlan_info
))
{
if
(
datalen
!=
EBT_ALIGN
(
sizeof
(
struct
ebt_vlan_info
)
))
{
DEBUG_MSG
DEBUG_MSG
(
"passed size %d is not eq to ebt_vlan_info (%Zd)
\n
"
,
(
"passed size %d is not eq to ebt_vlan_info (%Zd)
\n
"
,
datalen
,
sizeof
(
struct
ebt_vlan_info
));
datalen
,
sizeof
(
struct
ebt_vlan_info
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment