uint32_t peer_tunnel_id;
uint32_t session_id;
uint32_t peer_session_id;
- uint32_t offset;
- uint32_t peer_offset;
enum l2tp_encap_type encap;
uint16_t local_udp_port;
uint16_t peer_udp_port;
inet_prefix peer_ip;
uint16_t pw_type;
- uint16_t mtu;
unsigned int udp6_csum_tx:1;
unsigned int udp6_csum_rx:1;
unsigned int udp_csum:1;
unsigned int recv_seq:1;
unsigned int send_seq:1;
- unsigned int lns_mode:1;
- unsigned int data_seq:2;
unsigned int tunnel:1;
unsigned int session:1;
int reorder_timeout;
addattr8(&req.n, 1024, L2TP_ATTR_L2SPEC_TYPE, p->l2spec_type);
addattr8(&req.n, 1024, L2TP_ATTR_L2SPEC_LEN, p->l2spec_len);
- if (p->mtu)
- addattr16(&req.n, 1024, L2TP_ATTR_MTU, p->mtu);
if (p->recv_seq)
addattr8(&req.n, 1024, L2TP_ATTR_RECV_SEQ, 1);
if (p->send_seq)
addattr8(&req.n, 1024, L2TP_ATTR_SEND_SEQ, 1);
- if (p->lns_mode)
- addattr(&req.n, 1024, L2TP_ATTR_LNS_MODE);
- if (p->data_seq)
- addattr8(&req.n, 1024, L2TP_ATTR_DATA_SEQ, p->data_seq);
if (p->reorder_timeout)
addattr64(&req.n, 1024, L2TP_ATTR_RECV_TIMEOUT,
p->reorder_timeout);
- if (p->offset)
- addattr16(&req.n, 1024, L2TP_ATTR_OFFSET, p->offset);
if (p->cookie_len)
addattr_l(&req.n, 1024, L2TP_ATTR_COOKIE,
p->cookie, p->cookie_len);
print_string(PRINT_ANY, "encap", " encap %s",
p->encap == L2TP_ENCAPTYPE_UDP ? "UDP" :
p->encap == L2TP_ENCAPTYPE_IP ? "IP" : "??");
- print_string(PRINT_FP, NULL, "%s", _SL_);
+ print_nl();
print_string(PRINT_ANY, "local", " From %s ",
inet_ntop(p->local_ip.family, p->local_ip.data,
print_string(PRINT_ANY, "peer", "to %s",
inet_ntop(p->peer_ip.family, p->peer_ip.data,
buf, sizeof(buf)));
- print_string(PRINT_FP, NULL, "%s", _SL_);
+ print_nl();
print_uint(PRINT_ANY, "peer_tunnel", " Peer tunnel %u",
p->peer_tunnel_id);
- print_string(PRINT_FP, NULL, "%s", _SL_);
+ print_nl();
if (p->encap == L2TP_ENCAPTYPE_UDP) {
print_string(PRINT_FP, NULL,
p->local_udp_port);
print_uint(PRINT_ANY, "peer_port", "/%hu",
p->peer_udp_port);
- print_string(PRINT_FP, NULL, "%s", _SL_);
+ print_nl();
switch (p->local_ip.family) {
case AF_INET:
print_uint(PRINT_ANY, "session_id", "Session %u", p->session_id);
print_uint(PRINT_ANY, "tunnel_id", " in tunnel %u", p->tunnel_id);
- print_string(PRINT_FP, NULL, "%s", _SL_);
+ print_nl();
print_uint(PRINT_ANY, "peer_session_id",
" Peer session %u,", p->peer_session_id);
print_uint(PRINT_ANY, "peer_tunnel_id",
" tunnel %u", p->peer_tunnel_id);
- print_string(PRINT_FP, NULL, "%s", _SL_);
+ print_nl();
if (p->ifname != NULL) {
print_color_string(PRINT_ANY, COLOR_IFNAME,
"interface", " interface name: %s" , p->ifname);
- print_string(PRINT_FP, NULL, "%s", _SL_);
+ print_nl();
}
- print_uint(PRINT_ANY, "offset", " offset %u,", p->offset);
- print_uint(PRINT_ANY, "peer_offset", " peer offset %u\n", p->peer_offset);
+ /* Show offsets only for plain console output (for legacy scripts) */
+ print_uint(PRINT_FP, "offset", " offset %u,", 0);
+ print_uint(PRINT_FP, "peer_offset", " peer offset %u\n", 0);
if (p->cookie_len > 0)
- print_cookie("cookie", "cookie",
+ print_cookie("cookie", " cookie %s",
p->cookie, p->cookie_len);
+
if (p->peer_cookie_len > 0)
- print_cookie("peer_cookie", "peer cookie",
+ print_cookie("peer_cookie", " peer cookie %s",
p->peer_cookie, p->peer_cookie_len);
if (p->reorder_timeout != 0)
p->pw_type = rta_getattr_u16(attrs[L2TP_ATTR_PW_TYPE]);
if (attrs[L2TP_ATTR_ENCAP_TYPE])
p->encap = rta_getattr_u16(attrs[L2TP_ATTR_ENCAP_TYPE]);
- if (attrs[L2TP_ATTR_OFFSET])
- p->offset = rta_getattr_u16(attrs[L2TP_ATTR_OFFSET]);
- if (attrs[L2TP_ATTR_DATA_SEQ])
- p->data_seq = rta_getattr_u16(attrs[L2TP_ATTR_DATA_SEQ]);
if (attrs[L2TP_ATTR_CONN_ID])
p->tunnel_id = rta_getattr_u32(attrs[L2TP_ATTR_CONN_ID]);
if (attrs[L2TP_ATTR_PEER_CONN_ID])
p->local_udp_port = rta_getattr_u16(attrs[L2TP_ATTR_UDP_SPORT]);
if (attrs[L2TP_ATTR_UDP_DPORT])
p->peer_udp_port = rta_getattr_u16(attrs[L2TP_ATTR_UDP_DPORT]);
- if (attrs[L2TP_ATTR_MTU])
- p->mtu = rta_getattr_u16(attrs[L2TP_ATTR_MTU]);
if (attrs[L2TP_ATTR_IFNAME])
p->ifname = rta_getattr_str(attrs[L2TP_ATTR_IFNAME]);
return 0;
}
-static int session_nlmsg(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int session_nlmsg(struct nlmsghdr *n, void *arg)
{
int ret = get_response(n, arg);
return 0;
}
-static int tunnel_nlmsg(const struct sockaddr_nl *who,
- struct nlmsghdr *n, void *arg)
+static int tunnel_nlmsg(struct nlmsghdr *n, void *arg)
{
int ret = get_response(n, arg);
" tunnel_id ID\n"
" session_id ID peer_session_id ID\n"
" [ cookie HEXSTR ] [ peer_cookie HEXSTR ]\n"
- " [ offset OFFSET ] [ peer_offset OFFSET ]\n"
" [ seq { none | send | recv | both } ]\n"
" [ l2spec_type L2SPEC ]\n"
" ip l2tp del tunnel tunnel_id ID\n"
invarg("invalid option for udp6_csum_tx\n"
, *argv);
} else if (strcmp(*argv, "offset") == 0) {
- __u8 uval;
-
+ fprintf(stderr, "Ignoring option \"offset\"\n");
NEXT_ARG();
- if (get_u8(&uval, *argv, 0))
- invarg("invalid offset\n", *argv);
- p->offset = uval;
} else if (strcmp(*argv, "peer_offset") == 0) {
- __u8 uval;
-
+ fprintf(stderr, "Ignoring option \"peer_offset\"\n");
NEXT_ARG();
- if (get_u8(&uval, *argv, 0))
- invarg("invalid offset\n", *argv);
- p->peer_offset = uval;
} else if (strcmp(*argv, "cookie") == 0) {
int slen;