本文整理汇总了C++中read_unlock_bh函数的典型用法代码示例。如果您正苦于以下问题:C++ read_unlock_bh函数的具体用法?C++ read_unlock_bh怎么用?C++ read_unlock_bh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了read_unlock_bh函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: lapd_pass_frame_to_socket_te
static inline int lapd_pass_frame_to_socket_te(
struct sk_buff *skb)
{
struct sock *sk;
struct hlist_node *node;
struct lapd_data_hdr *hdr = (struct lapd_data_hdr *)skb->data;
struct lapd_device *dev = to_lapd_dev(skb->dev);
int queued = 0;
read_lock_bh(&lapd_hash_lock);
sk_for_each(sk, node, lapd_get_hash(dev)) {
struct lapd_sock *lapd_sock = to_lapd_sock(sk);
if (lapd_sock->dev == dev &&
(sk->sk_state == LAPD_SK_STATE_NORMAL_DLC ||
sk->sk_state == LAPD_SK_STATE_BROADCAST_DLC) &&
lapd_sock->sapi == hdr->addr.sapi &&
lapd_sock->tei == hdr->addr.tei) {
struct sk_buff *new_skb;
if (!queued) {
new_skb = skb;
queued = TRUE;
} else {
new_skb = skb_clone(skb, GFP_ATOMIC);
}
new_skb->sk = sk;
queued = lapd_pass_frame_to_socket(
to_lapd_sock(sk), new_skb);
}
}
read_unlock_bh(&lapd_hash_lock);
return queued;
}
开发者ID:GunioRobot,项目名称:vstuff,代码行数:39,代码来源:input.c
示例2: dn_neigh_elist
int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n)
{
int t = 0;
int i;
struct neighbour *neigh;
struct dn_neigh *dn;
struct neigh_table *tbl = &dn_neigh_table;
unsigned char *rs = ptr;
struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
read_lock_bh(&tbl->lock);
for(i = 0; i < NEIGH_HASHMASK; i++) {
for(neigh = tbl->hash_buckets[i]; neigh != NULL; neigh = neigh->next) {
if (neigh->dev != dev)
continue;
dn = (struct dn_neigh *)neigh;
if (!(dn->flags & (DN_NDFLAG_R1|DN_NDFLAG_R2)))
continue;
if (dn_db->parms.forwarding == 1 && (dn->flags & DN_NDFLAG_R2))
continue;
if (t == n)
rs = dn_find_slot(ptr, n, dn->priority);
else
t++;
if (rs == NULL)
continue;
dn_dn2eth(rs, dn->addr);
rs += 6;
*rs = neigh->nud_state & NUD_CONNECTED ? 0x80 : 0x0;
*rs |= dn->priority;
rs++;
}
}
read_unlock_bh(&tbl->lock);
return t;
}
开发者ID:iPodLinux,项目名称:linux-2.6.7-ipod,代码行数:39,代码来源:dn_neigh.c
示例3: ipv6_get_lladdr
int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr)
{
struct inet6_dev *idev;
int err = -EADDRNOTAVAIL;
read_lock(&addrconf_lock);
if ((idev = __in6_dev_get(dev)) != NULL) {
struct inet6_ifaddr *ifp;
read_lock_bh(&idev->lock);
for (ifp=idev->addr_list; ifp; ifp=ifp->if_next) {
if (ifp->scope == IFA_LINK && !(ifp->flags&IFA_F_TENTATIVE)) {
ipv6_addr_copy(addr, &ifp->addr);
err = 0;
break;
}
}
read_unlock_bh(&idev->lock);
}
read_unlock(&addrconf_lock);
return err;
}
开发者ID:hugh712,项目名称:Jollen,代码行数:22,代码来源:addrconf.c
示例4: nd_flush_by_slot
s32 nd_flush_by_slot (u32 vsm_board)
{
s32 chain = 0;
struct neigh_table *tbl = &nd_tbl;
read_lock_bh (&tbl->lock);
for (chain = 0; chain <= tbl->hash_mask; chain++)
{
struct neighbour *n;
for (n = tbl->hash_buckets[chain].neighbour; n; n = n->next)
{
if (n->neigh_flags & NEIGH_MSWITCH)
{
n->neigh_index[vsm_board - g_board_offset] = 0;
}
}
}
read_unlock_bh(&tbl->lock);
return 0;
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:22,代码来源:fib6_mswitch.c
示例5: smc_lgr_free_work
static void smc_lgr_free_work(struct work_struct *work)
{
struct smc_link_group *lgr = container_of(to_delayed_work(work),
struct smc_link_group,
free_work);
bool conns;
spin_lock_bh(&smc_lgr_list.lock);
if (list_empty(&lgr->list))
goto free;
read_lock_bh(&lgr->conns_lock);
conns = RB_EMPTY_ROOT(&lgr->conns_all);
read_unlock_bh(&lgr->conns_lock);
if (!conns) { /* number of lgr connections is no longer zero */
spin_unlock_bh(&smc_lgr_list.lock);
return;
}
list_del_init(&lgr->list); /* remove from smc_lgr_list */
free:
spin_unlock_bh(&smc_lgr_list.lock);
smc_lgr_free(lgr);
}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:22,代码来源:smc_core.c
示例6: refresh_entries
/* Call this every MPC-p5 seconds. */
static void refresh_entries(struct mpoa_client *client)
{
struct timeval now;
struct in_cache_entry *entry = client->in_cache;
ddprintk("mpoa: mpoa_caches.c: refresh_entries\n");
do_gettimeofday(&now);
read_lock_bh(&client->ingress_lock);
while( entry != NULL ) {
if( entry->entry_state == INGRESS_RESOLVED ) {
if(!(entry->refresh_time))
entry->refresh_time = (2*(entry->ctrl_info.holding_time))/3;
if( (now.tv_sec - entry->reply_wait.tv_sec) > entry->refresh_time ) {
dprintk("mpoa: mpoa_caches.c: refreshing an entry.\n");
entry->entry_state = INGRESS_REFRESHING;
}
}
entry = entry->next;
}
read_unlock_bh(&client->ingress_lock);
}
开发者ID:KroMignon,项目名称:linux-emcraft,代码行数:24,代码来源:mpoa_caches.c
示例7: ip6_onlink
static int
ip6_onlink(struct in6_addr *addr, struct net_device *dev)
{
struct inet6_dev *idev;
struct inet6_ifaddr *ifa;
int onlink;
onlink = 0;
rcu_read_lock();
idev = __in6_dev_get(dev);
if (idev) {
read_lock_bh(&idev->lock);
for (ifa=idev->addr_list; ifa; ifa=ifa->if_next) {
onlink = ipv6_prefix_equal(addr, &ifa->addr,
ifa->prefix_len);
if (onlink)
break;
}
read_unlock_bh(&idev->lock);
}
rcu_read_unlock();
return onlink;
}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:23,代码来源:anycast.c
示例8: nd_restore_by_slot
s32 nd_restore_by_slot (u32 vsm_board)
{
s32 chain = 0;
s32 ret = 0;
struct neigh_table *tbl = &nd_tbl;
read_lock_bh (&tbl->lock);
for (chain = 0; chain <= tbl->hash_mask; chain++)
{
struct neighbour *n;
for (n = tbl->hash_buckets[chain].neighbour; n; n = n->next)
{
if (n->neigh_flags & NEIGH_MSWITCH)
{
ret = mswitch_nd_add (n, vsm_board);
}
}
}
read_unlock_bh(&tbl->lock);
return 0;
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:23,代码来源:fib6_mswitch.c
示例9: send_to_user
static int send_to_user(struct packet_info *info)
{
int ret;
int size;
sk_buff_data_t old_tail;
struct sk_buff *skb;
struct nlmsghdr *nlh;
struct packet_info *packet;
size = NLMSG_SPACE(sizeof(*info));
skb = alloc_skb(size, GFP_ATOMIC);
old_tail = skb->tail;
nlh = nlmsg_put(skb, 0, 0, NL_K_MSG, size - sizeof(*nlh), NLM_F_REQUEST);
if (!nlh) {
if (skb) {
kfree_skb(skb);
return -1;
}
}
packet = NLMSG_DATA(nlh);
memset(packet, 0, sizeof(struct packet_info));
packet->src = info->src;
packet->dst = info->dst;
nlh->nlmsg_len = skb->tail - old_tail;
NETLINK_CB(skb).dst_group = 0;
read_lock_bh(&user_proc.lock);
ret = netlink_unicast(nlfd, skb, user_proc.pid, MSG_DONTWAIT);
read_unlock_bh(&user_proc.lock);
return ret;
}
开发者ID:goby,项目名称:nl_test,代码行数:37,代码来源:nl_k.c
示例10: psock_write_space
static void psock_write_space(struct sock *sk)
{
struct kcm_psock *psock;
struct kcm_mux *mux;
struct kcm_sock *kcm;
read_lock_bh(&sk->sk_callback_lock);
psock = (struct kcm_psock *)sk->sk_user_data;
if (unlikely(!psock))
goto out;
mux = psock->mux;
spin_lock_bh(&mux->lock);
/* Check if the socket is reserved so someone is waiting for sending. */
kcm = psock->tx_kcm;
if (kcm && !unlikely(kcm->tx_stopped))
queue_work(kcm_wq, &kcm->tx_work);
spin_unlock_bh(&mux->lock);
out:
read_unlock_bh(&sk->sk_callback_lock);
}
开发者ID:BWhitten,项目名称:linux-stable,代码行数:24,代码来源:kcmsock.c
示例11: send_to_user
static int send_to_user(struct packet_info *info)
{
int ret;
int size;
unsigned char *old_tail;
struct sk_buff *skb;
struct nlmsghdr *nlh;
struct packet_info *packet;
size = NLMSG_SPACE(sizeof(*info));
skb = alloc_skb(size, GFP_ATOMIC);
old_tail = skb->tail;
nlh = NLMSG_PUT(skb, 0, 0, SIPFW_K_MSG, size-sizeof(*nlh));
packet = NLMSG_DATA(nlh);
memset(packet, 0, sizeof(struct packet_info));
packet->src = info->src;
packet->dest = info->dest;
nlh->nlmsg_len = skb->tail - old_tail;
NETLINK_CB(skb).dst_group = 0;
read_lock_bh(&user_proc.lock);
ret = netlink_unicast(nlfd, skb, user_proc.pid, MSG_DONTWAIT);
read_unlock_bh(&user_proc.lock);
return ret;
nlmsg_failure:
if(skb)
kfree_skb(skb);
return -1;
}
开发者ID:Afaren,项目名称:reference,代码行数:36,代码来源:sipfw_k_test.c
示例12: mpls_echo_input
//.........这里部分代码省略.........
echo->t_rcvd[0] = htonl(tv.tv_sec+JAN_1970);
echo->t_rcvd[1] = NTPFRAC(tv.tv_usec);
temp = udph->source;
udph->source = udph->dest;
udph->dest = temp;
if (MPLS_MODE_DO_NOT_REPLY == echo->mode)
{
printk("mpls_echo_input -not reply mode drop.\n");
goto drop;
}
if (MPLS_MODE_IPX_UDP_ALERT == echo->mode)
{
//Push router alert to ip option.
}
skb->protocol = htons(ETH_P_IP);
if (FIB_MG_TYPE_FTN_BASIC == res.type)
{
if (MPLS_IMPLICIT_NULL != MPLS_LABEL(res.glabel))
{
skb->protocol = htons(ETH_P_MPLS_UC) ;
skb_push_label(skb, 128, res.glabel, 1);
}
if (2 == res.count)
{
if (MPLS_IMPLICIT_NULL != MPLS_LABEL(res.glabel2))
{
skb->protocol = htons(ETH_P_MPLS_UC) ;
skb_push_label(skb, 128, res.glabel2, 0);
}
}
}
else
{
skb->protocol = htons(ETH_P_MPLS_UC) ;
skb_push_label(skb, 128, res.label, 1);
if (MPLS_IMPLICIT_NULL != MPLS_LABEL(res.glabel))
{
skb_push_label(skb, 128, res.glabel, 0);
}
if (3 == res.count)
{
if (MPLS_IMPLICIT_NULL != MPLS_LABEL(res.glabel2))
{
skb->protocol = htons(ETH_P_MPLS_UC) ;
skb_push_label(skb, 128, res.glabel2, 0);
}
}
}
if (MPLS_MODE_CTRL_CHANNEL == echo->mode)
{
skb_push_label(skb, 128, 1, 0);
}
skb->nh.raw = skb->data;
skb->dev = res.dev;
if (!res.neigh)
{
res.neigh = __neigh_arp_lookup(&arp_tbl, &res.nexthop, NULL, res.dev, NEIGHBOUR_CREAT);
}
read_lock_bh(&res.neigh->lock);
if (!(res.neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE)))
{
saddr = inet_select_addr(res.dev, res.nexthop, RT_SCOPE_LINK);
arp_send(ARPOP_REQUEST, ETH_P_ARP, res.nexthop, res.dev, saddr,
res.neigh->ha, res.dev->dev_addr, NULL);
read_unlock_bh(&res.neigh->lock);
printk("mpls_echo_input -neigh invalid drop.\n");
goto drop;
}
eth = (struct ethhdr *)skb_push(skb, ETH_HLEN);
eth->h_proto = (ETH_P_802_3 != skb->protocol) ? htons(skb->protocol) : htons(skb->len);
memcpy(eth->h_source, res.dev->dev_addr, res.dev->addr_len);
memcpy(eth->h_dest, res.neigh->ha, res.dev->addr_len);
skb->mac.raw = skb->data ;
skb->mac_len = ETH_HLEN;
read_unlock_bh(&res.neigh->lock);
neigh_release(res.neigh);
dev_queue_xmit(skb);
return 0;
drop:
kfree_skb(skb);
return -1;
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:101,代码来源:echo.c
示例13: brk_list_read_unlock
inline void brk_list_read_unlock(void) {
read_unlock_bh(&brk_list_lock);
}
开发者ID:Naturekid,项目名称:aodv-Android,代码行数:3,代码来源:brk_list.c
示例14: ipv6_flowlabel_opt
int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
{
int uninitialized_var(err);
struct net *net = sock_net(sk);
struct ipv6_pinfo *np = inet6_sk(sk);
struct in6_flowlabel_req freq;
struct ipv6_fl_socklist *sfl1=NULL;
struct ipv6_fl_socklist *sfl, **sflp;
struct ip6_flowlabel *fl, *fl1 = NULL;
if (optlen < sizeof(freq))
return -EINVAL;
if (copy_from_user(&freq, optval, sizeof(freq)))
return -EFAULT;
switch (freq.flr_action) {
case IPV6_FL_A_PUT:
write_lock_bh(&ip6_sk_fl_lock);
for (sflp = &np->ipv6_fl_list; (sfl=*sflp)!=NULL; sflp = &sfl->next) {
if (sfl->fl->label == freq.flr_label) {
if (freq.flr_label == (np->flow_label&IPV6_FLOWLABEL_MASK))
np->flow_label &= ~IPV6_FLOWLABEL_MASK;
*sflp = sfl->next;
write_unlock_bh(&ip6_sk_fl_lock);
fl_release(sfl->fl);
kfree(sfl);
return 0;
}
}
write_unlock_bh(&ip6_sk_fl_lock);
return -ESRCH;
case IPV6_FL_A_RENEW:
read_lock_bh(&ip6_sk_fl_lock);
for (sfl = np->ipv6_fl_list; sfl; sfl = sfl->next) {
if (sfl->fl->label == freq.flr_label) {
err = fl6_renew(sfl->fl, freq.flr_linger, freq.flr_expires);
read_unlock_bh(&ip6_sk_fl_lock);
return err;
}
}
read_unlock_bh(&ip6_sk_fl_lock);
if (freq.flr_share == IPV6_FL_S_NONE && capable(CAP_NET_ADMIN)) {
fl = fl_lookup(net, freq.flr_label);
if (fl) {
err = fl6_renew(fl, freq.flr_linger, freq.flr_expires);
fl_release(fl);
return err;
}
}
return -ESRCH;
case IPV6_FL_A_GET:
if (freq.flr_label & ~IPV6_FLOWLABEL_MASK)
return -EINVAL;
fl = fl_create(net, sk, &freq, optval, optlen, &err);
if (fl == NULL)
return err;
sfl1 = kmalloc(sizeof(*sfl1), GFP_KERNEL);
if (freq.flr_label) {
err = -EEXIST;
read_lock_bh(&ip6_sk_fl_lock);
for (sfl = np->ipv6_fl_list; sfl; sfl = sfl->next) {
if (sfl->fl->label == freq.flr_label) {
if (freq.flr_flags&IPV6_FL_F_EXCL) {
read_unlock_bh(&ip6_sk_fl_lock);
goto done;
}
fl1 = sfl->fl;
atomic_inc(&fl1->users);
break;
}
}
read_unlock_bh(&ip6_sk_fl_lock);
if (fl1 == NULL)
fl1 = fl_lookup(net, freq.flr_label);
if (fl1) {
recheck:
err = -EEXIST;
if (freq.flr_flags&IPV6_FL_F_EXCL)
goto release;
err = -EPERM;
if (fl1->share == IPV6_FL_S_EXCL ||
fl1->share != fl->share ||
fl1->owner != fl->owner)
goto release;
err = -EINVAL;
if (!ipv6_addr_equal(&fl1->dst, &fl->dst) ||
ipv6_opt_cmp(fl1->opt, fl->opt))
goto release;
err = -ENOMEM;
if (sfl1 == NULL)
//.........这里部分代码省略.........
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:101,代码来源:ip6_flowlabel.c
示例15: dump_packet
//.........这里部分代码省略.........
printk("GATEWAY=%pI4 ", &ich->un.gateway);
/* Fall through */
case ICMP_DEST_UNREACH:
case ICMP_SOURCE_QUENCH:
case ICMP_TIME_EXCEEDED:
/* Max length: 3+maxlen */
if (!iphoff) { /* Only recurse once. */
printk("[");
dump_packet(info, skb,
iphoff + ih->ihl*4+sizeof(_icmph));
printk("] ");
}
/* Max length: 10 "MTU=65535 " */
if (ich->type == ICMP_DEST_UNREACH &&
ich->code == ICMP_FRAG_NEEDED)
printk("MTU=%u ", ntohs(ich->un.frag.mtu));
}
break;
}
/* Max Length */
case IPPROTO_AH: {
struct ip_auth_hdr _ahdr;
const struct ip_auth_hdr *ah;
if (ntohs(ih->frag_off) & IP_OFFSET)
break;
/* Max length: 9 "PROTO=AH " */
printk("PROTO=AH ");
/* Max length: 25 "INCOMPLETE [65535 bytes] " */
ah = skb_header_pointer(skb, iphoff+ih->ihl*4,
sizeof(_ahdr), &_ahdr);
if (ah == NULL) {
printk("INCOMPLETE [%u bytes] ",
skb->len - iphoff - ih->ihl*4);
break;
}
/* Length: 15 "SPI=0xF1234567 " */
printk("SPI=0x%x ", ntohl(ah->spi));
break;
}
case IPPROTO_ESP: {
struct ip_esp_hdr _esph;
const struct ip_esp_hdr *eh;
/* Max length: 10 "PROTO=ESP " */
printk("PROTO=ESP ");
if (ntohs(ih->frag_off) & IP_OFFSET)
break;
/* Max length: 25 "INCOMPLETE [65535 bytes] " */
eh = skb_header_pointer(skb, iphoff+ih->ihl*4,
sizeof(_esph), &_esph);
if (eh == NULL) {
printk("INCOMPLETE [%u bytes] ",
skb->len - iphoff - ih->ihl*4);
break;
}
/* Length: 15 "SPI=0xF1234567 " */
printk("SPI=0x%x ", ntohl(eh->spi));
break;
}
/* Max length: 10 "PROTO 255 " */
default:
printk("PROTO=%u ", ih->protocol);
}
/* Max length: 15 "UID=4294967295 " */
if ((logflags & IPT_LOG_UID) && !iphoff && skb->sk) {
read_lock_bh(&skb->sk->sk_callback_lock);
if (skb->sk->sk_socket && skb->sk->sk_socket->file)
printk("UID=%u GID=%u ",
skb->sk->sk_socket->file->f_cred->fsuid,
skb->sk->sk_socket->file->f_cred->fsgid);
read_unlock_bh(&skb->sk->sk_callback_lock);
}
/* Max length: 16 "MARK=0xFFFFFFFF " */
if (!iphoff && skb->mark)
printk("MARK=0x%x ", skb->mark);
/* Proto Max log string length */
/* IP: 40+46+6+11+127 = 230 */
/* TCP: 10+max(25,20+30+13+9+32+11+127) = 252 */
/* UDP: 10+max(25,20) = 35 */
/* UDPLITE: 14+max(25,20) = 39 */
/* ICMP: 11+max(25, 18+25+max(19,14,24+3+n+10,3+n+10)) = 91+n */
/* ESP: 10+max(25)+15 = 50 */
/* AH: 9+max(25)+15 = 49 */
/* unknown: 10 */
/* (ICMP allows recursion one level deep) */
/* maxlen = IP + ICMP + IP + max(TCP,UDP,ICMP,unknown) */
/* maxlen = 230+ 91 + 230 + 252 = 803 */
}
开发者ID:12rafael,项目名称:jellytimekernel,代码行数:101,代码来源:ipt_LOG.c
示例16: __build_packet_message
//.........这里部分代码省略.........
if (skb->mark &&
nla_put_be32(inst->skb, NFULA_MARK, htonl(skb->mark)))
goto nla_put_failure;
if (indev && skb->dev &&
skb->mac_header != skb->network_header) {
struct nfulnl_msg_packet_hw phw;
int len;
memset(&phw, 0, sizeof(phw));
len = dev_parse_header(skb, phw.hw_addr);
if (len > 0) {
phw.hw_addrlen = htons(len);
if (nla_put(inst->skb, NFULA_HWADDR, sizeof(phw), &phw))
goto nla_put_failure;
}
}
if (indev && skb_mac_header_was_set(skb)) {
if (nla_put_be16(inst->skb, NFULA_HWTYPE, htons(skb->dev->type)) ||
nla_put_be16(inst->skb, NFULA_HWLEN,
htons(skb->dev->hard_header_len)))
goto nla_put_failure;
hwhdrp = skb_mac_header(skb);
if (skb->dev->type == ARPHRD_SIT)
hwhdrp -= ETH_HLEN;
if (hwhdrp >= skb->head &&
nla_put(inst->skb, NFULA_HWHEADER,
skb->dev->hard_header_len, hwhdrp))
goto nla_put_failure;
}
if (skb->tstamp) {
struct nfulnl_msg_packet_timestamp ts;
struct timespec64 kts = ktime_to_timespec64(skb->tstamp);
ts.sec = cpu_to_be64(kts.tv_sec);
ts.usec = cpu_to_be64(kts.tv_nsec / NSEC_PER_USEC);
if (nla_put(inst->skb, NFULA_TIMESTAMP, sizeof(ts), &ts))
goto nla_put_failure;
}
/* UID */
sk = skb->sk;
if (sk && sk_fullsock(sk)) {
read_lock_bh(&sk->sk_callback_lock);
if (sk->sk_socket && sk->sk_socket->file) {
struct file *file = sk->sk_socket->file;
const struct cred *cred = file->f_cred;
struct user_namespace *user_ns = inst->peer_user_ns;
__be32 uid = htonl(from_kuid_munged(user_ns, cred->fsuid));
__be32 gid = htonl(from_kgid_munged(user_ns, cred->fsgid));
read_unlock_bh(&sk->sk_callback_lock);
if (nla_put_be32(inst->skb, NFULA_UID, uid) ||
nla_put_be32(inst->skb, NFULA_GID, gid))
goto nla_put_failure;
} else
read_unlock_bh(&sk->sk_callback_lock);
}
/* local sequence number */
if ((inst->flags & NFULNL_CFG_F_SEQ) &&
nla_put_be32(inst->skb, NFULA_SEQ, htonl(inst->seq++)))
goto nla_put_failure;
/* global sequence number */
if ((inst->flags & NFULNL_CFG_F_SEQ_GLOBAL) &&
nla_put_be32(inst->skb, NFULA_SEQ_GLOBAL,
htonl(atomic_inc_return(&log->global_seq))))
goto nla_put_failure;
if (ct && nfnl_ct->build(inst->skb, ct, ctinfo,
NFULA_CT, NFULA_CT_INFO) < 0)
goto nla_put_failure;
if (data_len) {
struct nlattr *nla;
int size = nla_attr_size(data_len);
if (skb_tailroom(inst->skb) < nla_total_size(data_len))
goto nla_put_failure;
nla = skb_put(inst->skb, nla_total_size(data_len));
nla->nla_type = NFULA_PAYLOAD;
nla->nla_len = size;
if (skb_copy_bits(skb, 0, nla_data(nla), data_len))
BUG();
}
nlh->nlmsg_len = inst->skb->tail - old_tail;
return 0;
nla_put_failure:
PRINTR(KERN_ERR "nfnetlink_log: error creating log nlmsg\n");
return -1;
}
开发者ID:SantoshShilimkar,项目名称:linux,代码行数:101,代码来源:nfnetlink_log.c
示例17: solaris_i
static inline int solaris_i(unsigned int fd, unsigned int cmd, u32 arg)
{
switch (cmd & 0xff) {
case 12: /* SIOCSIFADDR */
return compat_sys_ioctl(fd, SIOCSIFADDR, arg);
case 13: /* SIOCGIFADDR */
return compat_sys_ioctl(fd, SIOCGIFADDR, arg);
case 14: /* SIOCSIFDSTADDR */
return compat_sys_ioctl(fd, SIOCSIFDSTADDR, arg);
case 15: /* SIOCGIFDSTADDR */
return compat_sys_ioctl(fd, SIOCGIFDSTADDR, arg);
case 16: /* SIOCSIFFLAGS */
return compat_sys_ioctl(fd, SIOCSIFFLAGS, arg);
case 17: /* SIOCGIFFLAGS */
return compat_sys_ioctl(fd, SIOCGIFFLAGS, arg);
case 18: /* SIOCSIFMEM */
return compat_sys_ioctl(fd, SIOCSIFMEM, arg);
case 19: /* SIOCGIFMEM */
return compat_sys_ioctl(fd, SIOCGIFMEM, arg);
case 20: /* SIOCGIFCONF */
return compat_sys_ioctl(fd, SIOCGIFCONF, arg);
case 21: /* SIOCSIFMTU */
return compat_sys_ioctl(fd, SIOCSIFMTU, arg);
case 22: /* SIOCGIFMTU */
return compat_sys_ioctl(fd, SIOCGIFMTU, arg);
case 23: /* SIOCGIFBRDADDR */
return compat_sys_ioctl(fd, SIOCGIFBRDADDR, arg);
case 24: /* SIOCSIFBRDADDR */
return compat_sys_ioctl(fd, SIOCSIFBRDADDR, arg);
case 25: /* SIOCGIFNETMASK */
return compat_sys_ioctl(fd, SIOCGIFNETMASK, arg);
case 26: /* SIOCSIFNETMASK */
return compat_sys_ioctl(fd, SIOCSIFNETMASK, arg);
case 27: /* SIOCGIFMETRIC */
return compat_sys_ioctl(fd, SIOCGIFMETRIC, arg);
case 28: /* SIOCSIFMETRIC */
return compat_sys_ioctl(fd, SIOCSIFMETRIC, arg);
case 30: /* SIOCSARP */
return compat_sys_ioctl(fd, SIOCSARP, arg);
case 31: /* SIOCGARP */
return compat_sys_ioctl(fd, SIOCGARP, arg);
case 32: /* SIOCDARP */
return compat_sys_ioctl(fd, SIOCDARP, arg);
case 52: /* SIOCGETNAME */
case 53: /* SIOCGETPEER */
{
struct sockaddr uaddr;
int uaddr_len = sizeof(struct sockaddr), ret;
long args[3];
mm_segment_t old_fs = get_fs();
int (*sys_socketcall)(int, unsigned long *) =
(int (*)(int, unsigned long *))SYS(socketcall);
args[0] = fd; args[1] = (long)&uaddr; args[2] = (long)&uaddr_len;
set_fs(KERNEL_DS);
ret = sys_socketcall(((cmd & 0xff) == 52) ? SYS_GETSOCKNAME : SYS_GETPEERNAME,
args);
set_fs(old_fs);
if (ret >= 0) {
if (copy_to_user((char *)A(arg), &uaddr, uaddr_len))
return -EFAULT;
}
return ret;
}
#if 0
case 86: /* SIOCSOCKSYS */
return socksys_syscall(fd, arg);
#endif
case 87: /* SIOCGIFNUM */
{
struct net_device *d;
int i = 0;
read_lock_bh(&dev_base_lock);
for (d = dev_base; d; d = d->next) i++;
read_unlock_bh(&dev_base_lock);
if (put_user (i, (int *)A(arg)))
return -EFAULT;
return 0;
}
}
return -ENOSYS;
}
开发者ID:sarnobat,项目名称:knoppix,代码行数:84,代码来源:ioctl.c
示例18: arp_solicit
static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
{
__be32 saddr = 0;
u8 *dst_ha = NULL;
struct net_device *dev = neigh->dev;
__be32 target = *(__be32 *)neigh->primary_key;
int probes = atomic_read(&neigh->probes);
struct in_device *in_dev;
#ifdef CONFIG_HTC_NETWORK_CNE
__be32 dev_addr = 0;
dev_addr = inet_select_addr(dev, target, RT_SCOPE_LINK);
#endif
rcu_read_lock();
in_dev = __in_dev_get_rcu(dev);
if (!in_dev) {
rcu_read_unlock();
return;
}
switch (IN_DEV_ARP_ANNOUNCE(in_dev)) {
default:
case 0:
if (skb && inet_addr_type(dev_net(dev),
ip_hdr(skb)->saddr) == RTN_LOCAL)
saddr = ip_hdr(skb)->saddr;
break;
case 1:
if (!skb)
break;
saddr = ip_hdr(skb)->saddr;
if (inet_addr_type(dev_net(dev), saddr) == RTN_LOCAL) {
if (inet_addr_onlink(in_dev, target, saddr))
break;
}
saddr = 0;
break;
case 2:
break;
}
rcu_read_unlock();
if (!saddr)
saddr = inet_select_addr(dev, target, RT_SCOPE_LINK);
probes -= neigh->parms->ucast_probes;
if (probes < 0) {
if (!(neigh->nud_state & NUD_VALID))
printk(KERN_DEBUG
"trying to ucast probe in NUD_INVALID\n");
dst_ha = neigh->ha;
read_lock_bh(&neigh->lock);
} else {
probes -= neigh->parms->app_probes;
if (probes < 0) {
#ifdef CONFIG_ARPD
neigh_app_ns(neigh);
#endif
return;
}
}
#ifdef CONFIG_HTC_NETWORK_CNE
if (dev_addr != saddr)
{
printk(KERN_DEBUG "CnE detects wrong sender IP in ARP\n");
saddr = dev_addr;
}
#endif
arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
dst_ha, dev->dev_addr, NULL);
if (dst_ha)
read_unlock_bh(&neigh->lock);
}
开发者ID:Alex-V2,项目名称:One_M8_4.4.3_kernel,代码行数:80,代码来源:arp.c
示例19: dump_packet
//.........这里部分代码省略.........
case IPPROTO_UDP:
case IPPROTO_UDPLITE: {
struct udphdr _udph;
const struct udphdr *uh;
if (currenthdr == IPPROTO_UDP)
/* Max length: 10 "PROTO=UDP " */
printk("PROTO=UDP " );
else /* Max length: 14 "PROTO=UDPLITE " */
printk("PROTO=UDPLITE ");
if (fragment)
break;
/* Max length: 25 "INCOMPLETE [65535 bytes] " */
uh = skb_header_pointer(skb, ptr, sizeof(_udph), &_udph);
if (uh == NULL) {
printk("INCOMPLETE [%u bytes] ", skb->len - ptr);
return;
}
/* Max length: 20 "SPT=65535 DPT=65535 " */
printk("SPT=%u DPT=%u LEN=%u ",
ntohs(uh->source), ntohs(uh->dest),
ntohs(uh->len));
break;
}
case IPPROTO_ICMPV6: {
struct icmp6hdr _icmp6h;
const struct icmp6hdr *ic;
/* Max length: 13 "PROTO=ICMPv6 " */
printk("PROTO=ICMPv6 ");
if (fragment)
break;
/* Max length: 25 "INCOMPLETE [65535 bytes] " */
ic = skb_header_pointer(skb, ptr, sizeof(_icmp6h), &_icmp6h);
if (ic == NULL) {
printk("INCOMPLETE [%u bytes] ", skb->len - ptr);
return;
}
/* Max length: 18 "TYPE=255 CODE=255 " */
printk("TYPE=%u CODE=%u ", ic->icmp6_type, ic->icmp6_code);
switch (ic->icmp6_type) {
case ICMPV6_ECHO_REQUEST:
case ICMPV6_ECHO_REPLY:
/* Max length: 19 "ID=65535 SEQ=65535 " */
printk("ID=%u SEQ=%u ",
ntohs(ic->icmp6_identifier),
ntohs(ic->icmp6_sequence));
break;
case ICMPV6_MGM_QUERY:
case ICMPV6_MGM_REPORT:
case ICMPV6_MGM_REDUCTION:
break;
case ICMPV6_PARAMPROB:
/* Max length: 17 "POINTER=ffffffff " */
printk("POINTER=%08x ", ntohl(ic->icmp6_pointer));
/* Fall through */
case ICMPV6_DEST_UNREACH:
case ICMPV6_PKT_TOOBIG:
case ICMPV6_TIME_EXCEED:
/* Max length: 3+maxlen */
if (recurse) {
printk("[");
dump_packet(info, skb, ptr + sizeof(_icmp6h),
0);
printk("] ");
}
/* Max length: 10 "MTU=65535 " */
if (ic->icmp6_type == ICMPV6_PKT_TOOBIG)
printk("MTU=%u ", ntohl(ic->icmp6_mtu));
}
break;
}
/* Max length: 10 "PROTO=255 " */
default:
printk("PROTO=%u ", currenthdr);
}
/* Max length: 15 "UID=4294967295 " */
if ((logflags & IP6T_LOG_UID) && recurse && skb->sk) {
read_lock_bh(&skb->sk->sk_callback_lock);
if (skb->sk->sk_socket && skb->sk->sk_socket->file)
printk("UID=%u GID=%u ",
skb->sk->sk_socket->file->f_cred->fsuid,
skb->sk->sk_socket->file->f_cred->fsgid);
read_unlock_bh(&skb->sk->sk_callback_lock);
}
/* Max length: 16 "MARK=0xFFFFFFFF " */
if (!recurse && skb->mark)
printk("MARK=0x%x ", skb->mark);
}
开发者ID:patrick-ken,项目名称:kernel_808l,代码行数:101,代码来源:ip6t_LOG.c
示例20: ip6fl_seq_stop
static void ip6fl_seq_stop(struct seq_file *seq, void *v)
{
read_unlock_bh(&ip6_fl_lock);
}
开发者ID:gizm0n,项目名称:wl500g,代码行数:4,代码来源:ip6_flowlabel.c
注:本文中的read_unlock_bh函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论