func (cm *ControlMessage) Marshal() []byte {
	if cm == nil {
		return nil
	}
	var m socket.ControlMessage
	if ctlOpts[ctlPacketInfo].name > 0 && (cm.Src.To4() != nil || cm.IfIndex > 0) {
		m = socket.NewControlMessage([]int{ctlOpts[ctlPacketInfo].length})
	}
	if len(m) > 0 {
		ctlOpts[ctlPacketInfo].marshal(m, cm)
	}
	return m
}
Marshal returns the binary encoding of cm.
package ipv4
import (
	"fmt"
	"net"
	"sync"
	"golang.org/x/net/internal/iana"
	"golang.org/x/net/internal/socket"
)
type rawOpt struct {
	sync.RWMutex
	cflags ControlFlags
}
func (c *rawOpt) set(f ControlFlags)        { c.cflags |= f }
func (c *rawOpt) clear(f ControlFlags)      { c.cflags &^= f }
func (c *rawOpt) isset(f ControlFlags) bool { return c.cflags&f != 0 }
type ControlFlags uint
const (
	FlagTTL       ControlFlags = 1 << iota  
	FlagSrc                                 
	FlagDst                                 
	FlagInterface                           
)
type ControlMessage struct {
	TTL     int     
	Src     net.IP  
	Dst     net.IP  
	IfIndex int     
}
func (cm *ControlMessage) String() string {
	if cm == nil {
		return "<nil>"
	}
	return fmt.Sprintf("ttl=%d src=%v dst=%v ifindex=%d", cm.TTL, cm.Src, cm.Dst, cm.IfIndex)
}