Make the code to set the type a bit clearer.

Make it

	if (case 1)
		type = type 1;
	else if (case 2)
		type = type 2;

and indent it a bit more clearly.
Fix some socket file descriptor leaks.

Thanks to Coverity for finding the first one.  The second one wasn't as
obviously a leak, so Coverity didn't find it; don't save the socket FD
in the pcap_t structure until we've succeeded in activating the pcap_t,
so that leaks such as that will be more obvious to Coverity.
Use strlcpy() uniformly.

That ensures null-termination of strings; Coverity complained about
that.

That also obviates the need to manually null-terminate strings, so get
rid of some now-unnecessary null-termination.
And another strlcpy().

This one replaces a strcpy(); that one was also found by Coverity.

(I suppose we should check whether strlcpy() prematurely null-terminates
the string, and report a "no such device" error - or, in the create
routine, check to make sure the device name fits within all of the
relevant ioctl data structures and, if not, return a "device doesn't
exist" error.)
Make sure the device name we're handed will fit into an ioctl.

If not, the device presumably doesn't exist, as the Linux kernel
shouldn't support creating such a device; make sure we don't just use a
truncated version of the name in ioctls.
Supply an error message for "out of memory" in the create routine.