2 * Copyright (C) 2002 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * $Id: remove_hash.c,v 1.1 2003/04/13 06:40:14 darrenr Exp $
10 #include <sys/ioctl.h>
12 #include "netinet/ip_lookup.h"
13 #include "netinet/ip_htable.h"
15 static int hashfd
= -1;
18 int remove_hash(iphp
, iocfunc
)
25 if ((hashfd
== -1) && ((opts
& OPT_DONOTHING
) == 0))
26 hashfd
= open(IPLOOKUP_NAME
, O_RDWR
);
27 if ((hashfd
== -1) && ((opts
& OPT_DONOTHING
) == 0))
30 op
.iplo_type
= IPLT_HASH
;
31 op
.iplo_unit
= iphp
->iph_unit
;
32 strncpy(op
.iplo_name
, iphp
->iph_name
, sizeof(op
.iplo_name
));
33 if (*op
.iplo_name
== '\0')
34 op
.iplo_arg
= IPHASH_ANON
;
35 op
.iplo_size
= sizeof(iph
);
36 op
.iplo_struct
= &iph
;
38 bzero((char *)&iph
, sizeof(iph
));
39 iph
.iph_unit
= iphp
->iph_unit
;
40 iph
.iph_type
= iphp
->iph_type
;
41 strncpy(iph
.iph_name
, iphp
->iph_name
, sizeof(iph
.iph_name
));
42 iph
.iph_flags
= iphp
->iph_flags
;
44 if ((*iocfunc
)(hashfd
, SIOCLOOKUPDELTABLE
, &op
))
45 if ((opts
& OPT_DONOTHING
) == 0) {
46 perror("remove_hash:SIOCLOOKUPDELTABLE");