ip_vs.h (64aae3cb9fd22f33e491c4730d363eb2229ef910) ip_vs.h (c842a3ada9ba8f0cca38a70de3fe0effcfab254c)
1/*
2 * IP Virtual Server
3 * data structure and functionality definitions
4 */
5
6#ifndef _NET_IP_VS_H
7#define _NET_IP_VS_H
8

--- 64 unchanged lines hidden (view full) ---

73#endif
74 return a->ip == b->ip;
75}
76
77#ifdef CONFIG_IP_VS_DEBUG
78#include <linux/net.h>
79
80extern int ip_vs_get_debug_level(void);
1/*
2 * IP Virtual Server
3 * data structure and functionality definitions
4 */
5
6#ifndef _NET_IP_VS_H
7#define _NET_IP_VS_H
8

--- 64 unchanged lines hidden (view full) ---

73#endif
74 return a->ip == b->ip;
75}
76
77#ifdef CONFIG_IP_VS_DEBUG
78#include <linux/net.h>
79
80extern int ip_vs_get_debug_level(void);
81
82static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
83 const union nf_inet_addr *addr,
84 int *idx)
85{
86 int len;
87#ifdef CONFIG_IP_VS_IPV6
88 if (af == AF_INET6)
89 len = snprintf(&buf[*idx], buf_len - *idx, "[" NIP6_FMT "]",
90 NIP6(addr->in6)) + 1;
91 else
92#endif
93 len = snprintf(&buf[*idx], buf_len - *idx, NIPQUAD_FMT,
94 NIPQUAD(addr->ip)) + 1;
95
96 *idx += len;
97 BUG_ON(*idx > buf_len + 1);
98 return &buf[*idx - len];
99}
100
101#define IP_VS_DBG_BUF(level, msg...) \
102 do { \
103 char ip_vs_dbg_buf[160]; \
104 int ip_vs_dbg_idx = 0; \
105 if (level <= ip_vs_get_debug_level()) \
106 printk(KERN_DEBUG "IPVS: " msg); \
107 } while (0)
108#define IP_VS_ERR_BUF(msg...) \
109 do { \
110 char ip_vs_dbg_buf[160]; \
111 int ip_vs_dbg_idx = 0; \
112 printk(KERN_ERR "IPVS: " msg); \
113 } while (0)
114
115/* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */
116#define IP_VS_DBG_ADDR(af, addr) \
117 ip_vs_dbg_addr(af, ip_vs_dbg_buf, \
118 sizeof(ip_vs_dbg_buf), addr, \
119 &ip_vs_dbg_idx)
120
81#define IP_VS_DBG(level, msg...) \
82 do { \
83 if (level <= ip_vs_get_debug_level()) \
84 printk(KERN_DEBUG "IPVS: " msg); \
85 } while (0)
86#define IP_VS_DBG_RL(msg...) \
87 do { \
88 if (net_ratelimit()) \

--- 6 unchanged lines hidden (view full) ---

95 } while (0)
96#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \
97 do { \
98 if (level <= ip_vs_get_debug_level() && \
99 net_ratelimit()) \
100 pp->debug_packet(pp, skb, ofs, msg); \
101 } while (0)
102#else /* NO DEBUGGING at ALL */
121#define IP_VS_DBG(level, msg...) \
122 do { \
123 if (level <= ip_vs_get_debug_level()) \
124 printk(KERN_DEBUG "IPVS: " msg); \
125 } while (0)
126#define IP_VS_DBG_RL(msg...) \
127 do { \
128 if (net_ratelimit()) \

--- 6 unchanged lines hidden (view full) ---

135 } while (0)
136#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \
137 do { \
138 if (level <= ip_vs_get_debug_level() && \
139 net_ratelimit()) \
140 pp->debug_packet(pp, skb, ofs, msg); \
141 } while (0)
142#else /* NO DEBUGGING at ALL */
143#define IP_VS_DBG_BUF(level, msg...) do {} while (0)
144#define IP_VS_ERR_BUF(msg...) do {} while (0)
103#define IP_VS_DBG(level, msg...) do {} while (0)
104#define IP_VS_DBG_RL(msg...) do {} while (0)
105#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) do {} while (0)
106#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) do {} while (0)
107#endif
108
109#define IP_VS_BUG() BUG()
110#define IP_VS_ERR(msg...) printk(KERN_ERR "IPVS: " msg)

--- 718 unchanged lines hidden ---
145#define IP_VS_DBG(level, msg...) do {} while (0)
146#define IP_VS_DBG_RL(msg...) do {} while (0)
147#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) do {} while (0)
148#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) do {} while (0)
149#endif
150
151#define IP_VS_BUG() BUG()
152#define IP_VS_ERR(msg...) printk(KERN_ERR "IPVS: " msg)

--- 718 unchanged lines hidden ---