Refactoring multicast setsockopt