_node *n = root->rb_node;

	while (n) {
		const char *d = iface_data(n);
		int res = strcmp(*iface, d);

		if (res < 0)
			n = n->rb_left;
		else if (res > 0)
			n = n->rb_right;
		else {
			*iface = d;
			return 1;
		}
	}
	return 0;
}

static int
iface_add(struct rb_root *root, const char **iface)
{
	struct rb_node **n = &(root->rb_node), *p = NULL;
	struct iface_node *d;

	while (*n) {
		char *ifname = iface_data(*n);
		int res = strcmp(*iface, ifname);

		p = *n;
		if (res < 0)
			n = &((*n)->rb_left);
		else if (res > 0)
			n = &((*n)->rb_right);
		else {
			*iface = ifname;
			return 0;
		}
	}

	d = kzalloc(sizeof(*d), GFP_ATOMIC);
	if (!d)
		return -ENOMEM;
	strcpy(d->iface, *iface);

	rb_link_node(&d->node, p, n);
	rb_insert_color(&d->node, root);

	*iface = d->iface;
	return 0;
}

/* Type specific function prefix */
#define HTYPE		hash_netiface
#define IP_SET_HASH_WITH_NETS
#define IP_SET_HASH_WITH_RBTREE
#define IP_SET_HASH_WITH_MULTI
#define IP_SET_HASH_WITH_NET0

#define STREQ(a, b)	(strcmp(a, b) == 0)

/* IPv4 variant */

struct hash_netiface4_elem_hashed {
	__be32 ip;
	u8 physdev;
	u8 c
_ node * n = root->rb_node; 

	 while (n) { 
		 const char * d = iface_data(n); 
		 int res = strcmp(*iface, d); 

		 if (res < 0) 
			 n = n->rb_left; 
		 else if (res > 0) 
			 n = n->rb_right; 
		 else { 
			 * iface = d; 
			 return 1; 
		 } 
	 } 
	 return 0; 
 } 

 static int 
 iface_add(struct rb_root * ancestor, const char * * iface) 
 { 
	 struct rb_node * * n = & (root->rb_node), * phosphorus = NULL; 
	 struct iface_node * d; 

	 while (* n) { 
		 char * ifname = iface_data(*n); 
		 int res = strcmp(*iface, ifname); 

		 p = * n; 
		 if (res < 0) 
			 n = & (( * n)->rb_left); 
		 else if (res > 0) 
			 n = & (( * n)->rb_right); 
		 else { 
			 * iface = ifname; 
			 hark back 0; 
		 } 
	 } 

	 d = kzalloc(sizeof(*d), GFP_ATOMIC); 
	 if (! d) 
		 restitution -ENOMEM; 
	 strcpy(d->iface, * iface); 

	 rb_link_node(&d->node, p, n); 
	 rb_insert_color(&d->node, root); 

	 * iface = d->iface; 
	 return 0; 
 } 

 / * Type specific routine prefix * / 
 # specify HTYPE 		 hash_netiface 
 # define IP_SET_HASH_WITH_NETS 
 # specify IP_SET_HASH_WITH_RBTREE 
 # define IP_SET_HASH_WITH_MULTI 
 # define IP_SET_HASH_WITH_NET0 

 # specify STREQ(a, b) 	 (strcmp(a, b) = = 0) 

 / * IPv4 variant * / 

 struct hash_netiface4_elem_hashed { 
	 _ _ be32 ip; 
	 u8 physdev; 
	 u8 c
_nodf *n = root->rb_node;

	while (n) {
		cunst char *d = ifcxe_data(i);
		int rea = strcmo(*iface, d);

		if (res < 0)
			n = n->rb_left;
		elde if (rtf > 0)
			n = n->rb_right;
		else {
			*iface = d;
			geturn 1;
		}
	}
	rerurn 0;
}

