ip_carp.h (211193) | ip_carp.h (228571) |
---|---|
1/* $FreeBSD: head/sys/netinet/ip_carp.h 211193 2010-08-11 20:18:19Z will $ */ | 1/* $FreeBSD: head/sys/netinet/ip_carp.h 228571 2011-12-16 12:16:56Z glebius $ */ |
2/* $OpenBSD: ip_carp.h,v 1.8 2004/07/29 22:12:15 mcbride Exp $ */ 3 4/* 5 * Copyright (c) 2002 Michael Shalayeff. All rights reserved. 6 * Copyright (c) 2003 Ryan McBride. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 111 unchanged lines hidden (view full) --- 121#define CARPSTATS_ADD(name, val) carpstats.name += (val) 122#define CARPSTATS_INC(name) CARPSTATS_ADD(name, 1) 123#endif 124 125/* 126 * Configuration structure for SIOCSVH SIOCGVH 127 */ 128struct carpreq { | 2/* $OpenBSD: ip_carp.h,v 1.8 2004/07/29 22:12:15 mcbride Exp $ */ 3 4/* 5 * Copyright (c) 2002 Michael Shalayeff. All rights reserved. 6 * Copyright (c) 2003 Ryan McBride. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 111 unchanged lines hidden (view full) --- 121#define CARPSTATS_ADD(name, val) carpstats.name += (val) 122#define CARPSTATS_INC(name) CARPSTATS_ADD(name, 1) 123#endif 124 125/* 126 * Configuration structure for SIOCSVH SIOCGVH 127 */ 128struct carpreq { |
129 int carpr_count; 130 int carpr_vhid; 131#define CARP_MAXVHID 255 |
|
129 int carpr_state; 130#define CARP_STATES "INIT", "BACKUP", "MASTER" 131#define CARP_MAXSTATE 2 | 132 int carpr_state; 133#define CARP_STATES "INIT", "BACKUP", "MASTER" 134#define CARP_MAXSTATE 2 |
132 int carpr_vhid; | |
133 int carpr_advskew; 134 int carpr_advbase; 135 unsigned char carpr_key[CARP_KEY_LEN]; 136}; 137#define SIOCSVH _IOWR('i', 245, struct ifreq) 138#define SIOCGVH _IOWR('i', 246, struct ifreq) 139 140/* 141 * Names for CARP sysctl objects 142 */ 143#define CARPCTL_ALLOW 1 /* accept incoming CARP packets */ 144#define CARPCTL_PREEMPT 2 /* high-pri backup preemption mode */ 145#define CARPCTL_LOG 3 /* log bad packets */ 146#define CARPCTL_STATS 4 /* statistics (read-only) */ | 135 int carpr_advskew; 136 int carpr_advbase; 137 unsigned char carpr_key[CARP_KEY_LEN]; 138}; 139#define SIOCSVH _IOWR('i', 245, struct ifreq) 140#define SIOCGVH _IOWR('i', 246, struct ifreq) 141 142/* 143 * Names for CARP sysctl objects 144 */ 145#define CARPCTL_ALLOW 1 /* accept incoming CARP packets */ 146#define CARPCTL_PREEMPT 2 /* high-pri backup preemption mode */ 147#define CARPCTL_LOG 3 /* log bad packets */ 148#define CARPCTL_STATS 4 /* statistics (read-only) */ |
147#define CARPCTL_ARPBALANCE 5 /* balance arp responses */ 148#define CARPCTL_MAXID 6 | 149#define CARPCTL_MAXID 5 |
149 150#define CARPCTL_NAMES { \ 151 { 0, 0 }, \ 152 { "allow", CTLTYPE_INT }, \ 153 { "preempt", CTLTYPE_INT }, \ 154 { "log", CTLTYPE_INT }, \ 155 { "stats", CTLTYPE_STRUCT }, \ | 150 151#define CARPCTL_NAMES { \ 152 { 0, 0 }, \ 153 { "allow", CTLTYPE_INT }, \ 154 { "preempt", CTLTYPE_INT }, \ 155 { "log", CTLTYPE_INT }, \ 156 { "stats", CTLTYPE_STRUCT }, \ |
156 { "arpbalance", CTLTYPE_INT }, \ | |
157} 158 159#ifdef _KERNEL | 157} 158 159#ifdef _KERNEL |
160void carp_carpdev_state(struct ifnet *); 161void carp_input (struct mbuf *, int); 162int carp6_input (struct mbuf **, int *, int); 163int carp_output (struct ifnet *, struct mbuf *, struct sockaddr *, 164 struct rtentry *); 165int carp_iamatch (struct ifnet *, struct in_ifaddr *, struct in_addr *, 166 u_int8_t **); | 160int carp_ioctl(struct ifreq *, u_long, struct thread *); 161int carp_attach(struct ifaddr *, int); 162void carp_detach(struct ifaddr *); 163void carp_carpdev_state(struct ifnet *); 164void carp_input (struct mbuf *, int); 165int carp6_input (struct mbuf **, int *, int); 166int carp_output (struct ifnet *, struct mbuf *, struct sockaddr *); 167int carp_iamatch(struct ifaddr *, uint8_t **); |
167struct ifaddr *carp_iamatch6(struct ifnet *, struct in6_addr *); 168caddr_t carp_macmatch6(struct ifnet *, struct mbuf *, const struct in6_addr *); | 168struct ifaddr *carp_iamatch6(struct ifnet *, struct in6_addr *); 169caddr_t carp_macmatch6(struct ifnet *, struct mbuf *, const struct in6_addr *); |
169struct ifnet *carp_forus (struct ifnet *, u_char *); | 170int carp_forus(struct ifnet *, u_char *); |
170 171/* These are external networking stack hooks for CARP */ 172/* net/if.c */ | 171 172/* These are external networking stack hooks for CARP */ 173/* net/if.c */ |
174extern int (*carp_ioctl_p)(struct ifreq *, u_long, struct thread *); 175extern int (*carp_attach_p)(struct ifaddr *, int); 176extern void (*carp_detach_p)(struct ifaddr *); |
|
173extern void (*carp_linkstate_p)(struct ifnet *); 174/* net/if_bridge.c net/if_ethersubr.c */ | 177extern void (*carp_linkstate_p)(struct ifnet *); 178/* net/if_bridge.c net/if_ethersubr.c */ |
175extern struct ifnet *(*carp_forus_p)(struct ifnet *, u_char *); | 179extern int (*carp_forus_p)(struct ifnet *, u_char *); |
176/* net/if_ethersubr.c */ 177extern int (*carp_output_p)(struct ifnet *, struct mbuf *, | 180/* net/if_ethersubr.c */ 181extern int (*carp_output_p)(struct ifnet *, struct mbuf *, |
178 struct sockaddr *, struct rtentry *); | 182 struct sockaddr *); 183/* net/rtsock.c */ 184extern int (*carp_get_vhid_p)(struct ifaddr *); |
179#ifdef INET 180/* netinet/if_ether.c */ | 185#ifdef INET 186/* netinet/if_ether.c */ |
181extern int (*carp_iamatch_p)(struct ifnet *, struct in_ifaddr *, 182 struct in_addr *, u_int8_t **); | 187extern int (*carp_iamatch_p)(struct ifaddr *, uint8_t **); |
183#endif 184#ifdef INET6 185/* netinet6/nd6_nbr.c */ 186extern struct ifaddr *(*carp_iamatch6_p)(struct ifnet *, struct in6_addr *); 187extern caddr_t (*carp_macmatch6_p)(struct ifnet *, struct mbuf *, 188 const struct in6_addr *); 189#endif 190#endif 191#endif /* _IP_CARP_H */ | 188#endif 189#ifdef INET6 190/* netinet6/nd6_nbr.c */ 191extern struct ifaddr *(*carp_iamatch6_p)(struct ifnet *, struct in6_addr *); 192extern caddr_t (*carp_macmatch6_p)(struct ifnet *, struct mbuf *, 193 const struct in6_addr *); 194#endif 195#endif 196#endif /* _IP_CARP_H */ |