It appears nothing is wrong with my code... it's just red hat firewalld that is blocking ospf...
On Thursday, 8 June 2017 13:37:27 UTC+1, brylant wrote: > > Hi, > > I'm trying to capture OSPF hello packets like this: > > ens192, err := net.InterfaceByName("ens192") > if err != nil { > return err > } > c, err := net.ListenPacket("ip4:89", "0.0.0.0") // ipv4 proto 89, > all local interfaces > if err != nil { > return err > } > defer c.Close() > > p := ipv4.NewPacketConn(c) > if err != nil { > return err > } > > allSPFRouters := net.ParseIP("224.0.0.5") > if err := p.JoinGroup(ens192, &net.IPAddr{IP: allSPFRouters}); > err != nil { > return err > } > > if err := p.SetControlMessage(ipv4.FlagDst|ipv4.FlagSrc|ipv4. > FlagInterface, true); err != nil { > return err > } > > b := make([]byte, 64) > for { > n, cm, src, err := p.ReadFrom(b) > _ = n > if err != nil { > return err > } > if cm.Dst.IsMulticast() { > if cm.Dst.Equal(allSPFRouters) { > fmt.Printf("OSPF hello received from %v\n" > , src) > } else { > // ignore/discard > fmt.Printf("Received packet from: %v to > %v\n", src, cm.Dst) > continue > } > } > } > return errors.New("I should never reach this point") > > but I can only see locally generaetd packets (ie. ospf process running on > the same machine) and not a trace of remote hellos (I can see them in > tcpdump though).. > > Any ideas what's wrong with my code...? > > Thanks, > > > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.