Nmap Development mailing list archives

Re: Nsock IOCP engine review


From: Henri Doreau <henri.doreau () gmail com>
Date: Thu, 11 Aug 2016 15:07:31 +0200

Hello,

can you start with these changes?
  - move IOCP-specific structures from struct npool to engine_data;
  - remove useless strcmp(nsp->engine->name, "iocp") from nsock_iocp.c calls;
  - refactor nsock_iocp.c code a bit, there is a lot of duplicated code there;
  - replace assertions by proper error handling;
  - merge nsock_iocp.c to engine_iocp.c.


Now for the engine API change:

2016-08-10 23:30 GMT+02:00 Tudor-Emil COMAN <tudor_emil.coman () cti pub ro>:
To eliminate that anti-pattern we would need to add the following functions
to io_engine.


int(*event_initiate)(struct npool *nsp, struct nevent *nse);
int(*event_terminate)(struct npool *nsp, struct nevent *nse);

Can this fit into nsock_engine_iod_{register,modify,unregister}? By
passing in the struct nevent for example?

int(*iod_connect)(struct npool *nsp, int sockfd, const struct sockaddr
*addr, socklen_t addrlen);
int(*iod_read)(struct npool *nsp, int sockfd, void *buf, size_t len, int
flags,
                      struct sockaddr *src_addr, socklen_t *addrlen);
int(*iod_write)(struct npool *nsp, int sockfd, const void *buf, size_t len,
int flags,
                       const struct sockaddr *dest_addr, socklen_t addrlen);

This sounds reasonable, according to what I can read about IOCP. Let's
go for a struct io_operations {...}, referenced by the engine
definitions. Two statically defined ones: posix & iocp.

For any other engine except iocp:
  - event_initiate and event_terminate are empty
  - iod_connect, iod_read, iod_write are wrappers over connect, sendto,
recvfrom

I took all the code from nsock_iocp.c and added it to engine_iocp.c.
Everything I added to struct npool can be moved to iocp_engine_info.

With these we can contain everything iocp related to engine_iocp.c.

Are these changes acceptable?

Cheers,
Tudor


Please apply the changes to a separate branch (or send patches to the
list), so that they can be reviewed first. Once ready and before
merging into svn trunk, do not hesitate to call for testing on the
list. Many people have specific setups, scanning practices etc. It is
an excellent way to actually stress things and uncover defects before
they even touch svn trunk.

Regarding testing: have you script/version-scanned SSL-enabled
services with the IOCP engine? Are the results perfectly identical
regardless the selected engine? What about proxy support? What about
pcap?

Regards

-- 
Henri
_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: