Lines Matching refs:info
46 static struct l2tp_session *l2tp_nl_session_get(struct genl_info *info)
53 struct net *net = genl_info_net(info);
55 if (info->attrs[L2TP_ATTR_IFNAME]) {
56 ifname = nla_data(info->attrs[L2TP_ATTR_IFNAME]);
58 } else if ((info->attrs[L2TP_ATTR_SESSION_ID]) &&
59 (info->attrs[L2TP_ATTR_CONN_ID])) {
60 tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);
61 session_id = nla_get_u32(info->attrs[L2TP_ATTR_SESSION_ID]);
72 static int l2tp_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
84 hdr = genlmsg_put(msg, info->snd_portid, info->snd_seq,
93 return genlmsg_unicast(genl_info_net(info), msg, info->snd_portid);
103 struct genl_info *info,
114 ret = l2tp_nl_tunnel_send(msg, info->snd_portid, info->snd_seq,
131 struct genl_info *info,
142 ret = l2tp_nl_session_send(msg, info->snd_portid, info->snd_seq,
184 static int l2tp_nl_cmd_tunnel_create(struct sk_buff *skb, struct genl_info *info)
193 struct net *net = genl_info_net(info);
194 struct nlattr **attrs = info->attrs;
250 ret = l2tp_tunnel_notify(&l2tp_nl_family, info, tunnel,
258 static int l2tp_nl_cmd_tunnel_delete(struct sk_buff *skb, struct genl_info *info)
263 struct net *net = genl_info_net(info);
265 if (!info->attrs[L2TP_ATTR_CONN_ID]) {
269 tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);
277 l2tp_tunnel_notify(&l2tp_nl_family, info,
288 static int l2tp_nl_cmd_tunnel_modify(struct sk_buff *skb, struct genl_info *info)
293 struct net *net = genl_info_net(info);
295 if (!info->attrs[L2TP_ATTR_CONN_ID]) {
299 tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);
307 ret = l2tp_tunnel_notify(&l2tp_nl_family, info,
449 static int l2tp_nl_cmd_tunnel_get(struct sk_buff *skb, struct genl_info *info)
455 struct net *net = genl_info_net(info);
457 if (!info->attrs[L2TP_ATTR_CONN_ID]) {
462 tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);
476 ret = l2tp_nl_tunnel_send(msg, info->snd_portid, info->snd_seq,
483 return genlmsg_unicast(net, msg, info->snd_portid);
521 static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *info)
530 struct net *net = genl_info_net(info);
532 if (!info->attrs[L2TP_ATTR_CONN_ID]) {
537 tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);
544 if (!info->attrs[L2TP_ATTR_SESSION_ID]) {
548 session_id = nla_get_u32(info->attrs[L2TP_ATTR_SESSION_ID]);
550 if (!info->attrs[L2TP_ATTR_PEER_SESSION_ID]) {
554 peer_session_id = nla_get_u32(info->attrs[L2TP_ATTR_PEER_SESSION_ID]);
556 if (!info->attrs[L2TP_ATTR_PW_TYPE]) {
560 cfg.pw_type = nla_get_u16(info->attrs[L2TP_ATTR_PW_TYPE]);
573 if (info->attrs[L2TP_ATTR_L2SPEC_TYPE]) {
574 cfg.l2specific_type = nla_get_u8(info->attrs[L2TP_ATTR_L2SPEC_TYPE]);
584 if (info->attrs[L2TP_ATTR_COOKIE]) {
585 u16 len = nla_len(info->attrs[L2TP_ATTR_COOKIE]);
592 memcpy(&cfg.cookie[0], nla_data(info->attrs[L2TP_ATTR_COOKIE]), len);
594 if (info->attrs[L2TP_ATTR_PEER_COOKIE]) {
595 u16 len = nla_len(info->attrs[L2TP_ATTR_PEER_COOKIE]);
602 memcpy(&cfg.peer_cookie[0], nla_data(info->attrs[L2TP_ATTR_PEER_COOKIE]), len);
604 if (info->attrs[L2TP_ATTR_IFNAME])
605 cfg.ifname = nla_data(info->attrs[L2TP_ATTR_IFNAME]);
608 if (info->attrs[L2TP_ATTR_RECV_SEQ])
609 cfg.recv_seq = nla_get_u8(info->attrs[L2TP_ATTR_RECV_SEQ]);
611 if (info->attrs[L2TP_ATTR_SEND_SEQ])
612 cfg.send_seq = nla_get_u8(info->attrs[L2TP_ATTR_SEND_SEQ]);
614 if (info->attrs[L2TP_ATTR_LNS_MODE])
615 cfg.lns_mode = nla_get_u8(info->attrs[L2TP_ATTR_LNS_MODE]);
617 if (info->attrs[L2TP_ATTR_RECV_TIMEOUT])
618 cfg.reorder_timeout = nla_get_msecs(info->attrs[L2TP_ATTR_RECV_TIMEOUT]);
640 ret = l2tp_session_notify(&l2tp_nl_family, info, session,
652 static int l2tp_nl_cmd_session_delete(struct sk_buff *skb, struct genl_info *info)
658 session = l2tp_nl_session_get(info);
664 l2tp_session_notify(&l2tp_nl_family, info,
678 static int l2tp_nl_cmd_session_modify(struct sk_buff *skb, struct genl_info *info)
683 session = l2tp_nl_session_get(info);
689 if (info->attrs[L2TP_ATTR_RECV_SEQ])
690 session->recv_seq = nla_get_u8(info->attrs[L2TP_ATTR_RECV_SEQ]);
692 if (info->attrs[L2TP_ATTR_SEND_SEQ]) {
693 session->send_seq = nla_get_u8(info->attrs[L2TP_ATTR_SEND_SEQ]);
697 if (info->attrs[L2TP_ATTR_LNS_MODE])
698 session->lns_mode = nla_get_u8(info->attrs[L2TP_ATTR_LNS_MODE]);
700 if (info->attrs[L2TP_ATTR_RECV_TIMEOUT])
701 session->reorder_timeout = nla_get_msecs(info->attrs[L2TP_ATTR_RECV_TIMEOUT]);
703 ret = l2tp_session_notify(&l2tp_nl_family, info,
792 static int l2tp_nl_cmd_session_get(struct sk_buff *skb, struct genl_info *info)
798 session = l2tp_nl_session_get(info);
810 ret = l2tp_nl_session_send(msg, info->snd_portid, info->snd_seq,
815 ret = genlmsg_unicast(genl_info_net(info), msg, info->snd_portid);