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
2b6ebba8
Commit
2b6ebba8
authored
Oct 13, 2003
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge davem@nuts.ninka.net:/disk1/davem/BK/net-2.5
into kernel.bkbits.net:/home/davem/net-2.5
parents
d310cbfc
83df260d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
327 additions
and
30 deletions
+327
-30
drivers/net/Space.c
drivers/net/Space.c
+4
-6
drivers/net/wan/sealevel.c
drivers/net/wan/sealevel.c
+2
-0
drivers/net/wan/syncppp.c
drivers/net/wan/syncppp.c
+3
-0
include/linux/netfilter_bridge/ebt_among.h
include/linux/netfilter_bridge/ebt_among.h
+65
-0
include/net/syncppp.h
include/net/syncppp.h
+3
-2
net/bridge/netfilter/Kconfig
net/bridge/netfilter/Kconfig
+10
-0
net/bridge/netfilter/Makefile
net/bridge/netfilter/Makefile
+1
-0
net/bridge/netfilter/ebt_among.c
net/bridge/netfilter/ebt_among.c
+215
-0
net/ipv4/ipip.c
net/ipv4/ipip.c
+6
-5
net/ipv4/ipvs/ip_vs_core.c
net/ipv4/ipvs/ip_vs_core.c
+1
-1
net/ipv4/ipvs/ip_vs_ctl.c
net/ipv4/ipvs/ip_vs_ctl.c
+17
-16
No files found.
drivers/net/Space.c
View file @
2b6ebba8
...
@@ -433,17 +433,15 @@ void __init probe_old_netdevs(void)
...
@@ -433,17 +433,15 @@ void __init probe_old_netdevs(void)
#ifdef CONFIG_SBNI
#ifdef CONFIG_SBNI
for
(
num
=
0
;
num
<
8
;
++
num
)
for
(
num
=
0
;
num
<
8
;
++
num
)
if
(
sbni_probe
(
num
))
sbni_probe
(
num
);
break
;
#endif
#endif
#ifdef CONFIG_TR
#ifdef CONFIG_TR
for
(
num
=
0
;
num
<
8
;
++
num
)
for
(
num
=
0
;
num
<
8
;
++
num
)
if
(
trif_probe
(
num
))
trif_probe
(
num
);
break
;
#endif
#endif
for
(
num
=
0
;
num
<
8
;
++
num
)
for
(
num
=
0
;
num
<
8
;
++
num
)
if
(
ethif_probe
(
num
))
ethif_probe
(
num
);
break
;
#ifdef CONFIG_COPS
#ifdef CONFIG_COPS
cops_probe
(
0
);
cops_probe
(
0
);
cops_probe
(
1
);
cops_probe
(
1
);
...
...
drivers/net/wan/sealevel.c
View file @
2b6ebba8
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
struct
slvl_device
struct
slvl_device
{
{
void
*
if_ptr
;
/* General purpose pointer (used by SPPP) */
struct
z8530_channel
*
chan
;
struct
z8530_channel
*
chan
;
struct
ppp_device
pppdev
;
struct
ppp_device
pppdev
;
int
channel
;
int
channel
;
...
@@ -238,6 +239,7 @@ static inline struct slvl_device *slvl_alloc(int iobase, int irq)
...
@@ -238,6 +239,7 @@ static inline struct slvl_device *slvl_alloc(int iobase, int irq)
return
NULL
;
return
NULL
;
sv
=
d
->
priv
;
sv
=
d
->
priv
;
sv
->
if_ptr
=
&
sv
->
pppdev
;
sv
->
pppdev
.
dev
=
d
;
sv
->
pppdev
.
dev
=
d
;
d
->
base_addr
=
iobase
;
d
->
base_addr
=
iobase
;
d
->
irq
=
irq
;
d
->
irq
=
irq
;
...
...
drivers/net/wan/syncppp.c
View file @
2b6ebba8
...
@@ -1069,6 +1069,9 @@ void sppp_attach(struct ppp_device *pd)
...
@@ -1069,6 +1069,9 @@ void sppp_attach(struct ppp_device *pd)
struct
sppp
*
sp
=
&
pd
->
sppp
;
struct
sppp
*
sp
=
&
pd
->
sppp
;
unsigned
long
flags
;
unsigned
long
flags
;
/* Make sure embedding is safe for sppp_of */
BUG_ON
(
sppp_of
(
dev
)
!=
sp
);
spin_lock_irqsave
(
&
spppq_lock
,
flags
);
spin_lock_irqsave
(
&
spppq_lock
,
flags
);
/* Initialize keepalive handler. */
/* Initialize keepalive handler. */
if
(
!
spppq
)
if
(
!
spppq
)
...
...
include/linux/netfilter_bridge/ebt_among.h
0 → 100644
View file @
2b6ebba8
#ifndef __LINUX_BRIDGE_EBT_AMONG_H
#define __LINUX_BRIDGE_EBT_AMONG_H
#define EBT_AMONG_DST 0x01
#define EBT_AMONG_SRC 0x02
/* Grzegorz Borowiak <grzes@gnu.univ.gda.pl> 2003
*
* Write-once-read-many hash table, used for checking if a given
* MAC address belongs to a set or not and possibly for checking
* if it is related with a given IPv4 address.
*
* The hash value of an address is its last byte.
*
* In real-world ethernet addresses, values of the last byte are
* evenly distributed and there is no need to consider other bytes.
* It would only slow the routines down.
*
* For MAC address comparison speedup reasons, we introduce a trick.
* MAC address is mapped onto an array of two 32-bit integers.
* This pair of integers is compared with MAC addresses in the
* hash table, which are stored also in form of pairs of integers
* (in `cmp' array). This is quick as it requires only two elementary
* number comparisons in worst case. Further, we take advantage of
* fact that entropy of 3 last bytes of address is larger than entropy
* of 3 first bytes. So first we compare 4 last bytes of addresses and
* if they are the same we compare 2 first.
*
* Yes, it is a memory overhead, but in 2003 AD, who cares?
*/
struct
ebt_mac_wormhash_tuple
{
uint32_t
cmp
[
2
];
uint32_t
ip
;
};
struct
ebt_mac_wormhash
{
int
table
[
257
];
int
poolsize
;
struct
ebt_mac_wormhash_tuple
pool
[
0
];
};
#define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \
+ (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0)
struct
ebt_among_info
{
int
wh_dst_ofs
;
int
wh_src_ofs
;
int
bitmask
;
};
#define EBT_AMONG_DST_NEG 0x1
#define EBT_AMONG_SRC_NEG 0x2
#define ebt_among_wh_dst(x) ((x)->wh_dst_ofs ? \
(struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_dst_ofs) : NULL)
#define ebt_among_wh_src(x) ((x)->wh_src_ofs ? \
(struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_src_ofs) : NULL)
#define EBT_AMONG_MATCH "among"
#endif
include/net/syncppp.h
View file @
2b6ebba8
...
@@ -59,8 +59,9 @@ struct ppp_device
...
@@ -59,8 +59,9 @@ struct ppp_device
static
inline
struct
sppp
*
sppp_of
(
struct
net_device
*
dev
)
static
inline
struct
sppp
*
sppp_of
(
struct
net_device
*
dev
)
{
{
struct
ppp_device
*
ppp
=
dev
->
priv
;
struct
ppp_device
**
ppp
=
dev
->
priv
;
return
&
ppp
->
sppp
;
BUG_ON
((
*
ppp
)
->
dev
!=
dev
);
return
&
(
*
ppp
)
->
sppp
;
}
}
#define PP_KEEPALIVE 0x01
/* use keepalive protocol */
#define PP_KEEPALIVE 0x01
/* use keepalive protocol */
...
...
net/bridge/netfilter/Kconfig
View file @
2b6ebba8
...
@@ -55,6 +55,16 @@ config BRIDGE_EBT_802_3
...
@@ -55,6 +55,16 @@ config BRIDGE_EBT_802_3
To compile it as a module, choose M here. If unsure, say N.
To compile it as a module, choose M here. If unsure, say N.
config BRIDGE_EBT_AMONG
tristate "ebt: among filter support"
depends on BRIDGE_NF_EBTABLES
help
This option adds the among match, which allows matching the MAC source
and/or destination address on a list of addresses. Optionally,
MAC/IP address pairs can be matched, f.e. for anti-spoofing rules.
To compile it as a module, choose M here. If unsure, say N.
config BRIDGE_EBT_ARP
config BRIDGE_EBT_ARP
tristate "ebt: ARP filter support"
tristate "ebt: ARP filter support"
depends on BRIDGE_NF_EBTABLES
depends on BRIDGE_NF_EBTABLES
...
...
net/bridge/netfilter/Makefile
View file @
2b6ebba8
...
@@ -11,6 +11,7 @@ obj-$(CONFIG_BRIDGE_EBT_T_NAT) += ebtable_nat.o
...
@@ -11,6 +11,7 @@ obj-$(CONFIG_BRIDGE_EBT_T_NAT) += ebtable_nat.o
#matches
#matches
obj-$(CONFIG_BRIDGE_EBT_802_3)
+=
ebt_802_3.o
obj-$(CONFIG_BRIDGE_EBT_802_3)
+=
ebt_802_3.o
obj-$(CONFIG_BRIDGE_EBT_AMONG)
+=
ebt_among.o
obj-$(CONFIG_BRIDGE_EBT_ARP)
+=
ebt_arp.o
obj-$(CONFIG_BRIDGE_EBT_ARP)
+=
ebt_arp.o
obj-$(CONFIG_BRIDGE_EBT_IP)
+=
ebt_ip.o
obj-$(CONFIG_BRIDGE_EBT_IP)
+=
ebt_ip.o
obj-$(CONFIG_BRIDGE_EBT_LIMIT)
+=
ebt_limit.o
obj-$(CONFIG_BRIDGE_EBT_LIMIT)
+=
ebt_limit.o
...
...
net/bridge/netfilter/ebt_among.c
0 → 100644
View file @
2b6ebba8
/*
* ebt_among
*
* Authors:
* Grzegorz Borowiak <grzes@gnu.univ.gda.pl>
*
* August, 2003
*
*/
#include <linux/netfilter_bridge/ebtables.h>
#include <linux/netfilter_bridge/ebt_among.h>
#include <linux/ip.h>
#include <linux/if_arp.h>
#include <linux/module.h>
static
int
ebt_mac_wormhash_contains
(
const
struct
ebt_mac_wormhash
*
wh
,
const
char
*
mac
,
uint32_t
ip
)
{
/* You may be puzzled as to how this code works.
* Some tricks were used, refer to
* include/linux/netfilter_bridge/ebt_among.h
* as there you can find a solution of this mystery.
*/
const
struct
ebt_mac_wormhash_tuple
*
p
;
int
start
,
limit
,
i
;
uint32_t
cmp
[
2
]
=
{
0
,
0
};
int
key
=
(
const
unsigned
char
)
mac
[
5
];
memcpy
(((
char
*
)
cmp
)
+
2
,
mac
,
6
);
start
=
wh
->
table
[
key
];
limit
=
wh
->
table
[
key
+
1
];
if
(
ip
)
{
for
(
i
=
start
;
i
<
limit
;
i
++
)
{
p
=
&
wh
->
pool
[
i
];
if
(
cmp
[
1
]
==
p
->
cmp
[
1
]
&&
cmp
[
0
]
==
p
->
cmp
[
0
])
{
if
(
p
->
ip
==
0
||
p
->
ip
==
ip
)
{
return
1
;
}
}
}
}
else
{
for
(
i
=
start
;
i
<
limit
;
i
++
)
{
p
=
&
wh
->
pool
[
i
];
if
(
cmp
[
1
]
==
p
->
cmp
[
1
]
&&
cmp
[
0
]
==
p
->
cmp
[
0
])
{
if
(
p
->
ip
==
0
)
{
return
1
;
}
}
}
}
return
0
;
}
static
int
ebt_mac_wormhash_check_integrity
(
const
struct
ebt_mac_wormhash
*
wh
)
{
int
i
;
for
(
i
=
0
;
i
<
256
;
i
++
)
{
if
(
wh
->
table
[
i
]
>
wh
->
table
[
i
+
1
])
return
-
0x100
-
i
;
if
(
wh
->
table
[
i
]
<
0
)
return
-
0x200
-
i
;
if
(
wh
->
table
[
i
]
>
wh
->
poolsize
)
return
-
0x300
-
i
;
}
if
(
wh
->
table
[
256
]
>
wh
->
poolsize
)
return
-
0xc00
;
return
0
;
}
static
int
get_ip_dst
(
const
struct
sk_buff
*
skb
,
uint32_t
*
addr
)
{
if
(
skb
->
mac
.
ethernet
->
h_proto
==
__constant_htons
(
ETH_P_IP
))
{
struct
iphdr
iph
;
if
(
skb_copy_bits
(
skb
,
0
,
&
iph
,
sizeof
(
iph
)))
return
-
1
;
*
addr
=
iph
.
daddr
;
}
else
if
(
skb
->
mac
.
ethernet
->
h_proto
==
__constant_htons
(
ETH_P_ARP
))
{
struct
arphdr
arph
;
if
(
skb_copy_bits
(
skb
,
0
,
&
arph
,
sizeof
(
arph
))
||
arph
.
ar_pln
!=
sizeof
(
uint32_t
)
||
arph
.
ar_hln
!=
ETH_ALEN
)
return
-
1
;
if
(
skb_copy_bits
(
skb
,
sizeof
(
struct
arphdr
)
+
2
*
ETH_ALEN
+
sizeof
(
uint32_t
),
addr
,
sizeof
(
uint32_t
)))
return
-
1
;
}
return
0
;
}
static
int
get_ip_src
(
const
struct
sk_buff
*
skb
,
uint32_t
*
addr
)
{
if
(
skb
->
mac
.
ethernet
->
h_proto
==
__constant_htons
(
ETH_P_IP
))
{
struct
iphdr
iph
;
if
(
skb_copy_bits
(
skb
,
0
,
&
iph
,
sizeof
(
iph
)))
return
-
1
;
*
addr
=
iph
.
saddr
;
}
else
if
(
skb
->
mac
.
ethernet
->
h_proto
==
__constant_htons
(
ETH_P_ARP
))
{
struct
arphdr
arph
;
if
(
skb_copy_bits
(
skb
,
0
,
&
arph
,
sizeof
(
arph
))
||
arph
.
ar_pln
!=
sizeof
(
uint32_t
)
||
arph
.
ar_hln
!=
ETH_ALEN
)
return
-
1
;
if
(
skb_copy_bits
(
skb
,
sizeof
(
struct
arphdr
)
+
ETH_ALEN
,
addr
,
sizeof
(
uint32_t
)))
return
-
1
;
}
return
0
;
}
static
int
ebt_filter_among
(
const
struct
sk_buff
*
skb
,
const
struct
net_device
*
in
,
const
struct
net_device
*
out
,
const
void
*
data
,
unsigned
int
datalen
)
{
struct
ebt_among_info
*
info
=
(
struct
ebt_among_info
*
)
data
;
const
char
*
dmac
,
*
smac
;
const
struct
ebt_mac_wormhash
*
wh_dst
,
*
wh_src
;
uint32_t
dip
=
0
,
sip
=
0
;
wh_dst
=
ebt_among_wh_dst
(
info
);
wh_src
=
ebt_among_wh_src
(
info
);
if
(
wh_src
)
{
smac
=
skb
->
mac
.
ethernet
->
h_source
;
if
(
get_ip_src
(
skb
,
&
sip
))
return
EBT_NOMATCH
;
if
(
!
(
info
->
bitmask
&
EBT_AMONG_SRC_NEG
))
{
/* we match only if it contains */
if
(
!
ebt_mac_wormhash_contains
(
wh_src
,
smac
,
sip
))
return
EBT_NOMATCH
;
}
else
{
/* we match only if it DOES NOT contain */
if
(
ebt_mac_wormhash_contains
(
wh_src
,
smac
,
sip
))
return
EBT_NOMATCH
;
}
}
if
(
wh_dst
)
{
dmac
=
skb
->
mac
.
ethernet
->
h_dest
;
if
(
get_ip_dst
(
skb
,
&
dip
))
return
EBT_NOMATCH
;
if
(
!
(
info
->
bitmask
&
EBT_AMONG_DST_NEG
))
{
/* we match only if it contains */
if
(
!
ebt_mac_wormhash_contains
(
wh_dst
,
dmac
,
dip
))
return
EBT_NOMATCH
;
}
else
{
/* we match only if it DOES NOT contain */
if
(
ebt_mac_wormhash_contains
(
wh_dst
,
dmac
,
dip
))
return
EBT_NOMATCH
;
}
}
return
EBT_MATCH
;
}
static
int
ebt_among_check
(
const
char
*
tablename
,
unsigned
int
hookmask
,
const
struct
ebt_entry
*
e
,
void
*
data
,
unsigned
int
datalen
)
{
struct
ebt_among_info
*
info
=
(
struct
ebt_among_info
*
)
data
;
int
expected_length
=
sizeof
(
struct
ebt_among_info
);
const
struct
ebt_mac_wormhash
*
wh_dst
,
*
wh_src
;
int
err
;
wh_dst
=
ebt_among_wh_dst
(
info
);
wh_src
=
ebt_among_wh_src
(
info
);
expected_length
+=
ebt_mac_wormhash_size
(
wh_dst
);
expected_length
+=
ebt_mac_wormhash_size
(
wh_src
);
if
(
datalen
!=
EBT_ALIGN
(
expected_length
))
{
printk
(
KERN_WARNING
"ebtables: among: wrong size: %d"
"against expected %d, rounded to %d
\n
"
,
datalen
,
expected_length
,
EBT_ALIGN
(
expected_length
));
return
-
EINVAL
;
}
if
(
wh_dst
&&
(
err
=
ebt_mac_wormhash_check_integrity
(
wh_dst
)))
{
printk
(
KERN_WARNING
"ebtables: among: dst integrity fail: %x
\n
"
,
-
err
);
return
-
EINVAL
;
}
if
(
wh_src
&&
(
err
=
ebt_mac_wormhash_check_integrity
(
wh_src
)))
{
printk
(
KERN_WARNING
"ebtables: among: src integrity fail: %x
\n
"
,
-
err
);
return
-
EINVAL
;
}
return
0
;
}
static
struct
ebt_match
filter_among
=
{
.
name
=
EBT_AMONG_MATCH
,
.
match
=
ebt_filter_among
,
.
check
=
ebt_among_check
,
.
me
=
THIS_MODULE
,
};
static
int
__init
init
(
void
)
{
return
ebt_register_match
(
&
filter_among
);
}
static
void
__exit
fini
(
void
)
{
ebt_unregister_match
(
&
filter_among
);
}
module_init
(
init
);
module_exit
(
fini
);
MODULE_LICENSE
(
"GPL"
);
net/ipv4/ipip.c
View file @
2b6ebba8
...
@@ -475,11 +475,6 @@ static int ipip_rcv(struct sk_buff *skb)
...
@@ -475,11 +475,6 @@ static int ipip_rcv(struct sk_buff *skb)
goto
out
;
goto
out
;
iph
=
skb
->
nh
.
iph
;
iph
=
skb
->
nh
.
iph
;
skb
->
mac
.
raw
=
skb
->
nh
.
raw
;
skb
->
nh
.
raw
=
skb
->
data
;
memset
(
&
(
IPCB
(
skb
)
->
opt
),
0
,
sizeof
(
struct
ip_options
));
skb
->
protocol
=
htons
(
ETH_P_IP
);
skb
->
pkt_type
=
PACKET_HOST
;
read_lock
(
&
ipip_lock
);
read_lock
(
&
ipip_lock
);
if
((
tunnel
=
ipip_tunnel_lookup
(
iph
->
saddr
,
iph
->
daddr
))
!=
NULL
)
{
if
((
tunnel
=
ipip_tunnel_lookup
(
iph
->
saddr
,
iph
->
daddr
))
!=
NULL
)
{
...
@@ -488,6 +483,12 @@ static int ipip_rcv(struct sk_buff *skb)
...
@@ -488,6 +483,12 @@ static int ipip_rcv(struct sk_buff *skb)
return
0
;
return
0
;
}
}
skb
->
mac
.
raw
=
skb
->
nh
.
raw
;
skb
->
nh
.
raw
=
skb
->
data
;
memset
(
&
(
IPCB
(
skb
)
->
opt
),
0
,
sizeof
(
struct
ip_options
));
skb
->
protocol
=
htons
(
ETH_P_IP
);
skb
->
pkt_type
=
PACKET_HOST
;
tunnel
->
stat
.
rx_packets
++
;
tunnel
->
stat
.
rx_packets
++
;
tunnel
->
stat
.
rx_bytes
+=
skb
->
len
;
tunnel
->
stat
.
rx_bytes
+=
skb
->
len
;
skb
->
dev
=
tunnel
->
dev
;
skb
->
dev
=
tunnel
->
dev
;
...
...
net/ipv4/ipvs/ip_vs_core.c
View file @
2b6ebba8
...
@@ -1044,7 +1044,7 @@ ip_vs_in(unsigned int hooknum, struct sk_buff **pskb,
...
@@ -1044,7 +1044,7 @@ ip_vs_in(unsigned int hooknum, struct sk_buff **pskb,
/* increase its packet counter and check if it is needed
/* increase its packet counter and check if it is needed
to be synchronized */
to be synchronized */
atomic_inc
(
&
cp
->
in_pkts
);
atomic_inc
(
&
cp
->
in_pkts
);
if
(
ip_vs_sync_state
==
IP_VS_STATE_MASTER
&&
if
(
(
ip_vs_sync_state
&
IP_VS_STATE_MASTER
)
&&
(
cp
->
protocol
!=
IPPROTO_TCP
||
(
cp
->
protocol
!=
IPPROTO_TCP
||
cp
->
state
==
IP_VS_TCP_S_ESTABLISHED
)
&&
cp
->
state
==
IP_VS_TCP_S_ESTABLISHED
)
&&
(
atomic_read
(
&
cp
->
in_pkts
)
%
sysctl_ip_vs_sync_threshold
[
1
]
(
atomic_read
(
&
cp
->
in_pkts
)
%
sysctl_ip_vs_sync_threshold
[
1
]
...
...
net/ipv4/ipvs/ip_vs_ctl.c
View file @
2b6ebba8
...
@@ -650,6 +650,15 @@ static void ip_vs_trash_cleanup(void)
...
@@ -650,6 +650,15 @@ static void ip_vs_trash_cleanup(void)
}
}
static
void
ip_vs_zero_stats
(
struct
ip_vs_stats
*
stats
)
{
spin_lock_bh
(
&
stats
->
lock
);
memset
(
stats
,
0
,
(
char
*
)
&
stats
->
lock
-
(
char
*
)
stats
);
spin_unlock_bh
(
&
stats
->
lock
);
ip_vs_zero_estimator
(
stats
);
}
/*
/*
* Update a destination in the given service
* Update a destination in the given service
*/
*/
...
@@ -689,6 +698,7 @@ __ip_vs_update_dest(struct ip_vs_service *svc,
...
@@ -689,6 +698,7 @@ __ip_vs_update_dest(struct ip_vs_service *svc,
}
else
{
}
else
{
if
(
dest
->
svc
!=
svc
)
{
if
(
dest
->
svc
!=
svc
)
{
__ip_vs_unbind_svc
(
dest
);
__ip_vs_unbind_svc
(
dest
);
ip_vs_zero_stats
(
&
dest
->
stats
);
__ip_vs_bind_svc
(
dest
,
svc
);
__ip_vs_bind_svc
(
dest
,
svc
);
}
}
}
}
...
@@ -1276,7 +1286,7 @@ static int ip_vs_flush(void)
...
@@ -1276,7 +1286,7 @@ static int ip_vs_flush(void)
* Flush the service table hashed by fwmark
* Flush the service table hashed by fwmark
*/
*/
for
(
idx
=
0
;
idx
<
IP_VS_SVC_TAB_SIZE
;
idx
++
)
{
for
(
idx
=
0
;
idx
<
IP_VS_SVC_TAB_SIZE
;
idx
++
)
{
list_for_each_entry_safe
(
svc
,
nxt
,
list_for_each_entry_safe
(
svc
,
nxt
,
&
ip_vs_svc_fwm_table
[
idx
],
f_list
)
{
&
ip_vs_svc_fwm_table
[
idx
],
f_list
)
{
write_lock_bh
(
&
__ip_vs_svc_lock
);
write_lock_bh
(
&
__ip_vs_svc_lock
);
ip_vs_svc_unhash
(
svc
);
ip_vs_svc_unhash
(
svc
);
...
@@ -1296,15 +1306,6 @@ static int ip_vs_flush(void)
...
@@ -1296,15 +1306,6 @@ static int ip_vs_flush(void)
/*
/*
* Zero counters in a service or all services
* Zero counters in a service or all services
*/
*/
static
void
ip_vs_zero_stats
(
struct
ip_vs_stats
*
stats
)
{
spin_lock_bh
(
&
stats
->
lock
);
memset
(
stats
,
0
,
(
char
*
)
&
stats
->
lock
-
(
char
*
)
stats
);
spin_unlock_bh
(
&
stats
->
lock
);
ip_vs_zero_estimator
(
stats
);
}
static
int
ip_vs_zero_service
(
struct
ip_vs_service
*
svc
)
static
int
ip_vs_zero_service
(
struct
ip_vs_service
*
svc
)
{
{
struct
ip_vs_dest
*
dest
;
struct
ip_vs_dest
*
dest
;
...
@@ -1550,10 +1551,10 @@ static void *ip_vs_info_seq_next(struct seq_file *seq, void *v, loff_t *pos)
...
@@ -1550,10 +1551,10 @@ static void *ip_vs_info_seq_next(struct seq_file *seq, void *v, loff_t *pos)
++*
pos
;
++*
pos
;
if
(
v
==
SEQ_START_TOKEN
)
if
(
v
==
SEQ_START_TOKEN
)
return
ip_vs_info_array
(
seq
,
0
);
return
ip_vs_info_array
(
seq
,
0
);
svc
=
v
;
svc
=
v
;
iter
=
seq
->
private
;
iter
=
seq
->
private
;
if
(
iter
->
table
==
ip_vs_svc_table
)
{
if
(
iter
->
table
==
ip_vs_svc_table
)
{
/* next service in table hashed by protocol */
/* next service in table hashed by protocol */
if
((
e
=
svc
->
s_list
.
next
)
!=
&
ip_vs_svc_table
[
iter
->
bucket
])
if
((
e
=
svc
->
s_list
.
next
)
!=
&
ip_vs_svc_table
[
iter
->
bucket
])
...
@@ -1579,7 +1580,7 @@ static void *ip_vs_info_seq_next(struct seq_file *seq, void *v, loff_t *pos)
...
@@ -1579,7 +1580,7 @@ static void *ip_vs_info_seq_next(struct seq_file *seq, void *v, loff_t *pos)
scan_fwmark:
scan_fwmark:
while
(
++
iter
->
bucket
<
IP_VS_SVC_TAB_SIZE
)
{
while
(
++
iter
->
bucket
<
IP_VS_SVC_TAB_SIZE
)
{
list_for_each_entry
(
svc
,
&
ip_vs_svc_fwm_table
[
iter
->
bucket
],
list_for_each_entry
(
svc
,
&
ip_vs_svc_fwm_table
[
iter
->
bucket
],
f_list
)
f_list
)
return
svc
;
return
svc
;
}
}
...
@@ -1607,7 +1608,7 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v)
...
@@ -1607,7 +1608,7 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v)
const
struct
ip_vs_iter
*
iter
=
seq
->
private
;
const
struct
ip_vs_iter
*
iter
=
seq
->
private
;
const
struct
ip_vs_dest
*
dest
;
const
struct
ip_vs_dest
*
dest
;
if
(
iter
->
table
==
ip_vs_svc_table
)
if
(
iter
->
table
==
ip_vs_svc_table
)
seq_printf
(
seq
,
"%s %08X:%04X %s "
,
seq_printf
(
seq
,
"%s %08X:%04X %s "
,
ip_vs_proto_name
(
svc
->
protocol
),
ip_vs_proto_name
(
svc
->
protocol
),
ntohl
(
svc
->
addr
),
ntohl
(
svc
->
addr
),
...
@@ -1625,7 +1626,7 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v)
...
@@ -1625,7 +1626,7 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v)
seq_putc
(
seq
,
'\n'
);
seq_putc
(
seq
,
'\n'
);
list_for_each_entry
(
dest
,
&
svc
->
destinations
,
n_list
)
{
list_for_each_entry
(
dest
,
&
svc
->
destinations
,
n_list
)
{
seq_printf
(
seq
,
seq_printf
(
seq
,
" -> %08X:%04X %-7s %-6d %-10d %-10d
\n
"
,
" -> %08X:%04X %-7s %-6d %-10d %-10d
\n
"
,
ntohl
(
dest
->
addr
),
ntohs
(
dest
->
port
),
ntohl
(
dest
->
addr
),
ntohs
(
dest
->
port
),
ip_vs_fwd_name
(
atomic_read
(
&
dest
->
conn_flags
)),
ip_vs_fwd_name
(
atomic_read
(
&
dest
->
conn_flags
)),
...
@@ -1686,7 +1687,7 @@ static int ip_vs_stats_show(struct seq_file *seq, void *v)
...
@@ -1686,7 +1687,7 @@ static int ip_vs_stats_show(struct seq_file *seq, void *v)
/* 01234567 01234567 01234567 0123456701234567 0123456701234567 */
/* 01234567 01234567 01234567 0123456701234567 0123456701234567 */
seq_puts
(
seq
,
seq_puts
(
seq
,
" Total Incoming Outgoing Incoming Outgoing
\n
"
);
" Total Incoming Outgoing Incoming Outgoing
\n
"
);
seq_printf
(
seq
,
seq_printf
(
seq
,
" Conns Packets Packets Bytes Bytes
\n
"
);
" Conns Packets Packets Bytes Bytes
\n
"
);
spin_lock_bh
(
&
ip_vs_stats
.
lock
);
spin_lock_bh
(
&
ip_vs_stats
.
lock
);
...
...
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