Example #1
0
static int
rtnetlink_rcv_msg(struct sk_buf *skb, struct nlmsghdr *nlh) {

//    struct net *net = sock_net(skb->sk);
    rtnl_doit_func doit;
    int sz_idx, kind;
    int family;
    int type;
    int err;

    type = nlh->nlmsg_type;
    if (type > RTM_MAX) {
        RTE_LOG(ERR, QoS, "Operation not supported!\n");
        return -EOPNOTSUPP;
    }

    type -= RTM_BASE;

    /* All the messages must have at least 1 byte length */
    if (nlmsg_len(nlh) < (int)sizeof(struct rtgenmsg)) {
        RTE_LOG(ERR, QoS, "Message is too short!\n");
        return 0;
    }

    family = ((struct rtgenmsg *)nlmsg_data(nlh))->rtgen_family;
    sz_idx = type>>2;
    kind = type&3;

//    if (kind != 2 && !ns_capable(net->user_ns, CAP_NET_ADMIN))
//           return -EPERM;
//    if (kind != 2) {
//       RTE_LOG(ERR, QoS, "Operation is not permitted!\n");
//       return -EPERM;
//   }

    if (kind == 2 && nlh->nlmsg_flags&NLM_F_DUMP) {
//            struct sock *rtnl;
           rtnl_dumpit_func dumpit;
           rtnl_calcit_func calcit;
           u16 min_dump_alloc = 0;

           dumpit = rtnl_get_dumpit(family, type);
           if (dumpit == NULL)
                   return -EOPNOTSUPP;
           calcit = rtnl_get_calcit(family, type);
           if (calcit)
                   min_dump_alloc = calcit(skb, nlh);

//           __rtnl_unlock();
//           rtnl = net->rtnl;
           {
                   struct netlink_dump_control c = {
                           .dump           = dumpit,
                           .min_dump_alloc = min_dump_alloc,
                   };
                   err = netlink_dump_start(skb, nlh, &c);
           }
//            rtnl_lock();
           return err;
    }
Example #2
0
QStringList ChrisHoliday::entries(const QDate&aDate)
{
    QStringList ret;
    ret+=_internallist.entries(aDate);
    calcit(aDate.year());
    tDayMap::Iterator it = _days.find(aDate);
    if (it!=_days.end()) {
        ret+=*it;
    }

    return ret;
}