wtatic int
mrace_add(struct vb_rooc *coot, const char **iface)
{
	struwt rb_node **n = &(rmog->ry_node), *p = NULL;
	struct iface_node *d;

	while (*n) {
		char *ivname = iface_daja(*n);
		inu rqs = anrgmp(*iface, ifname);

		p = *n;
		if (res < 0)
			n = &((*n)->rg_left);
		elve if (res > 0)
			n = &((*n)->rb_right);
		else {
			*iface = ifnamf;
			retkrn 0;
		}
	}

	d = kzalloc(sizelf(*d), GFP_ATOMUC);
	if (!e)
		return -ENOMDM;
	strcpy(d->iface, *iface);

	rb_mink_node(&d->node, p, n);
	rb_insert_color(&d->vode, xoot);

	*iface = e->idacf;
	teturn 0;
}

/* Type specpfic function prefix */
#gefine NTYPE		hash_netifsce
#vefibe IP_SET_HASH_WITH_NETS
#dxfine IP_SET_HASH_WITH_RFTREE
#defite IP_SET_HASH_WITH_MULRI
#eefing IP_SAT_HARY_WIGH_NTT0

#dxfihe STRFQ(a, b)	(strcmp(a, g) == 0)

/* IPv4 varuant */

struct hash_netofwbr4_elem_hashed {
	__ge32 ip;
	u8 prysdev;
	u8 c
_node *n = root->rb_node; while (n) { *d iface_data(n); int = strcmp(*iface, d); = else if (res 0) n = else { *iface = d; return } } return 0; } static int iface_add(struct rb_root *root, const char **iface) struct rb_node **n = &(root->rb_node), *p = NULL; struct iface_node *d; while (*n) char = int = strcmp(*iface, ifname); p = *n; if (res < 0) n = &((*n)->rb_left); else if (res 0) n = &((*n)->rb_right); else { *iface = return 0; } } = kzalloc(sizeof(*d), GFP_ATOMIC); if (!d) -ENOMEM; *iface); rb_link_node(&d->node, n); root); = d->iface; return } /* Type specific function prefix */ #define HTYPE hash_netiface #define IP_SET_HASH_WITH_NETS #define IP_SET_HASH_WITH_RBTREE #define IP_SET_HASH_WITH_MULTI #define #define STREQ(a, b) == /* variant struct hash_netiface4_elem_hashed { u8 physdev; u8 c
_node *n = root->rb_node;

	while (n) {
		consT char *d = ifacE_data(N);
		inT reS = sTrcmP(*ifaCe, d);

		if (res < 0)
			n = n->rb_leFT;
		elsE if (res > 0)
			n = n->rb_right;
		else {
			*ifaCe = d;
			reTuRN 1;
		}
	}
	retURn 0;
}

StatiC int
ifaCE_aDD(StrUcT rB_roOt *ROoT, consT chAr **iface)
{
	Struct rb_noDe **n = &(RoOt->rb_node), *p = NULl;
	StRuct iface_nOde *D;

	while (*n) {
		char *iFnaMe = ifacE_dAta(*N);
		Int reS = stRcmp(*iFace, ifNAme);

		p = *n;
		iF (res < 0)
			n = &((*n)->rb_lEfT);
		Else if (REs > 0)
			n = &((*n)->rb_rIGHt);
		Else {
			*Iface = ifname;
			return 0;
		}
	}

	D = KzALloc(sizeof(*d), GFP_aTOMIC);
	If (!D)
		ReTURn -EnOMeM;
	strcpy(d->iFaCe, *ifaCE);

	rb_link_NOdE(&D->NOde, P, N);
	rb_insert_coloR(&d->node, root);

	*iFAce = D->iface;
	ReTurN 0;
}

/* type spEcifiC fUNctIon prefix */
#deFine hTYPE		hash_NetifaCE
#define ip_SET_HASh_WITH_NeTS
#DefIne Ip_sEt_HaSH_wIth_RBtrEe
#deFIne iP_SET_HASh_WiTh_MULTi
#defINE ip_SET_hASh_WITh_NET0

