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
Kirill Smelkov
linux
Commits
8813c6b1
Commit
8813c6b1
authored
Aug 02, 2004
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge nuts.davemloft.net:/disk1/BK/network-2.6
into nuts.davemloft.net:/disk1/BK/net-2.6
parents
a5cd4546
5fc17de8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
73 deletions
+76
-73
net/ipv4/netfilter/ip_nat_snmp_basic.c
net/ipv4/netfilter/ip_nat_snmp_basic.c
+71
-71
net/sched/Kconfig
net/sched/Kconfig
+5
-2
No files found.
net/ipv4/netfilter/ip_nat_snmp_basic.c
View file @
8813c6b1
...
...
@@ -862,6 +862,77 @@ static unsigned char snmp_request_decode(struct asn1_ctx *ctx,
return
1
;
}
/*
* Fast checksum update for possibly oddly-aligned UDP byte, from the
* code example in the draft.
*/
static
void
fast_csum
(
unsigned
char
*
csum
,
const
unsigned
char
*
optr
,
const
unsigned
char
*
nptr
,
int
odd
)
{
long
x
,
old
,
new
;
x
=
csum
[
0
]
*
256
+
csum
[
1
];
x
=~
x
&
0xFFFF
;
if
(
odd
)
old
=
optr
[
0
]
*
256
;
else
old
=
optr
[
0
];
x
-=
old
&
0xFFFF
;
if
(
x
<=
0
)
{
x
--
;
x
&=
0xFFFF
;
}
if
(
odd
)
new
=
nptr
[
0
]
*
256
;
else
new
=
nptr
[
0
];
x
+=
new
&
0xFFFF
;
if
(
x
&
0x10000
)
{
x
++
;
x
&=
0xFFFF
;
}
x
=~
x
&
0xFFFF
;
csum
[
0
]
=
x
/
256
;
csum
[
1
]
=
x
&
0xFF
;
}
/*
* Mangle IP address.
* - begin points to the start of the snmp messgae
* - addr points to the start of the address
*/
static
inline
void
mangle_address
(
unsigned
char
*
begin
,
unsigned
char
*
addr
,
const
struct
oct1_map
*
map
,
u_int16_t
*
check
)
{
if
(
map
->
from
==
NOCT1
(
*
addr
))
{
u_int32_t
old
;
if
(
debug
)
memcpy
(
&
old
,
(
unsigned
char
*
)
addr
,
sizeof
(
old
));
*
addr
=
map
->
to
;
/* Update UDP checksum if being used */
if
(
*
check
)
{
unsigned
char
odd
=
!
((
addr
-
begin
)
%
2
);
fast_csum
((
unsigned
char
*
)
check
,
&
map
->
from
,
&
map
->
to
,
odd
);
}
if
(
debug
)
printk
(
KERN_DEBUG
"bsalg: mapped %u.%u.%u.%u to "
"%u.%u.%u.%u
\n
"
,
NIPQUAD
(
old
),
NIPQUAD
(
*
addr
));
}
}
static
unsigned
char
snmp_trap_decode
(
struct
asn1_ctx
*
ctx
,
struct
snmp_v1_trap
*
trap
,
const
struct
oct1_map
*
map
,
...
...
@@ -952,77 +1023,6 @@ static void hex_dump(unsigned char *buf, size_t len)
printk
(
"
\n
"
);
}
/*
* Fast checksum update for possibly oddly-aligned UDP byte, from the
* code example in the draft.
*/
static
void
fast_csum
(
unsigned
char
*
csum
,
const
unsigned
char
*
optr
,
const
unsigned
char
*
nptr
,
int
odd
)
{
long
x
,
old
,
new
;
x
=
csum
[
0
]
*
256
+
csum
[
1
];
x
=~
x
&
0xFFFF
;
if
(
odd
)
old
=
optr
[
0
]
*
256
;
else
old
=
optr
[
0
];
x
-=
old
&
0xFFFF
;
if
(
x
<=
0
)
{
x
--
;
x
&=
0xFFFF
;
}
if
(
odd
)
new
=
nptr
[
0
]
*
256
;
else
new
=
nptr
[
0
];
x
+=
new
&
0xFFFF
;
if
(
x
&
0x10000
)
{
x
++
;
x
&=
0xFFFF
;
}
x
=~
x
&
0xFFFF
;
csum
[
0
]
=
x
/
256
;
csum
[
1
]
=
x
&
0xFF
;
}
/*
* Mangle IP address.
* - begin points to the start of the snmp messgae
* - addr points to the start of the address
*/
static
inline
void
mangle_address
(
unsigned
char
*
begin
,
unsigned
char
*
addr
,
const
struct
oct1_map
*
map
,
u_int16_t
*
check
)
{
if
(
map
->
from
==
NOCT1
(
*
addr
))
{
u_int32_t
old
;
if
(
debug
)
memcpy
(
&
old
,
(
unsigned
char
*
)
addr
,
sizeof
(
old
));
*
addr
=
map
->
to
;
/* Update UDP checksum if being used */
if
(
*
check
)
{
unsigned
char
odd
=
!
((
addr
-
begin
)
%
2
);
fast_csum
((
unsigned
char
*
)
check
,
&
map
->
from
,
&
map
->
to
,
odd
);
}
if
(
debug
)
printk
(
KERN_DEBUG
"bsalg: mapped %u.%u.%u.%u to "
"%u.%u.%u.%u
\n
"
,
NIPQUAD
(
old
),
NIPQUAD
(
*
addr
));
}
}
/*
* Parse and mangle SNMP message according to mapping.
* (And this is the fucking 'basic' method).
...
...
net/sched/Kconfig
View file @
8813c6b1
...
...
@@ -37,7 +37,7 @@ config NET_SCH_CLK_GETTIMEOFDAY
config NET_SCH_CLK_CPU
bool "CPU cycle counter"
depends on X86_TSC || X86_64 || SPARC64 || PPC64 || IA64
depends on X86_TSC || X86_64 ||
ALPHA ||
SPARC64 || PPC64 || IA64
help
Say Y here if you want to use the CPU's cycle counter as clock source.
This is a cheap and high resolution clock source, but on some
...
...
@@ -47,6 +47,7 @@ config NET_SCH_CLK_CPU
The useable cycle counters are:
x86/x86_64 - Timestamp Counter
alpha - Cycle Counter
sparc64 - %ticks register
ppc64 - Time base
ia64 - Interval Time Counter
...
...
@@ -212,7 +213,9 @@ config NET_SCH_NETEM
testing applications or protocols.
To compile this driver as a module, choose M here: the module
will be called sch_delay.
will be called sch_netem.
If unsure, say N.
config NET_SCH_INGRESS
tristate "Ingress Qdisc"
...
...
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