4 * Copyright (C) 2003 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
8 * Id: remove_hashnode.c,v 1.1.4.1 2006/06/16 17:21:16 darrenr Exp
12 #include <sys/ioctl.h>
14 #include "netinet/ip_lookup.h"
15 #include "netinet/ip_htable.h"
17 static int hashfd
= -1;
20 int remove_hashnode(unit
, name
, node
, iocfunc
)
29 if ((hashfd
== -1) && ((opts
& OPT_DONOTHING
) == 0))
30 hashfd
= open(IPLOOKUP_NAME
, O_RDWR
);
31 if ((hashfd
== -1) && ((opts
& OPT_DONOTHING
) == 0))
34 op
.iplo_type
= IPLT_HASH
;
36 op
.iplo_size
= sizeof(ipe
);
37 op
.iplo_struct
= &ipe
;
39 strncpy(op
.iplo_name
, name
, sizeof(op
.iplo_name
));
41 bzero((char *)&ipe
, sizeof(ipe
));
42 bcopy((char *)&node
->ipe_addr
, (char *)&ipe
.ipe_addr
,
43 sizeof(ipe
.ipe_addr
));
44 bcopy((char *)&node
->ipe_mask
, (char *)&ipe
.ipe_mask
,
45 sizeof(ipe
.ipe_mask
));
47 if (opts
& OPT_DEBUG
) {
48 printf("\t%s - ", inet_ntoa(ipe
.ipe_addr
.in4
));
49 printf("%s\n", inet_ntoa(ipe
.ipe_mask
.in4
));
52 if ((*iocfunc
)(hashfd
, SIOCLOOKUPDELNODE
, &op
))
53 if (!(opts
& OPT_DONOTHING
)) {
54 perror("remove_hash:SIOCLOOKUPDELNODE");