From 749bf3b265ff9735f0cba263b9116aa1d186db2c Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Tue, 29 Aug 2023 12:33:21 -0400 Subject: [PATCH] socket: add Conn.ICMPv6Filter methods Signed-off-by: Matt Layher --- conn.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/conn.go b/conn.go index 18ef65c..653f5de 100644 --- a/conn.go +++ b/conn.go @@ -538,6 +538,13 @@ func (c *Conn) Getpeername() (unix.Sockaddr, error) { return controlT(c, context.Background(), "getpeername", unix.Getpeername) } +// GetsockoptICMPv6Filter wraps getsockopt(2) for *unix.ICMPv6Filter values. +func (c *Conn) GetsockoptICMPv6Filter(level, opt int) (*unix.ICMPv6Filter, error) { + return controlT(c, context.Background(), "getsockopt", func(fd int) (*unix.ICMPv6Filter, error) { + return unix.GetsockoptICMPv6Filter(fd, level, opt) + }) +} + // GetsockoptInt wraps getsockopt(2) for integer values. func (c *Conn) GetsockoptInt(level, opt int) (int, error) { return controlT(c, context.Background(), "getsockopt", func(fd int) (int, error) { @@ -609,6 +616,13 @@ func (c *Conn) Sendto(ctx context.Context, p []byte, flags int, to unix.Sockaddr }) } +// SetsockoptICMPv6Filter wraps setsockopt(2) for *unix.ICMPv6Filter values. +func (c *Conn) SetsockoptICMPv6Filter(level, opt int, filter *unix.ICMPv6Filter) error { + return c.control(context.Background(), "setsockopt", func(fd int) error { + return unix.SetsockoptICMPv6Filter(fd, level, opt, filter) + }) +} + // SetsockoptInt wraps setsockopt(2) for integer values. func (c *Conn) SetsockoptInt(level, opt, value int) error { return c.control(context.Background(), "setsockopt", func(fd int) error {