~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to include/net/netlink.h

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
192
192
 *    NLA_NUL_STRING       Maximum length of string (excluding NUL)
193
193
 *    NLA_FLAG             Unused
194
194
 *    NLA_BINARY           Maximum length of attribute payload
195
 
 *    NLA_NESTED_COMPAT    Exact length of structure payload
196
 
 *    All other            Exact length of attribute payload
 
195
 *    NLA_NESTED           Don't use `len' field -- length verification is
 
196
 *                         done by checking len of nested header (or empty)
 
197
 *    NLA_NESTED_COMPAT    Minimum length of structure payload
 
198
 *    NLA_U8, NLA_U16,
 
199
 *    NLA_U32, NLA_U64,
 
200
 *    NLA_MSECS            Leaving the length field zero will verify the
 
201
 *                         given type fits, using it verifies minimum length
 
202
 *                         just like "All other"
 
203
 *    All other            Minimum length of attribute payload
197
204
 *
198
205
 * Example:
199
206
 * static const struct nla_policy my_policy[ATTR_MAX+1] = {
638
645
             nlmsg_ok(pos, rem); \
639
646
             pos = nlmsg_next(pos, &(rem)))
640
647
 
 
648
/**
 
649
 * nl_dump_check_consistent - check if sequence is consistent and advertise if not
 
650
 * @cb: netlink callback structure that stores the sequence number
 
651
 * @nlh: netlink message header to write the flag to
 
652
 *
 
653
 * This function checks if the sequence (generation) number changed during dump
 
654
 * and if it did, advertises it in the netlink message header.
 
655
 *
 
656
 * The correct way to use it is to set cb->seq to the generation counter when
 
657
 * all locks for dumping have been acquired, and then call this function for
 
658
 * each message that is generated.
 
659
 *
 
660
 * Note that due to initialisation concerns, 0 is an invalid sequence number
 
661
 * and must not be used by code that uses this functionality.
 
662
 */
 
663
static inline void
 
664
nl_dump_check_consistent(struct netlink_callback *cb,
 
665
                         struct nlmsghdr *nlh)
 
666
{
 
667
        if (cb->prev_seq && cb->seq != cb->prev_seq)
 
668
                nlh->nlmsg_flags |= NLM_F_DUMP_INTR;
 
669
        cb->prev_seq = cb->seq;
 
670
}
 
671
 
641
672
/**************************************************************************
642
673
 * Netlink Attributes
643
674
 **************************************************************************/