Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 014d730d authored by Al Viro's avatar Al Viro Committed by David S. Miller
Browse files

[IPVS]: ipvs annotations

parent d4263cde
Loading
Loading
Loading
Loading
+34 −34
Original line number Diff line number Diff line
@@ -100,22 +100,22 @@
struct ip_vs_service_user {
	/* virtual service addresses */
	u_int16_t		protocol;
	u_int32_t		addr;		/* virtual ip address */
	u_int16_t		port;
	__be32			addr;		/* virtual ip address */
	__be16			port;
	u_int32_t		fwmark;		/* firwall mark of service */

	/* virtual service options */
	char			sched_name[IP_VS_SCHEDNAME_MAXLEN];
	unsigned		flags;		/* virtual service flags */
	unsigned		timeout;	/* persistent timeout in sec */
	u_int32_t		netmask;	/* persistent netmask */
	__be32			netmask;	/* persistent netmask */
};


struct ip_vs_dest_user {
	/* destination server address */
	u_int32_t		addr;
	u_int16_t		port;
	__be32			addr;
	__be16			port;

	/* real server options */
	unsigned		conn_flags;	/* connection flags */
@@ -163,15 +163,15 @@ struct ip_vs_getinfo {
struct ip_vs_service_entry {
	/* which service: user fills in these */
	u_int16_t		protocol;
	u_int32_t		addr;		/* virtual address */
	u_int16_t		port;
	__be32			addr;		/* virtual address */
	__be16			port;
	u_int32_t		fwmark;		/* firwall mark of service */

	/* service options */
	char			sched_name[IP_VS_SCHEDNAME_MAXLEN];
	unsigned		flags;          /* virtual service flags */
	unsigned		timeout;	/* persistent timeout */
	u_int32_t		netmask;	/* persistent netmask */
	__be32			netmask;	/* persistent netmask */

	/* number of real servers */
	unsigned int		num_dests;
@@ -182,8 +182,8 @@ struct ip_vs_service_entry {


struct ip_vs_dest_entry {
	u_int32_t		addr;		/* destination address */
	u_int16_t		port;
	__be32			addr;		/* destination address */
	__be16			port;
	unsigned		conn_flags;	/* connection flags */
	int			weight;		/* destination weight */

@@ -203,8 +203,8 @@ struct ip_vs_dest_entry {
struct ip_vs_get_dests {
	/* which service: user fills in these */
	u_int16_t		protocol;
	u_int32_t		addr;		/* virtual address */
	u_int16_t		port;
	__be32			addr;		/* virtual address */
	__be16			port;
	u_int32_t		fwmark;		/* firwall mark of service */

	/* number of real servers */
@@ -502,12 +502,12 @@ struct ip_vs_conn {
	struct list_head        c_list;         /* hashed list heads */

	/* Protocol, addresses and port numbers */
	__u32                   caddr;          /* client address */
	__u32                   vaddr;          /* virtual address */
	__u32                   daddr;          /* destination address */
	__u16                   cport;
	__u16                   vport;
	__u16                   dport;
	__be32                   caddr;          /* client address */
	__be32                   vaddr;          /* virtual address */
	__be32                   daddr;          /* destination address */
	__be16                   cport;
	__be16                   vport;
	__be16                   dport;
	__u16                   protocol;       /* Which protocol (TCP/UDP) */

	/* counter and timer */
@@ -554,12 +554,12 @@ struct ip_vs_service {
	atomic_t		usecnt;   /* use counter */

	__u16			protocol; /* which protocol (TCP/UDP) */
	__u32			addr;	  /* IP address for virtual service */
	__u16			port;	  /* port number for the service */
	__be32			addr;	  /* IP address for virtual service */
	__be16			port;	  /* port number for the service */
	__u32                   fwmark;   /* firewall mark of the service */
	unsigned		flags;	  /* service status flags */
	unsigned		timeout;  /* persistent timeout in ticks */
	__u32			netmask;  /* grouping granularity */
	__be32			netmask;  /* grouping granularity */

	struct list_head	destinations;  /* real server d-linked list */
	__u32			num_dests;     /* number of servers */
@@ -581,8 +581,8 @@ struct ip_vs_dest {
	struct list_head	n_list;   /* for the dests in the service */
	struct list_head	d_list;   /* for table with all the dests */

	__u32			addr;		/* IP address of the server */
	__u16			port;		/* port number of the server */
	__be32			addr;		/* IP address of the server */
	__be16			port;		/* port number of the server */
	volatile unsigned	flags;		/* dest status flags */
	atomic_t		conn_flags;	/* flags to copy to conn */
	atomic_t		weight;		/* server weight */
@@ -605,8 +605,8 @@ struct ip_vs_dest {
	/* for virtual service */
	struct ip_vs_service	*svc;		/* service it belongs to */
	__u16			protocol;	/* which protocol (TCP/UDP) */
	__u32			vaddr;		/* virtual IP address */
	__u16			vport;		/* virtual port number */
	__be32			vaddr;		/* virtual IP address */
	__be16			vport;		/* virtual port number */
	__u32			vfwmark;	/* firewall mark of service */
};

@@ -648,7 +648,7 @@ struct ip_vs_app
	/* members for application incarnations */
	struct list_head	p_list;		/* member in proto app list */
	struct ip_vs_app	*app;		/* its real application */
	__u16			port;		/* port number in net order */
	__be16			port;		/* port number in net order */
	atomic_t		usecnt;		/* usage counter */

	/* output hook: return false if can't linearize. diff set for TCP.  */
@@ -740,11 +740,11 @@ enum {
};

extern struct ip_vs_conn *ip_vs_conn_in_get
(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port);
(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port);
extern struct ip_vs_conn *ip_vs_ct_in_get
(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port);
(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port);
extern struct ip_vs_conn *ip_vs_conn_out_get
(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port);
(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port);

/* put back the conn without restarting its timer */
static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
@@ -752,11 +752,11 @@ static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
	atomic_dec(&cp->refcnt);
}
extern void ip_vs_conn_put(struct ip_vs_conn *cp);
extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __u16 cport);
extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport);

extern struct ip_vs_conn *
ip_vs_conn_new(int proto, __u32 caddr, __u16 cport, __u32 vaddr, __u16 vport,
	       __u32 daddr, __u16 dport, unsigned flags,
ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport,
	       __be32 daddr, __be16 dport, unsigned flags,
	       struct ip_vs_dest *dest);
extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp);

@@ -887,7 +887,7 @@ extern int sysctl_ip_vs_nat_icmp_send;
extern struct ip_vs_stats ip_vs_stats;

extern struct ip_vs_service *
ip_vs_service_get(__u32 fwmark, __u16 protocol, __u32 vaddr, __u16 vport);
ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport);

static inline void ip_vs_service_put(struct ip_vs_service *svc)
{
@@ -895,7 +895,7 @@ static inline void ip_vs_service_put(struct ip_vs_service *svc)
}

extern struct ip_vs_dest *
ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport);
ip_vs_lookup_real_service(__u16 protocol, __be32 daddr, __be16 dport);
extern int ip_vs_use_count_inc(void);
extern void ip_vs_use_count_dec(void);
extern int ip_vs_control_init(void);
+12 −12
Original line number Diff line number Diff line
@@ -115,9 +115,9 @@ static inline void ct_write_unlock_bh(unsigned key)
/*
 *	Returns hash value for IPVS connection entry
 */
static unsigned int ip_vs_conn_hashkey(unsigned proto, __u32 addr, __u16 port)
static unsigned int ip_vs_conn_hashkey(unsigned proto, __be32 addr, __be16 port)
{
	return jhash_3words(addr, port, proto, ip_vs_conn_rnd)
	return jhash_3words((__force u32)addr, (__force u32)port, proto, ip_vs_conn_rnd)
		& IP_VS_CONN_TAB_MASK;
}

@@ -188,7 +188,7 @@ static inline int ip_vs_conn_unhash(struct ip_vs_conn *cp)
 *	d_addr, d_port: pkt dest address (load balancer)
 */
static inline struct ip_vs_conn *__ip_vs_conn_in_get
(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port)
(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port)
{
	unsigned hash;
	struct ip_vs_conn *cp;
@@ -215,7 +215,7 @@ static inline struct ip_vs_conn *__ip_vs_conn_in_get
}

struct ip_vs_conn *ip_vs_conn_in_get
(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port)
(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port)
{
	struct ip_vs_conn *cp;

@@ -234,7 +234,7 @@ struct ip_vs_conn *ip_vs_conn_in_get

/* Get reference to connection template */
struct ip_vs_conn *ip_vs_ct_in_get
(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port)
(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port)
{
	unsigned hash;
	struct ip_vs_conn *cp;
@@ -274,7 +274,7 @@ struct ip_vs_conn *ip_vs_ct_in_get
 *	d_addr, d_port: pkt dest address (foreign host)
 */
struct ip_vs_conn *ip_vs_conn_out_get
(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port)
(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port)
{
	unsigned hash;
	struct ip_vs_conn *cp, *ret=NULL;
@@ -324,7 +324,7 @@ void ip_vs_conn_put(struct ip_vs_conn *cp)
/*
 *	Fill a no_client_port connection with a client port number
 */
void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __u16 cport)
void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport)
{
	if (ip_vs_conn_unhash(cp)) {
		spin_lock(&cp->lock);
@@ -508,10 +508,10 @@ int ip_vs_check_template(struct ip_vs_conn *ct)
		/*
		 * Invalidate the connection template
		 */
		if (ct->vport != 65535) {
		if (ct->vport != htons(0xffff)) {
			if (ip_vs_conn_unhash(ct)) {
				ct->dport = 65535;
				ct->vport = 65535;
				ct->dport = htons(0xffff);
				ct->vport = htons(0xffff);
				ct->cport = 0;
				ip_vs_conn_hash(ct);
			}
@@ -596,8 +596,8 @@ void ip_vs_conn_expire_now(struct ip_vs_conn *cp)
 *	Create a new connection entry and hash it into the ip_vs_conn_tab
 */
struct ip_vs_conn *
ip_vs_conn_new(int proto, __u32 caddr, __u16 cport, __u32 vaddr, __u16 vport,
	       __u32 daddr, __u16 dport, unsigned flags,
ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport,
	       __be32 daddr, __be16 dport, unsigned flags,
	       struct ip_vs_dest *dest)
{
	struct ip_vs_conn *cp;
+7 −7
Original line number Diff line number Diff line
@@ -209,14 +209,14 @@ int ip_vs_make_skb_writable(struct sk_buff **pskb, int writable_len)
static struct ip_vs_conn *
ip_vs_sched_persist(struct ip_vs_service *svc,
		    const struct sk_buff *skb,
		    __u16 ports[2])
		    __be16 ports[2])
{
	struct ip_vs_conn *cp = NULL;
	struct iphdr *iph = skb->nh.iph;
	struct ip_vs_dest *dest;
	struct ip_vs_conn *ct;
	__u16  dport;	 /* destination port to forward */
	__u32  snet;	 /* source network of the client, after masking */
	__be16  dport;	 /* destination port to forward */
	__be32  snet;	 /* source network of the client, after masking */

	/* Mask saddr with the netmask to adjust template granularity */
	snet = iph->saddr & svc->netmask;
@@ -383,7 +383,7 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
	struct ip_vs_conn *cp = NULL;
	struct iphdr *iph = skb->nh.iph;
	struct ip_vs_dest *dest;
	__u16 _ports[2], *pptr;
	__be16 _ports[2], *pptr;

	pptr = skb_header_pointer(skb, iph->ihl*4,
				  sizeof(_ports), _ports);
@@ -446,7 +446,7 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
		struct ip_vs_protocol *pp)
{
	__u16 _ports[2], *pptr;
	__be16 _ports[2], *pptr;
	struct iphdr *iph = skb->nh.iph;

	pptr = skb_header_pointer(skb, iph->ihl*4,
@@ -576,7 +576,7 @@ void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,

	/* the TCP/UDP port */
	if (IPPROTO_TCP == ciph->protocol || IPPROTO_UDP == ciph->protocol) {
		__u16 *ports = (void *)ciph + ciph->ihl*4;
		__be16 *ports = (void *)ciph + ciph->ihl*4;

		if (inout)
			ports[1] = cp->vport;
@@ -775,7 +775,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb,
		if (sysctl_ip_vs_nat_icmp_send &&
		    (pp->protocol == IPPROTO_TCP ||
		     pp->protocol == IPPROTO_UDP)) {
			__u16 _ports[2], *pptr;
			__be16 _ports[2], *pptr;

			pptr = skb_header_pointer(skb, ihl,
						  sizeof(_ports), _ports);
+13 −13
Original line number Diff line number Diff line
@@ -283,7 +283,7 @@ static atomic_t ip_vs_nullsvc_counter = ATOMIC_INIT(0);
 *	Returns hash value for virtual service
 */
static __inline__ unsigned
ip_vs_svc_hashkey(unsigned proto, __u32 addr, __u16 port)
ip_vs_svc_hashkey(unsigned proto, __be32 addr, __be16 port)
{
	register unsigned porth = ntohs(port);

@@ -365,7 +365,7 @@ static int ip_vs_svc_unhash(struct ip_vs_service *svc)
 *	Get service by {proto,addr,port} in the service table.
 */
static __inline__ struct ip_vs_service *
__ip_vs_service_get(__u16 protocol, __u32 vaddr, __u16 vport)
__ip_vs_service_get(__u16 protocol, __be32 vaddr, __be16 vport)
{
	unsigned hash;
	struct ip_vs_service *svc;
@@ -410,7 +410,7 @@ static __inline__ struct ip_vs_service *__ip_vs_svc_fwm_get(__u32 fwmark)
}

struct ip_vs_service *
ip_vs_service_get(__u32 fwmark, __u16 protocol, __u32 vaddr, __u16 vport)
ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport)
{
	struct ip_vs_service *svc;

@@ -480,7 +480,7 @@ __ip_vs_unbind_svc(struct ip_vs_dest *dest)
/*
 *	Returns hash value for real service
 */
static __inline__ unsigned ip_vs_rs_hashkey(__u32 addr, __u16 port)
static __inline__ unsigned ip_vs_rs_hashkey(__be32 addr, __be16 port)
{
	register unsigned porth = ntohs(port);

@@ -531,7 +531,7 @@ static int ip_vs_rs_unhash(struct ip_vs_dest *dest)
 *	Lookup real service by <proto,addr,port> in the real service table.
 */
struct ip_vs_dest *
ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport)
ip_vs_lookup_real_service(__u16 protocol, __be32 daddr, __be16 dport)
{
	unsigned hash;
	struct ip_vs_dest *dest;
@@ -562,7 +562,7 @@ ip_vs_lookup_real_service(__u16 protocol, __u32 daddr, __u16 dport)
 *	Lookup destination by {addr,port} in the given service
 */
static struct ip_vs_dest *
ip_vs_lookup_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport)
ip_vs_lookup_dest(struct ip_vs_service *svc, __be32 daddr, __be16 dport)
{
	struct ip_vs_dest *dest;

@@ -591,7 +591,7 @@ ip_vs_lookup_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport)
 *  scheduling.
 */
static struct ip_vs_dest *
ip_vs_trash_get_dest(struct ip_vs_service *svc, __u32 daddr, __u16 dport)
ip_vs_trash_get_dest(struct ip_vs_service *svc, __be32 daddr, __be16 dport)
{
	struct ip_vs_dest *dest, *nxt;

@@ -773,8 +773,8 @@ static int
ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest)
{
	struct ip_vs_dest *dest;
	__u32 daddr = udest->addr;
	__u16 dport = udest->port;
	__be32 daddr = udest->addr;
	__be16 dport = udest->port;
	int ret;

	EnterFunction(2);
@@ -879,8 +879,8 @@ static int
ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest)
{
	struct ip_vs_dest *dest;
	__u32 daddr = udest->addr;
	__u16 dport = udest->port;
	__be32 daddr = udest->addr;
	__be16 dport = udest->port;

	EnterFunction(2);

@@ -991,8 +991,8 @@ static int
ip_vs_del_dest(struct ip_vs_service *svc,struct ip_vs_dest_user *udest)
{
	struct ip_vs_dest *dest;
	__u32 daddr = udest->addr;
	__u16 dport = udest->port;
	__be32 daddr = udest->addr;
	__be16 dport = udest->port;

	EnterFunction(2);

+2 −2
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ struct ip_vs_dh_bucket {
/*
 *	Returns hash value for IPVS DH entry
 */
static inline unsigned ip_vs_dh_hashkey(__u32 addr)
static inline unsigned ip_vs_dh_hashkey(__be32 addr)
{
	return (ntohl(addr)*2654435761UL) & IP_VS_DH_TAB_MASK;
}
@@ -76,7 +76,7 @@ static inline unsigned ip_vs_dh_hashkey(__u32 addr)
 *      Get ip_vs_dest associated with supplied parameters.
 */
static inline struct ip_vs_dest *
ip_vs_dh_get(struct ip_vs_dh_bucket *tbl, __u32 addr)
ip_vs_dh_get(struct ip_vs_dh_bucket *tbl, __be32 addr)
{
	return (tbl[ip_vs_dh_hashkey(addr)]).dest;
}
Loading