That retrieves the socket mark, not the packet mark. The packet mark on outgoing packets gets initialized to the socket mark... On Tue, Jun 29, 2010 at 14:22, Andrew Beverley <andy@xxxxxxxxxxx> wrote: >> >I am considering patching Squid proxy so that it retains a packet's mark >> >value if it could not be fetched from the cache. Squid already has >> >similar functionality for the TOS field, but I would like to extend this >> >to netfilter's mark feature. >> > >> >Can somebody point me in the right direction for the correct way of >> >setting and accessing the mark value of a packet? The TOS feature in >> >Squid uses setsockopt(). Is there an equivalent for mark? Should I be >> >using libnetfilter_queue? >> >> setsockopt(fd, SOL_SOCKET, SO_MARK, ...) > > Thanks for the help so far. To retrieve the mark should I just be using: > > getsockopt(fd, SOL_SOCKET, SO_MARK, ...) ? > > I keep getting a mark of 0 despite setting a mark in PREROUTING. My code > is as follows: > > int mark = 0; > int marklen = sizeof(mark); > getsockopt(newsocket, SOL_SOCKET, SO_MARK, &mark, &marklen); > > > > Thanks, > > Andy > > > -- > To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html