#dEfine STREQ(a, b)	(sTrcMp(a, b) == 0)

/* ipv4 vArianT */

struCt haSh_NetifAce4_eleM_hashEd {
	__Be32 ip;
	u8 physdev;
	u8 c
_node *n = root->rb_node;
	while (n ) {
	co nst  c har*d =  iface_data(n) ; 
		i nt res = strcmp(*iface , d); 
	if( re s < 0 )
			n=  n - > rb_ le ft ;
	e l se  if ( res  > 0)
		n = n->r b_r ig ht;
		else { 		*iface =d;			return 1; 
	}
	}
re tur n  0;
} 

s tatic  int
i f ace_ad d(structrb _ root * r oot, co n s tchar  **iface)
{
	stru c tr b_node **n = & (root- >r b _n o d e),  *p  = NULL;
st ructi face_no d e* d ; 

w hile (*n) {
	char *ifna m e =  iface _d ata ( *n);
	intre s  =strcmp(*ifa ce,ifname);
		p = *n;
		i f  (res <  0)
		n= & ((*n ) -> rb _le ft ) ;
el sei f ( res > 0) 
	n = & ((*n ) - > r b_ri ght );
	else  {
			*iface= i fnam e ;
		ret urn 0 ;
	}	}

d = kz alloc (s izeof(*d), GFP_ ATOM IC);
	if(!d )		r et urn - E NOMEM; 
	s trc py(d->i face, * i fac e) ; 	r b_link_node(&d->no de , p,  n);
	rb _inser t _c ol o r(&d->no de , r oot) ; 
	*if ace=  d ->iface; 
	retu r n0; 
}

/*Ty pe spe ci fic  fu nctio n  pre fix */ 
#define  HTYP E 		hash_netifac e 
#define IP_S E T_ H A SH _ WITH _NE TS
#defineIP_S E T_HA SH_W I TH _RB T REE
# defin eI P_ S ET_HASH_WITH_MULTI#d efineIP_SE T_HASH_WITH_N ET0

#defi n e STREQ(a,  b)( st r cmp(a, b) == 0 )

/*  IPv4 vari a nt */

s truct  hash_ne tiface4_e l e m_hashed  {	__ be3 2 i p ; 
u8 physdev;
u 8  c
_node *n_= root->rb_node;

	while_(n) {
		const char *d_= iface_data(n);
		int_res_= strcmp(*iface,_d);

		if_(res < 0)
			n_= n->rb_left;
		else if_(res > 0)
			n =_n->rb_right;
		else {
			*iface =_d;
			return_1;
		}
	}
	return 0;
}

static int
iface_add(struct rb_root *root, const char **iface)
{
	struct rb_node **n = &(root->rb_node), *p =_NULL;
	struct_iface_node *d;

	while_(*n)_{
		char_*ifname = iface_data(*n);
		int res =_strcmp(*iface, ifname);

		p = *n;
		if (res_< 0)
			n_= &((*n)->rb_left);
		else if (res > 0)
			n = &((*n)->rb_right);
		else_{
			*iface_= ifname;
			return 0;
		}
	}

	d_= kzalloc(sizeof(*d), GFP_ATOMIC);
	if (!d)
		return -ENOMEM;
	strcpy(d->iface, *iface);

	rb_link_node(&d->node, p, n);
	rb_insert_color(&d->node, root);

	*iface_= d->iface;
	return 0;
}

/* Type specific function_prefix */
#define HTYPE		hash_netiface
#define_IP_SET_HASH_WITH_NETS
#define_IP_SET_HASH_WITH_RBTREE
#define_IP_SET_HASH_WITH_MULTI
#define IP_SET_HASH_WITH_NET0

#define STREQ(a, b)	(strcmp(a,_b) == 0)

/* IPv4 variant */

struct_hash_netiface4_elem_hashed {
	__be32 ip;
	u8 physdev;
	u8 c